first commit

This commit is contained in:
Your Name
2026-02-07 20:22:48 +08:00
commit 1b9711d5e4
2270 changed files with 805872 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
raspi-config is licensed under the terms of the MIT license reproduced below.
#####################################################
Copyright (c) 2012 Alex Bradbury <asb@asbradbury.org>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,47 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service
# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes
# On systems without virtual consoles, don't start any getty. Note
# that serial gettys are covered by serial-getty@.service, not this
# unit.
ConditionPathExists=/dev/tty0
[Service]
# the VT is cleared by TTYVTDisallocate
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
[Install]
WantedBy=getty.target
DefaultInstance=tty1

View File

@@ -0,0 +1,6 @@
debhelper-build-stamp
files
*.debhelper.log
*.debhelper
*.substvars
raspi-config/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
10

View File

@@ -0,0 +1,15 @@
Source: raspi-config
Section: utils
Priority: optional
Maintainer: Serge Schneider <serge@raspberrypi.com>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 4.3.0
Vcs-Git: git://git@github.com:RPi-Distro/raspi-config.git
Vcs-Browser: https://github.com/RPi-Distro/raspi-config
Package: raspi-config
Architecture: all
Depends: ${misc:Depends}, whiptail, parted, lua5.1, alsa-utils, psmisc, initramfs-tools
Recommends: triggerhappy, iw, crda
Description: Raspberry Pi configuration tool
A simple configuration tool for common Raspberry Pi administrative tasks

View File

@@ -0,0 +1,25 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/RPi-Distro/raspi-config
Files: *
Copyright: 2012 Alex Bradbury <asb@asbradbury.org>
License: MIT
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,57 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: raspi-config
# Required-Start: udev mountkernfs $remote_fs
# Required-Stop:
# Default-Start: S 2 3 4 5
# Default-Stop:
# Short-Description: Switch to ondemand cpu governor (unless shift key is pressed)
# Description:
### END INIT INFO
. /lib/lsb/init-functions
if [ -f /etc/default/cpu_governor ]; then
. /etc/default/cpu_governor
fi
CPU_DEFAULT_GOVERNOR="${CPU_DEFAULT_GOVERNOR:-ondemand}"
CPU_ONDEMAND_UP_THRESHOLD="${CPU_ONDEMAND_UP_THRESHOLD:-50}"
CPU_ONDEMAND_SAMPLING_RATE="${CPU_ONDEMAND_SAMPLING_RATE:-100000}"
CPU_ONDEMAND_DOWN_SAMPLING_FACTOR="${CPU_ONDEMAND_DOWN_SAMPLING_FACTOR:-50}"
CPU_ONDEMAND_INCLUDE_IO_CALC="${CPU_ONDEMAND_INCLUDE_IO_CALC:-0}"
case "$1" in
start)
log_daemon_msg "Checking if shift key is held down"
if [ -x /usr/sbin/thd ] && timeout 1 thd --dump /dev/input/event* | grep -q "LEFTSHIFT\|RIGHTSHIFT"; then
printf " Yes. Not enabling $CPU_DEFAULT_GOVERNOR scaling governor"
log_end_msg 0
else
printf " No. Switching to $CPU_DEFAULT_GOVERNOR scaling governor"
SYS_CPUFREQ_GOVERNOR=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
if [ -e $SYS_CPUFREQ_GOVERNOR ]; then
for cpu_core in /sys/devices/system/cpu/cpu?/cpufreq/scaling_governor ; do
echo "$CPU_DEFAULT_GOVERNOR" > $cpu_core
done
if [ "$CPU_DEFAULT_GOVERNOR" = "ondemand" ]; then
echo "$CPU_ONDEMAND_UP_THRESHOLD" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo "$CPU_ONDEMAND_SAMPLING_RATE" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo "$CPU_ONDEMAND_DOWN_SAMPLING_FACTOR" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo "$CPU_ONDEMAND_INCLUDE_IO_CALC" > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
fi
fi
log_end_msg 0
fi
;;
stop)
;;
restart)
;;
force-reload)
;;
*)
echo "Usage: $0 start" >&2
exit 3
;;
esac

View File

@@ -0,0 +1,3 @@
raspi-config /usr/bin
usr/
etc/

View File

@@ -0,0 +1,33 @@
#!/bin/sh
if [ -e /etc/init.d/switch_cpu_governor ]; then
update-rc.d switch_cpu_governor remove >/dev/null
fi
if dpkg --compare-versions "${2}" lt-nl "20170619"; then
update-rc.d -f raspi-config remove
fi
if dpkg --compare-versions "${2}" lt-nl "20220804"; then
echo "Moving to crda for regulatory domain management..."
if [ -f /etc/wpa_supplicant/wpa_supplicant.conf ]; then
REGDOMAIN="$(sed -n 's/^country=\(.*\)$/\1/p' /etc/wpa_supplicant/wpa_supplicant.conf)"
if [ -n "$REGDOMAIN" ]; then
echo "Setting to $REGDOMAIN..."
raspi-config nonint do_wifi_country "$REGDOMAIN"
else
echo "Regulatory domain was unset"
fi
else
echo "wpa_cupplicant.conf not found"
fi
fi
if dpkg --compare-versions "${2}" lt-nl "20220907+1"; then
IMG_VER="$(grep -s -m1 -o '[[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}' /etc/rpi-issue)"
if [ "$IMG_VER" = "2022-09-06" ] && [ -f /2 ]; then
rm -f /2
fi
fi
#DEBHELPER#

View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
case "$1" in
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
purge)
if [ -d /etc/X11/xorg.conf.d/ ]; then
rmdir --ignore-fail-on-non-empty /etc/X11/xorg.conf.d/
fi
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

View File

@@ -0,0 +1,36 @@
#! /bin/sh
# prerm script for raspi-config
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <prerm> `purge'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <new-prerm> `abort-install'
# * <new-prerm> `abort-install' <old-version>
# * <new-prerm> `abort-upgrade' <old-version>
# * <disappearer's-prerm> `disappear' <overwriter> <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove|upgrade)
;;
failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

View File

@@ -0,0 +1,16 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
override_dh_installinit:
dh_installinit --no-start
%:
dh $@

View File

@@ -0,0 +1 @@
3.0 (native)

View File

@@ -0,0 +1,35 @@
#
# Set default governor on all CPU cores.
# More info https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
#
# CPU_DEFAULT_GOVERNOR="ondemand"
#
#
# ondemand governor: This defines what the average CPU usage between the
# samplings of 'sampling_rate' needs to be for the kernel to make a decision
# on whether it should increase the frequency.
#
# CPU_ONDEMAND_UP_THRESHOLD=50
#
#
# ondemand governor: How often you want the kernel to look at the CPU usage
# and to make decisions on what to do about the frequency.
#
# CPU_ONDEMAND_SAMPLING_RATE=100000
#
#
# ondemand governor: The rate at which the kernel makes a decision on when to
# decrease the frequency while running at top speed
#
# CPU_ONDEMAND_DOWN_SAMPLING_FACTOR=50
#
#
# ondemand governor: Include Input/Output (I/O) activity into CPU activity
# calculations when using ondemand CPU governor
#
# CPU_ONDEMAND_INCLUDE_IO_CALC=0
#

View File

@@ -0,0 +1,5 @@
Defaults env_keep += "http_proxy HTTP_PROXY"
Defaults env_keep += "https_proxy HTTPS_PROXY"
Defaults env_keep += "ftp_proxy FTP_PROXY"
Defaults env_keep += "RSYNC_PROXY"
Defaults env_keep += "no_proxy NO_PROXY"

3309
external/cache/sources/raspi-config/raspi-config vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
#!/bin/sh
if raspi-config nonint is_kms ; then
if ps ax | grep -v grep | grep -q openbox ; then
exec xcompmgr -aR
fi
fi

View File

@@ -0,0 +1,227 @@
#!/bin/sh
reboot_pi () {
umount /boot
mount / -o remount,ro
sync
if [ "$NOOBS" = "1" ]; then
if [ "$NEW_KERNEL" = "1" ]; then
reboot -f "$BOOT_PART_NUM"
sleep 5
else
echo "$BOOT_PART_NUM" > "/sys/module/${BCM_MODULE}/parameters/reboot_part"
fi
fi
reboot -f
sleep 5
exit 0
}
check_commands () {
if ! command -v whiptail > /dev/null; then
echo "whiptail not found"
sleep 5
return 1
fi
for COMMAND in grep cut sed parted fdisk findmnt; do
if ! command -v $COMMAND > /dev/null; then
FAIL_REASON="$COMMAND not found"
return 1
fi
done
return 0
}
check_noobs () {
if [ "$BOOT_PART_NUM" = "1" ]; then
NOOBS=0
else
NOOBS=1
fi
}
get_variables () {
ROOT_PART_DEV=$(findmnt / -o source -n)
ROOT_PART_NAME=$(echo "$ROOT_PART_DEV" | cut -d "/" -f 3)
ROOT_DEV_NAME=$(echo /sys/block/*/"${ROOT_PART_NAME}" | cut -d "/" -f 4)
ROOT_DEV="/dev/${ROOT_DEV_NAME}"
ROOT_PART_NUM=$(cat "/sys/block/${ROOT_DEV_NAME}/${ROOT_PART_NAME}/partition")
BOOT_PART_DEV=$(findmnt /boot -o source -n)
BOOT_PART_NAME=$(echo "$BOOT_PART_DEV" | cut -d "/" -f 3)
BOOT_DEV_NAME=$(echo /sys/block/*/"${BOOT_PART_NAME}" | cut -d "/" -f 4)
BOOT_PART_NUM=$(cat "/sys/block/${BOOT_DEV_NAME}/${BOOT_PART_NAME}/partition")
OLD_DISKID=$(fdisk -l "$ROOT_DEV" | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p')
check_noobs
ROOT_DEV_SIZE=$(cat "/sys/block/${ROOT_DEV_NAME}/size")
TARGET_END=$((ROOT_DEV_SIZE - 1))
PARTITION_TABLE=$(parted -m "$ROOT_DEV" unit s print | tr -d 's')
LAST_PART_NUM=$(echo "$PARTITION_TABLE" | tail -n 1 | cut -d ":" -f 1)
ROOT_PART_LINE=$(echo "$PARTITION_TABLE" | grep -e "^${ROOT_PART_NUM}:")
ROOT_PART_START=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 2)
ROOT_PART_END=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 3)
if [ "$NOOBS" = "1" ]; then
EXT_PART_LINE=$(echo "$PARTITION_TABLE" | grep ":::;" | head -n 1)
EXT_PART_NUM=$(echo "$EXT_PART_LINE" | cut -d ":" -f 1)
EXT_PART_START=$(echo "$EXT_PART_LINE" | cut -d ":" -f 2)
EXT_PART_END=$(echo "$EXT_PART_LINE" | cut -d ":" -f 3)
fi
}
fix_partuuid() {
mount -o remount,rw "$ROOT_PART_DEV"
mount -o remount,rw "$BOOT_PART_DEV"
DISKID="$(tr -dc 'a-f0-9' < /dev/hwrng | dd bs=1 count=8 2>/dev/null)"
fdisk "$ROOT_DEV" > /dev/null <<EOF
x
i
0x$DISKID
r
w
EOF
if [ "$?" -eq 0 ]; then
sed -i "s/${OLD_DISKID}/${DISKID}/g" /etc/fstab
sed -i "s/${OLD_DISKID}/${DISKID}/" /boot/cmdline.txt
sync
fi
mount -o remount,ro "$ROOT_PART_DEV"
mount -o remount,ro "$BOOT_PART_DEV"
}
fix_wpa() {
if [ -e /boot/firstrun.sh ] \
&& ! grep -q 'imager_custom set_wlan' /boot/firstrun.sh \
&& grep -q wpa_supplicant.conf /boot/firstrun.sh; then
mount -o remount,rw "$ROOT_PART_DEV"
modprobe rfkill
REGDOMAIN=$(sed -n 's/^\s*country=\(..\)$/\1/p' /boot/firstrun.sh)
[ -n "$REGDOMAIN" ] && raspi-config nonint do_wifi_country "$REGDOMAIN"
if systemctl -q is-enabled NetworkManager; then
systemctl disable NetworkManager
fi
mount -o remount,ro "$ROOT_PART_DEV"
fi
}
check_variables () {
if [ "$NOOBS" = "1" ]; then
if [ "$EXT_PART_NUM" -gt 4 ] || \
[ "$EXT_PART_START" -gt "$ROOT_PART_START" ] || \
[ "$EXT_PART_END" -lt "$ROOT_PART_END" ]; then
FAIL_REASON="Unsupported extended partition"
return 1
fi
fi
if [ "$BOOT_DEV_NAME" != "$ROOT_DEV_NAME" ]; then
FAIL_REASON="Boot and root partitions are on different devices"
return 1
fi
if [ "$ROOT_PART_NUM" -ne "$LAST_PART_NUM" ]; then
FAIL_REASON="Root partition should be last partition"
return 1
fi
if [ "$ROOT_PART_END" -gt "$TARGET_END" ]; then
FAIL_REASON="Root partition runs past the end of device"
return 1
fi
if [ ! -b "$ROOT_DEV" ] || [ ! -b "$ROOT_PART_DEV" ] || [ ! -b "$BOOT_PART_DEV" ] ; then
FAIL_REASON="Could not determine partitions"
return 1
fi
}
check_kernel () {
MAJOR="$(uname -r | cut -f1 -d.)"
MINOR="$(uname -r | cut -f2 -d.)"
if [ "$MAJOR" -eq "4" ] && [ "$MINOR" -lt "9" ]; then
return 0
fi
if [ "$MAJOR" -lt "4" ]; then
return 0
fi
NEW_KERNEL=1
}
main () {
get_variables
if ! check_variables; then
return 1
fi
# Switch to dhcpcd here if Imager < v1.7.3 was used to generate firstrun.sh
fix_wpa > /dev/null 2>&1
check_kernel
if [ "$NOOBS" = "1" ] && [ "$NEW_KERNEL" != "1" ]; then
BCM_MODULE=$(grep -e "^Hardware" /proc/cpuinfo | cut -d ":" -f 2 | tr -d " " | tr '[:upper:]' '[:lower:]')
if ! modprobe "$BCM_MODULE"; then
FAIL_REASON="Couldn't load BCM module $BCM_MODULE"
return 1
fi
fi
if [ "$ROOT_PART_END" -eq "$TARGET_END" ]; then
reboot_pi
fi
if [ "$NOOBS" = "1" ]; then
if ! printf "resizepart %s\nyes\n%ss\n" "$EXT_PART_NUM" "$TARGET_END" | parted "$ROOT_DEV" ---pretend-input-tty; then
FAIL_REASON="Extended partition resize failed"
return 1
fi
fi
if ! parted -m "$ROOT_DEV" u s resizepart "$ROOT_PART_NUM" "$TARGET_END"; then
FAIL_REASON="Root partition resize failed"
return 1
fi
fix_partuuid
return 0
}
mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t tmpfs tmp /run
mkdir -p /run/systemd
mount /boot
mount / -o remount,ro
sed -i 's| init=/usr/lib/raspi-config/init_resize\.sh||' /boot/cmdline.txt
sed -i 's| sdhci\.debug_quirks2=4||' /boot/cmdline.txt
if ! grep -q splash /boot/cmdline.txt; then
sed -i "s/ quiet//g" /boot/cmdline.txt
fi
mount /boot -o remount,ro
sync
if ! check_commands; then
reboot_pi
fi
if main; then
whiptail --infobox "Resized root filesystem. Rebooting in 5 seconds..." 20 60
sleep 5
else
whiptail --msgbox "Could not expand filesystem, please try raspi-config or rc_gui.\n${FAIL_REASON}" 20 60
sleep 5
fi
reboot_pi

View File

@@ -0,0 +1,11 @@
Section "Extensions"
Option "DPMS" "Disable"
EndSection
Section "ServerLayout"
Identifier "ServerLayout0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
Option "BlankTime" "0"
EndSection