From a90f890503edf139c280f425fc694be2451314f6 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Mon, 9 Sep 2019 15:22:55 -0400 Subject: [PATCH 01/49] build: Remove copying of 'rmt' into installer filesystem (#176) On Debian systems, /etc/rmt is a dangling symlink until after a package which provides 'rmt' is installed (at which point the links are /etc/rmt -> /usr/sbin/rmt -> /etc/alternatives/rmt). During the build of the installer, alternatives are not processed, so /etc/rmt is a link which points into the filesystem of the build host (not the build directory). If the build is being done on a Debian-style system, the installer will end up with an /etc/rmt which is a binary from the host, which may not even operate on the Raspberry Pi. If the build is being done on a non-Debian-style system, the cp command in create_cpio() will probably fail. Since the installer does not connect to other systems to process tar archives, rmt is not needed, so this patch removes any attempt to copy it into the installer. Signed-off-by: Kevin P. Fleming --- build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sh b/build.sh index 34dec2d3..187c0e55 100755 --- a/build.sh +++ b/build.sh @@ -427,9 +427,7 @@ function create_cpio { # tar components cp --preserve=xattr,timestamps tmp/bin/tar rootfs/bin/ - cp --preserve=xattr,timestamps tmp/etc/rmt rootfs/etc/ cp --preserve=xattr,timestamps tmp/usr/lib/mime/packages/tar rootfs/usr/lib/mime/packages/ - cp --preserve=xattr,timestamps tmp/usr/sbin/rmt-tar rootfs/usr/sbin/ cp --preserve=xattr,timestamps tmp/usr/sbin/tarcat rootfs/usr/sbin/ # fdisk components From 21b973dc2d929f26b81c0fc94c4abee1fdaac3d6 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Mon, 9 Sep 2019 15:39:39 -0400 Subject: [PATCH 02/49] build: allow 'sudo' usage in buildroot.sh (#177) * Allow 'sudo' usage in buildroot.sh If 'sudo' is configured properly it can be used for the various steps in buildroot.sh which require root privileges. This avoids the need to to run the entire script with such privileges. Users can enable this mode by setting `use_sudo=1` in buildroot.conf. Signed-off-by: Kevin P. Fleming * build: resolve shellcheck issue on directory cleanup --- BUILD.md | 1 + buildroot.sh | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/BUILD.md b/BUILD.md index 967210f5..bf52e0d2 100644 --- a/BUILD.md +++ b/BUILD.md @@ -46,5 +46,6 @@ To set buildroot options, create a file named `buildroot.conf`, which contains t - `compress_bz2=1` - create a bz2-compressed image - `compress_xz=1` - create a xz-compressed image +- `use_sudo=1` - use passwordless-sudo for operations which require root privileges By default both bzip2 and xz compressed versions of the image will be created and the uncompressed image will deleted, but either or both can be disabled. If both are disabled, the uncompressed image will be left in place. diff --git a/buildroot.sh b/buildroot.sh index d286dd10..9d88ecc7 100755 --- a/buildroot.sh +++ b/buildroot.sh @@ -10,12 +10,19 @@ compress_bz2=1 # Controls production of an xz-compressed image compress_xz=1 +# Use 'sudo' for commands which require root privileges +use_sudo=0 + # If a configuration file exists, import its settings if [ -e buildroot.conf ]; then # shellcheck disable=SC1091 source buildroot.conf fi +if [ "$use_sudo" = "1" ]; then + SUDO=sudo +fi + build_dir=build_dir version_tag="$(git describe --exact-match --tags HEAD 2> /dev/null || true)" @@ -33,11 +40,12 @@ image=${build_dir}/${imagename}.img # Prepare rm -f "${image}" +rm -rf "${build_dir:-build_dir}/mnt/" # Create image dd if=/dev/zero of="$image" bs=1M count=128 -fdisk "${image}" < Date: Sun, 11 Aug 2019 22:43:12 +0200 Subject: [PATCH 03/49] installer: stop telnet output on finish --- scripts/opt/raspberrypi-ua-netinst/install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 81244f4c..d227ea87 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -2398,6 +2398,9 @@ DURATION=$((ENDTIME - REAL_STARTTIME)) echo echo -n "Installation finished at $(date --date="@${ENDTIME}" --utc)" echo " and took $((DURATION/60)) min $((DURATION%60)) sec (${DURATION} seconds)" +echo +killall -q nc +echo "Printing console to telnet output stopped." # copy logfile to standard log directory if [ "${cleanup_logfiles}" = "1" ]; then From 01e91a241f7f6c046886fcea62041fd2b387b050 Mon Sep 17 00:00:00 2001 From: FooDeas Date: Sun, 11 Aug 2019 22:47:43 +0200 Subject: [PATCH 04/49] installer: code improvement --- scripts/opt/raspberrypi-ua-netinst/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index d227ea87..15d9711e 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1919,9 +1919,9 @@ if [ -n "${system_default_locale}" ]; then system_default_locale="$(echo "${system_default_locale}" | grep -Eo "^\S+")" # trim to first space character echo -n "'${system_default_locale}'... " if chroot /rootfs /usr/sbin/update-locale LANG="${system_default_locale}" &> /dev/null; then - echo "OK" + echo "OK" else - echo "FAILED !" + echo "FAILED !" fi fi else @@ -2430,7 +2430,7 @@ if [ "${final_action}" != "console" ]; then killall -q udhcpc echo "OK" fi - + echo -n "Unmounting filesystems... " for sysfolder in /sys /proc /dev/pts /dev; do umount "/rootfs${sysfolder}" From 831fc8d3ad1f1be0458988c7f4c45025653cd049 Mon Sep 17 00:00:00 2001 From: FooDeas Date: Thu, 15 Aug 2019 22:47:55 +0200 Subject: [PATCH 05/49] update license --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 135c6d62..8cfb9caa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2018 Andreas Eberlein +Copyright (c) 2016-2019 Andreas Eberlein Copyright (c) 2013 Toni Spets Permission to use, copy, modify, and distribute this software for any From b51faf3640920acbab5a2ef7ba1de002d46811da Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 14 Sep 2019 06:04:12 -0400 Subject: [PATCH 06/49] installer: assume that minimum release being installed is 'Jessie' (#179) * Remove remaining tests for Wheezy release Most support for the Debian 'Wheezy' release was already removed, but a few tests remain. This patch removes them. Signed-off-by: Kevin P. Fleming * Use proper test for type of init system Instead of assuming systemd will be the init system unless the configuration replaces the cdebootstrap command completely, check the cdebootstrap command and the configuration variables which list packages to see if any of them will install the sysvinit-core package. If that package is installed then the init system will be sysvinit, otherwise it will be systemd. Signed-off-by: Kevin P. Fleming --- scripts/opt/raspberrypi-ua-netinst/install.sh | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 15d9711e..32c5cef3 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1138,13 +1138,19 @@ if ! wget --spider "${mirror}/dists/${release}/" &> /dev/null; then release_raspbian="${release_fallback}" fi +# if the configuration will install the sysvinit-core package, then the init system will +# be sysvinit, otherwise it will be systemd +if echo "${cdebootstrap_cmdline} ${syspackages} ${packages}" | grep -q "sysvinit-core"; then + init_system="sysvinit" +else + init_system="systemd" +fi + # configure different kinds of presets if [ -z "${cdebootstrap_cmdline}" ]; then # from small to large: base, minimal, server # not very logical that minimal > base, but that's how it was historically defined - init_system="systemd" - # always add packages if requested or needed if [ "${firmware_packages}" = "1" ]; then custom_packages_postinstall="${custom_packages_postinstall},firmware-atheros,firmware-brcm80211,firmware-libertas,firmware-misc-nonfree,firmware-realtek" @@ -1178,10 +1184,7 @@ if [ -z "${cdebootstrap_cmdline}" ]; then if [ "$(find "${tmp_bootfs}"/raspberrypi-ua-netinst/config/apt/ -maxdepth 1 -type f -name "*.list" 2> /dev/null | wc -l)" != 0 ]; then base_packages="${base_packages},apt-transport-https" fi - base_packages_postinstall=raspberrypi-bootloader - if [ "${release}" != "wheezy" ]; then - base_packages_postinstall="${base_packages_postinstall},raspberrypi-kernel" - fi + base_packages_postinstall="raspberrypi-bootloader,raspberrypi-kernel" base_packages_postinstall="${custom_packages_postinstall},${base_packages_postinstall}" # minimal @@ -1192,10 +1195,7 @@ if [ -z "${cdebootstrap_cmdline}" ]; then if [ -z "${rtc}" ]; then minimal_packages="${minimal_packages},fake-hwclock" fi - minimal_packages_postinstall="${base_packages_postinstall},${minimal_packages_postinstall}" - if [ "${release}" != "wheezy" ]; then - minimal_packages_postinstall="${minimal_packages_postinstall},raspberrypi-sys-mods" - fi + minimal_packages_postinstall="${base_packages_postinstall},${minimal_packages_postinstall},raspberrypi-sys-mods" if echo "${ifname}" | grep -q "wlan"; then minimal_packages_postinstall="${minimal_packages_postinstall},firmware-brcm80211" fi @@ -1640,14 +1640,12 @@ if [ -n "${root_ssh_pubkey}" ]; then fail fi fi -# openssh-server in jessie and higher doesn't allow root to login with a password +# openssh-server doesn't allow root to login with a password if [ "${root_ssh_pwlogin}" = "1" ]; then - if [ "${release_raspbian}" != "wheezy" ]; then - if [ -f /rootfs/etc/ssh/sshd_config ]; then - echo -n " Allowing root to login with password... " - sed -i '/PermitRootLogin/s/.*/PermitRootLogin yes/' /rootfs/etc/ssh/sshd_config || fail - echo "OK" - fi + if [ -f /rootfs/etc/ssh/sshd_config ]; then + echo -n " Allowing root to login with password... " + sed -i '/PermitRootLogin/s/.*/PermitRootLogin yes/' /rootfs/etc/ssh/sshd_config || fail + echo "OK" fi fi # disable global password login if requested From ca23d1b57c9e7f41f894a12aa062310d552cc811 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 18 Mar 2020 14:40:50 -0400 Subject: [PATCH 07/49] installer: Add 'use all systemd services' mode (#186) This patch adds a 'use_systemd_services' configuration option. If this option is enabled and the installer will be installing systemd in the target system (not sysvinit), then the following changes will be made in the target system (compared to the default mode): * ifupdown, ntp, dhcpcd, fake-hwclock, etc. will not be installed * systemd-networkd will be used to configure and manage the network * systemd-resolved will be used for DNS resolution * systemd-timesyncd will be used for time synchronization (and fake hardware clock handling on systems which do not have an RTC) Signed-off-by: Kevin P. Fleming --- doc/INSTALL_CUSTOM.md | 15 ++ scripts/opt/raspberrypi-ua-netinst/install.sh | 129 ++++++++++++++---- 2 files changed, 114 insertions(+), 30 deletions(-) diff --git a/doc/INSTALL_CUSTOM.md b/doc/INSTALL_CUSTOM.md index ee240b55..44538fe1 100644 --- a/doc/INSTALL_CUSTOM.md +++ b/doc/INSTALL_CUSTOM.md @@ -23,12 +23,26 @@ ### Description: Presets +#### Default configuration (when `use_systemd_services` is unset or set to `0`): + | Preset | Packages | |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `base` | _\,apt,kmod_ | | `minimal` | _\,cpufrequtils,fake-hwclock,ifupdown,net-tools,ntp,openssh-server,dosfstools,raspberrypi-sys-mods_ | | `server` | _\,systemd-sysv,vim-tiny,iputils-ping,wget,ca-certificates,rsyslog,cron,dialog,locales,tzdata,less,man-db,logrotate,bash-completion,console-setup,apt-utils,libraspberrypi-bin,raspi-copies-and-fills_ | +Note that if the networking configuration is set to use DHCP, `isc-dhcp-client` will also be installed. + +#### Advanced configuration (when `use_systemd_services` is set to `1`): + +| Preset | Packages | +|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `base` | _\,apt,kmod_ | +| `minimal` | _\,cpufrequtils,iproute2,openssh-server,dosfstools,raspberrypi-sys-mods_ | +| `server` | _\,systemd-sysv,vim-tiny,iputils-ping,wget,ca-certificates,rsyslog,cron,dialog,locales,tzdata,less,man-db,logrotate,bash-completion,console-setup,apt-utils,libraspberrypi-bin,raspi-copies-and-fills_ | + +Note that if the networking configuration is set to use DHCP, no additional packages will be installed as `systemd-networkd` provides DHCP client support. + ## Device / peripheral | Parameter | Default | Options | Description | @@ -142,3 +156,4 @@ | `disable_predictable_nin` | `1` | `0`/`1` | Disable Predictable Network Interface Names. Set to 0 if you want to use predictable network interface names, which means if you use the same SD card on a different RPi board, your network device might be named differently. This will result in the board having no network connectivity. | | `drivers_to_load` | | | Loads additional kernel modules at installation (comma separated and quoted). | | `online_config` | | | URL to extra config that will be executed after installer-config.txt | +| `use_systemd_services` | `0` | `0`/`1` | Use systemd for networking and DNS resolution. | diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 32c5cef3..409f90d2 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -96,6 +96,7 @@ variables_reset() { sound_usb_first= camera_enable= camera_disable_led= + use_systemd_services= } variable_set() { @@ -171,6 +172,7 @@ variables_set_defaults() { variable_set "sound_usb_first" "0" variable_set "camera_enable" "0" variable_set "camera_disable_led" "0" + variable_set "use_systemd_services" "0" } led_sos() { @@ -1141,9 +1143,13 @@ fi # if the configuration will install the sysvinit-core package, then the init system will # be sysvinit, otherwise it will be systemd if echo "${cdebootstrap_cmdline} ${syspackages} ${packages}" | grep -q "sysvinit-core"; then - init_system="sysvinit" + init_system="sysvinit" + if [ "${use_systemd_services}" != "0" ]; then + echo "Ignoring 'use_systemd_services' setting because init system is 'sysvinit'" + use_systemd_services=0 + fi else - init_system="systemd" + init_system="systemd" fi # configure different kinds of presets @@ -1188,12 +1194,15 @@ if [ -z "${cdebootstrap_cmdline}" ]; then base_packages_postinstall="${custom_packages_postinstall},${base_packages_postinstall}" # minimal - minimal_packages="cpufrequtils,ifupdown,net-tools,openssh-server,dosfstools" - if [ "${init_system}" != "systemd" ]; then + minimal_packages="cpufrequtils,openssh-server,dosfstools" + if [ "${init_system}" != "systemd" ] || [ "${use_systemd_services}" = "0" ]; then minimal_packages="${minimal_packages},ntp" - fi - if [ -z "${rtc}" ]; then - minimal_packages="${minimal_packages},fake-hwclock" + if [ -z "${rtc}" ]; then + minimal_packages="${minimal_packages},fake-hwclock" + fi + minimal_packages="${minimal_packages},ifupdown,net-tools" + else + minimal_packages="${minimal_packages},iproute2" fi minimal_packages_postinstall="${base_packages_postinstall},${minimal_packages_postinstall},raspberrypi-sys-mods" if echo "${ifname}" | grep -q "wlan"; then @@ -1369,6 +1378,7 @@ echo " sound_usb_enable = ${sound_usb_enable}" echo " sound_usb_first = ${sound_usb_first}" echo " camera_enable = ${camera_enable}" echo " camera_disable_led = ${camera_disable_led}" +echo " use_systemd_services = ${use_systemd_services}" echo echo "OTP dump:" vcgencmd otp_dump | grep -v "..:00000000\|..:ffffffff" | sed 's/^/ /' @@ -1778,9 +1788,9 @@ else fi echo "OK" -# networking +# networking - ifupdown if echo "${cdebootstrap_cmdline} ${packages_postinstall}" | grep -q "ifupdown"; then - echo -n " Configuring network settings... " + echo -n " Configuring ifupdown network settings... " mkdir -p /rootfs/etc/network touch /rootfs/etc/network/interfaces || fail # lo interface may already be there, so first check for it @@ -1820,14 +1830,6 @@ if echo "${cdebootstrap_cmdline} ${packages_postinstall}" | grep -q "ifupdown"; } >> /rootfs/etc/network/interfaces fi - # Customize cmdline.txt - if [ "${disable_predictable_nin}" = "1" ]; then - # as described here: https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames - # adding net.ifnames=0 to /boot/cmdline and disabling the persistent-net-generator.rules - line_add cmdline_custom "net.ifnames=0" - ln -s /dev/null /rootfs/etc/udev/rules.d/75-persistent-net-generator.rules - fi - echo "OK" # copy resolv.conf @@ -1845,6 +1847,65 @@ if echo "${cdebootstrap_cmdline} ${packages_postinstall}" | grep -q "ifupdown"; fi fi +# networking - systemd +if [ "${use_systemd_services}" != "0" ]; then + echo -n " Configuring systemd network settings... " + NETFILE=/rootfs/etc/systemd/network/primary.network + mkdir -p /rootfs/etc/systemd/network + + { + echo "[Match]" + echo "Name=${ifname}" + echo "[Network]" + } >> ${NETFILE} + + if [ "${ip_addr}" = "dhcp" ]; then + echo "DHCP=yes" >> ${NETFILE} + else + NETPREFIX=$(/bin/busybox ipcalc -p ${ip_addr} ${ip_netmask} | cut -f2 -d=) + { + echo "Address=${ip_addr}/${NETPREFIX}" + for i in ${ip_nameservers}; do + echo "DNS=${i}" + done + if [ -n "${timeserver}" ]; then + echo "NTP=${timeserver}" + fi + echo "[Route]" + echo "Gateway=${ip_gateway}" + } >> ${NETFILE} + fi + + # enable systemd-networkd service + ln -s /lib/systemd/system/systemd-networkd.service /rootfs/etc/systemd/system/multi-user.target.wants/systemd-networkd.service + + # enable systemd-resolved service + ln -s /lib/systemd/system/systemd-resolved.service /rootfs/etc/systemd/system/multi-user.target.wants/systemd-resolved.service + + # wlan config + if echo "${ifname}" | grep -q "wlan"; then + if [ -e "${wlan_configfile}" ]; then + # copy the installer version of `wpa_supplicant.conf` + mkdir -p /rootfs/etc/wpa_supplicant + cp "${wlan_configfile}" /rootfs/etc/wpa_supplicant/wpa_supplicant-${ifname}.conf + chmod 600 /rootfs/etc/wpa_supplicant/wpa_supplicant-${ifname}.conf + fi + # enable wpa_supplicant service + ln -s /lib/systemd/system/wpa_supplicant@.service /rootfs/etc/systemd/system/multi-user.target.wants/wpa_supplicant@${ifname}.service + rm /rootfs/etc/systemd/system/multi-user.target.wants/wpa_supplicant.service + fi + + echo "OK" +fi + +# Customize cmdline.txt if predictable network interface names are not desired +if [ "${disable_predictable_nin}" = "1" ]; then + # as described here: https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames + # adding net.ifnames=0 to /boot/cmdline and disabling the persistent-net-generator.rules + line_add cmdline_custom "net.ifnames=0" + ln -s /dev/null /rootfs/etc/udev/rules.d/75-persistent-net-generator.rules +fi + # set timezone and reconfigure tzdata package if [ -n "${timezone}" ]; then echo -n " Configuring tzdata (timezone \"${timezone}\")... " @@ -1950,22 +2011,22 @@ fi echo -# if there is no hw clock on rpi -if [ -z "${rtc}" ]; then - if grep -q "#HWCLOCKACCESS=yes" /rootfs/etc/default/hwclock; then - sed -i "s/^#\(HWCLOCKACCESS=\)yes/\1no/" /rootfs/etc/default/hwclock - elif grep -q "HWCLOCKACCESS=yes" /rootfs/etc/default/hwclock; then - sed -i "s/^\(HWCLOCKACCESS=\)yes/\1no/m" /rootfs/etc/default/hwclock +if [ "${use_systemd_services}" = "0" ]; then + # if systemd is not in use, setup hwclock appropriately + if [ -z "${rtc}" ]; then + if grep -q "#HWCLOCKACCESS=yes" /rootfs/etc/default/hwclock; then + sed -i "s/^#\(HWCLOCKACCESS=\)yes/\1no/" /rootfs/etc/default/hwclock + elif grep -q "HWCLOCKACCESS=yes" /rootfs/etc/default/hwclock; then + sed -i "s/^\(HWCLOCKACCESS=\)yes/\1no/m" /rootfs/etc/default/hwclock + else + echo -e "HWCLOCKACCESS=no\n" >> /rootfs/etc/default/hwclock + fi else - echo -e "HWCLOCKACCESS=no\n" >> /rootfs/etc/default/hwclock + sed -i "s/^\(exit 0\)/\/sbin\/hwclock --hctosys\n\1/" /rootfs/etc/rc.local fi else - sed -i "s/^\(exit 0\)/\/sbin\/hwclock --hctosys\n\1/" /rootfs/etc/rc.local -fi - -# enable NTP client on systemd releases -if [ "${init_system}" = "systemd" ]; then - ln -s /usr/lib/systemd/system/systemd-timesyncd.service /rootfs/etc/systemd/system/multi-user.target.wants/systemd-timesyncd.service + # enable systemd-timesyncd + ln -s /lib/systemd/system/systemd-timesyncd.service /rootfs/etc/systemd/system/multi-user.target.wants/systemd-timesyncd.service fi # copy apt's sources.list to the target system @@ -2379,6 +2440,14 @@ if [ -e "/rootfs/boot/raspberrypi-ua-netinst/config/post-install.txt" ]; then echo "=================================================" fi +# this must be done as the last step, after all package installation and post-install scripts, +# since it will break DNS resolution on the target system until it is rebooted +if [ "${use_systemd_services}" != "0" ]; then + # ensure that /etc/resolv.conf will be provided by systemd and use systemd's stub resolver + rm -f /rootfs/etc/resolv.conf + ln -s /run/systemd/resolve/stub-resolv.conf /rootfs/etc/resolv.conf +fi + # save current time if echo "${cdebootstrap_cmdline} ${packages_postinstall}" | grep -q "fake-hwclock"; then echo -n "Saving current time for fake-hwclock... " From 43d94ea8945241430bc62221190b5c2cf908501a Mon Sep 17 00:00:00 2001 From: FooDeas Date: Wed, 18 Mar 2020 19:44:40 +0100 Subject: [PATCH 08/49] update license --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 8cfb9caa..b8b02f08 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2019 Andreas Eberlein +Copyright (c) 2016-2020 Andreas Eberlein Copyright (c) 2013 Toni Spets Permission to use, copy, modify, and distribute this software for any From caf7423b96910eedbaa1d5f217018db796d30a5c Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 18 Mar 2020 18:54:27 -0400 Subject: [PATCH 09/49] installer: improve RTC handling (#188) * Add 'abx80x' to list of possible RTC drivers * Add 'module_enable' function in installer script for modules to be loaded in installed system * Use 'dtoverlay_enable' function in various places it was not being used * Ensure module for the RTC has been loaded during installation * Stop adding 'hwclock' call to /etc/rc.local as it is no longer needed - systems using sysvinit already have a udev rule to do this - systems using systemd will use service unit described below * Add systemd service unit to read RTC on startup - as seen in Debian bug 855203, systems using systemd don't read the RTC during startup if the RTC's driver is loaded as a module; since all Raspberry Pi kernels are configured this way, a service unit is required to read the RTC during system startup * Ensure module for the RTC will be loaded in installed system * Ensure that RTC date/time is set in UTC mode The 'ensure module loaded' bits are required because at least one RTC module (abx80x) is not automatically loaded even though the proper Device Tree overlay has been configured. For those which are autoloaded, having the module name in /etc/modules (or /etc/modules-load.d/rtc.conf) won't cause any harm. Signed-off-by: Kevin P. Fleming --- doc/INSTALL_CUSTOM.md | 2 +- scripts/opt/raspberrypi-ua-netinst/install.sh | 60 ++++++++++++++----- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/doc/INSTALL_CUSTOM.md b/doc/INSTALL_CUSTOM.md index 44538fe1..6b803726 100644 --- a/doc/INSTALL_CUSTOM.md +++ b/doc/INSTALL_CUSTOM.md @@ -55,7 +55,7 @@ Note that if the networking configuration is set to use DHCP, no additional pack | `sound_usb_first` | `0` | `0`/`1` | Set to "1" to define USB audio as default if onboard audio is also enabled. The options `sound_enable=1` and `sound_usb_enable=1` have to be set to take effect. | | `camera_enable` | `0` | `0`/`1` | Set to "1" to enable the camera module. This enables all camera-related parameters in config.txt. | | `camera_disable_led` | `0` | `0`/`1` | Disables the camera LED. The option `camera_enable=1` has to be set to take effect. | -| `rtc` | | `ds1307`/ `ds1339`/ `ds3231`/ `mcp7940x`/ `mcp7941x`/ `pcf2127`/ `pcf8523`/ `pcf8563` | Select an RTC if it is connected via I²C. | +| `rtc` | | `ds1307`/ `ds1339`/ `ds3231`/ `mcp7940x`/ `mcp7941x`/ `pcf2127`/ `pcf8523`/ `pcf8563`/ `abx80x` | Select an RTC if it is connected via I²C. | | `dt_overlays` | | | Enables additional device tree overlays (comma separated and quoted). (e.g. 'dt_overlays="hifiberry-dac,lirc-rpi"') | ## SSH diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 409f90d2..f0c4f890 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -487,6 +487,16 @@ dtoverlay_enable() { fi } +module_enable() { + local module="${1}" + local purpose="${2}" + if [ "${init_system}" = "systemd" ]; then + echo "${module}" > "/rootfs/etc/modules-load.d/${purpose}.conf" + else + echo "${module}" >> /rootfs/etc/modules + fi +} + ####################### ### INSTALLER ### ####################### @@ -755,7 +765,7 @@ fi if [ -n "${rtc}" ] ; then echo -n " Enabling RTC configuration... " if ! grep -q "^dtoverlay=i2c-rtc,${rtc}\>" /boot/config.txt; then - echo -e "\ndtoverlay=i2c-rtc,${rtc}" >> /boot/config.txt + dtoverlay_enable "/boot/config.txt" "i2c-rtc,${rtc}" preinstall_reboot=1 fi echo "OK" @@ -913,6 +923,17 @@ if [ -n "${drivers_to_load}" ]; then echo fi +if [ -n "${rtc}" ] ; then + echo -n "Ensuring RTC module has been loaded... " + modprobe "rtc-${rtc}" || fail + echo "OK" + echo -n "Checking hardware clock access... " + mdev -s + sleep 3s + /opt/busybox/bin/hwclock --show &> /dev/null || fail + echo "OK" +fi + echo -n "Waiting for ${ifname}... " for i in $(seq 1 "${installer_networktimeout}"); do if ifconfig "${ifname}" &> /dev/null; then @@ -1391,13 +1412,6 @@ for i in $(seq 1 5); do done echo -if [ -n "${rtc}" ] ; then - echo -n "Checking hardware clock access... " - /opt/busybox/bin/hwclock --show &> /dev/null || fail - echo "OK" - echo -fi - # fdisk's boot offset is 2048, so only handle $bootoffset is it's larger then that if [ -n "${bootoffset}" ] && [ "${bootoffset}" -gt 2048 ]; then emptyspaceend=$((bootoffset - 1)) @@ -2025,8 +2039,25 @@ if [ "${use_systemd_services}" = "0" ]; then sed -i "s/^\(exit 0\)/\/sbin\/hwclock --hctosys\n\1/" /rootfs/etc/rc.local fi else - # enable systemd-timesyncd ln -s /lib/systemd/system/systemd-timesyncd.service /rootfs/etc/systemd/system/multi-user.target.wants/systemd-timesyncd.service + + if [ -n "${rtc}" ]; then + cat > /rootfs/etc/systemd/system/hwclock-to-sysclock.service << EOF +[Unit] +Description=Set system clock from hardware clock +After=systemd-modules-load.service + +[Service] +Type=oneshot +ExecStart=/sbin/hwclock --hctosys --utc + +[Install] +WantedBy=basic.target + +EOF + mkdir /rootfs/etc/systemd/system/basic.target.wants + ln -s /etc/systemd/system/hwclock-to-sysclock.service /rootfs/etc/systemd/system/basic.target.wants/hwclock-to-sysclock.service + fi fi # copy apt's sources.list to the target system @@ -2248,7 +2279,7 @@ if [ "${i2c_enable}" = "1" ]; then sed -i "s/^\(dtparam=i2c_arm=.*\)/#\1/" /rootfs/boot/config.txt echo "dtparam=i2c_arm=on" >> /rootfs/boot/config.txt fi - echo "i2c-dev" >> /rootfs/etc/modules + module_enable "i2c-dev" "i2c" if [ -n "${i2c_baudrate}" ]; then if grep -q "i2c_baudrate=" /rootfs/boot/config.txt; then sed -i "s/\(.*i2c_baudrate=.*\)/#\1/" /rootfs/boot/config.txt @@ -2379,11 +2410,8 @@ fi # enable rtc if specified in the configuration file if [ -n "${rtc}" ]; then - sed -i "s/^#\(dtoverlay=i2c-rtc,${rtc}\)/\1/" /rootfs/boot/config.txt - if [ "$(grep -c "^dtoverlay=i2c-rtc,.*" /rootfs/boot/config.txt)" -ne 1 ]; then - sed -i "s/^\(dtoverlay=i2c-rtc,\)/#\1/" /rootfs/boot/config.txt - echo "dtoverlay=i2c-rtc,${rtc}" >> /rootfs/boot/config.txt - fi + dtoverlay_enable "/rootfs/boot/config.txt" "i2c-rtc,${rtc}" + module_enable "rtc-${rtc}" "rtc" fi # enable custom dtoverlays @@ -2456,7 +2484,7 @@ if echo "${cdebootstrap_cmdline} ${packages_postinstall}" | grep -q "fake-hwcloc echo "OK" elif [ -n "${rtc}" ]; then echo -n "Saving current time to RTC... " - /opt/busybox/bin/hwclock --systohc || fail + /opt/busybox/bin/hwclock --systohc --utc || fail echo "OK" fi From 685148f6454f2929e01c7fd8fa0817cfe468842b Mon Sep 17 00:00:00 2001 From: FooDeas Date: Wed, 13 May 2020 16:55:08 +0200 Subject: [PATCH 10/49] installer: fix user provided sources.list (#194) --- scripts/opt/raspberrypi-ua-netinst/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index f0c4f890..5cce4305 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -2065,7 +2065,6 @@ echo "Configuring apt:" echo -n " Configuring Raspbian repository... " if [ -e "/rootfs/boot/raspberrypi-ua-netinst/config/apt/sources.list" ]; then sed "s/__RELEASE__/${release_raspbian}/g" "/rootfs/boot/raspberrypi-ua-netinst/config/apt/sources.list" > "/rootfs/etc/apt/sources.list" || fail - cp /rootfs/boot/raspberrypi-ua-netinst/config/apt/sources.list /rootfs/etc/apt/sources.list || fail else sed "s/__RELEASE__/${release_raspbian}/g" "/opt/raspberrypi-ua-netinst/res/etc/apt/sources.list" > "/rootfs/etc/apt/sources.list" || fail fi From 0acc6e1d0ccca1f240c33d83f379c012a389e719 Mon Sep 17 00:00:00 2001 From: "Maurice (mausy5043) Hendrix" Date: Sat, 8 Aug 2020 18:07:33 +0200 Subject: [PATCH 11/49] fix for missing `hwmon.ko` (#200) --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 187c0e55..ff2f8a64 100755 --- a/build.sh +++ b/build.sh @@ -202,7 +202,7 @@ function create_cpio { mkdir -p "rootfs/lib/modules/${kernel}/kernel/drivers/hwmon" done cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/rtc rootfs/lib/modules/kernel*/kernel/drivers/ - cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/hwmon/hwmon.ko rootfs/lib/modules/kernel*/kernel/drivers/hwmon/ + cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/hwmon/raspberrypi-hwmon.ko rootfs/lib/modules/kernel*/kernel/drivers/hwmon/ # create dependency lists for kernel in "${kernels[@]}"; do From c4a6b0ef62d29332ff4a36c6238cc46d615d1a2f Mon Sep 17 00:00:00 2001 From: FooDeas Date: Mon, 4 Jan 2021 15:28:27 +0100 Subject: [PATCH 12/49] CI: fix Travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 970f2046..49ae6596 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: bash sudo: false -install: gem install mdl +install: gem install chef-utils:16.6.14 mdl script: - bash -c 'shopt -s globstar; shellcheck **/*.sh' - mdl --verbose --rules '~MD013, ~MD036' . From 9e7655ba45a356f07ef19819b07df8c09178e1e3 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 08:38:42 -0500 Subject: [PATCH 13/49] Enable IPv6 during installation if enabled in final system If IPv6 support in the final system has not been disabled, allow its use during the installation process too. --- build.sh | 1 + scripts/opt/raspberrypi-ua-netinst/install.sh | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/build.sh b/build.sh index ff2f8a64..cc3c23f6 100755 --- a/build.sh +++ b/build.sh @@ -181,6 +181,7 @@ function create_cpio { mkdir -p "rootfs/lib/modules/${kernel}/kernel/drivers/net" mkdir -p "rootfs/lib/modules/${kernel}/kernel/net" done + cp_kernelfiles tmp/lib/modules/kernel*/kernel/net/ipv6 rootfs/lib/modules/kernel*/kernel/net/ cp_kernelfiles tmp/lib/modules/kernel*/kernel/net/mac80211 rootfs/lib/modules/kernel*/kernel/net/ cp_kernelfiles tmp/lib/modules/kernel*/kernel/net/rfkill rootfs/lib/modules/kernel*/kernel/net/ cp_kernelfiles tmp/lib/modules/kernel*/kernel/net/wireless rootfs/lib/modules/kernel*/kernel/net/ diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 5cce4305..0f22054e 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -810,6 +810,7 @@ echo echo "Network configuration:" echo " ifname = ${ifname}" echo " ip_addr = ${ip_addr}" +echo " ip_ipv6 = ${ip_ipv6}" if [ "${ip_addr}" != "dhcp" ]; then ip_addr_o1="$(echo "${ip_addr}" | awk -F. '{print $1}')" @@ -991,6 +992,12 @@ else echo "OK" fi +if [ "${ip_ipv6}" = "1" ]; then + echo -n "Enabling IPv6 support... " + modprobe ipv6 || fail + echo "OK" +fi + # Start telnet console output if [ "${installer_telnet}" = "1" ]; then mkfifo telnet.pipe From ae109ccb2ef72d8cfa55b370caea5d6de17382a8 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 08:46:01 -0500 Subject: [PATCH 14/49] Improve reinstallation support Utilize the 'os_prefix' mechanism available in config.txt in modern firmware to store all of the installer's files in a subdirectory in /boot; this avoids them being modified or replaced during the system installation, and also avoids the need for the installer script to copy them around (and reboot) during a reinstallation. --- README.md | 6 ++++-- build.sh | 17 +++++++++++------ scripts/opt/raspberrypi-ua-netinst/install.sh | 17 ----------------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index f043e546..d22e3c93 100644 --- a/README.md +++ b/README.md @@ -147,10 +147,12 @@ When an error occurs during install, the logfile is placed in the `raspberrypi-u ## Reinstalling or replacing an existing system -If you want to reinstall with the same settings you did your first install you can just move the original _config.txt_ back and reboot. +If you want to reinstall with the same settings you did your first install you can just copy the original _config.txt_ back and reboot. + +Note: If the original installation was performed with `cleanup` set to `1`, then the files necessary for a reinstallation will not be available. ``` -mv /boot/raspberrypi-ua-netinst/reinstall/config.txt /boot/config.txt +cp /boot/raspberrypi-ua-netinst/config.txt /boot/config.txt reboot ``` diff --git a/build.sh b/build.sh index cc3c23f6..e2fadc1d 100755 --- a/build.sh +++ b/build.sh @@ -725,28 +725,33 @@ get_kernels # initialize bootfs rm -rf bootfs -mkdir bootfs +mkdir -p bootfs/raspberrypi-ua-netinst # raspberrypi-bootloader components and kernel cp --preserve=xattr,timestamps -r tmp/boot/* bootfs/ +mv bootfs/kernel*.img bootfs/raspberrypi-ua-netinst/ +mv bootfs/*.dtb bootfs/raspberrypi-ua-netinst/ +mv bootfs/overlays bootfs/raspberrypi-ua-netinst/ if [ ! -f bootfs/config.txt ] ; then touch bootfs/config.txt fi create_cpio -mkdir -p bootfs/raspberrypi-ua-netinst -mv raspberrypi-ua-netinst.cpio.gz bootfs/raspberrypi-ua-netinst/ +mv raspberrypi-ua-netinst.cpio.gz bootfs/raspberrypi-ua-netinst/initramfs.gz { echo "[all]" - echo "initramfs raspberrypi-ua-netinst/raspberrypi-ua-netinst.cpio.gz" + echo "os_prefix=raspberrypi-ua-netinst/" + echo "initramfs initramfs.gz" echo "gpu_mem=16" echo "[pi3]" echo "enable_uart=1" -} >> bootfs/config.txt +} >> bootfs/raspberrypi-ua-netinst/config.txt + +cp bootfs/raspberrypi-ua-netinst/config.txt bootfs/config.txt -echo "dwc_otg.lpm_enable=0 consoleblank=0 console=serial0,115200 console=tty1 elevator=deadline rootwait" > bootfs/cmdline.txt +echo "dwc_otg.lpm_enable=0 consoleblank=0 console=serial0,115200 console=tty1 elevator=deadline rootwait" > bootfs/raspberrypi-ua-netinst/cmdline.txt if [ ! -f bootfs/TIMEOUT ] ; then touch bootfs/TIMEOUT diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 0f22054e..06280940 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -719,15 +719,6 @@ variables_set_defaults preinstall_reboot=0 echo echo "Checking if config.txt needs to be modified before starting installation..." -# Reinstallation -if [ -e "/boot/raspberrypi-ua-netinst/reinstall/kernel.img" ] && [ -e "/boot/raspberrypi-ua-netinst/reinstall/kernel7.img" ] && [ -e "/boot/raspberrypi-ua-netinst/reinstall/kernel7l.img" ] ; then - echo -n " Reinstallation requested! Restoring files... " - mv /boot/raspberrypi-ua-netinst/reinstall/kernel.img /boot/kernel.img - mv /boot/raspberrypi-ua-netinst/reinstall/kernel7.img /boot/kernel7.img - mv /boot/raspberrypi-ua-netinst/reinstall/kernel7l.img /boot/kernel7l.img - echo "OK" - preinstall_reboot=1 -fi # HDMI settings if [ "${hdmi_system_only}" = "0" ]; then echo -n " Setting HDMI options... " @@ -2227,14 +2218,6 @@ echo -n "Removing cdebootstrap-helper-rc.d... " chroot /rootfs /usr/bin/dpkg -r cdebootstrap-helper-rc.d &> /dev/null || fail echo "OK" -echo -n "Preserving original config.txt and kernels... " -mkdir -p /rootfs/boot/raspberrypi-ua-netinst/reinstall -cp /rootfs/boot/config.txt /rootfs/boot/raspberrypi-ua-netinst/reinstall/config.txt -cp /rootfs/boot/kernel.img /rootfs/boot/raspberrypi-ua-netinst/reinstall/kernel.img -cp /rootfs/boot/kernel7.img /rootfs/boot/raspberrypi-ua-netinst/reinstall/kernel7.img -cp /rootfs/boot/kernel7l.img /rootfs/boot/raspberrypi-ua-netinst/reinstall/kernel7l.img -echo "OK" - echo -n "Configuring bootloader to start the installed system..." if [ -e "/rootfs/boot/raspberrypi-ua-netinst/config/boot/config.txt" ]; then cp /rootfs/boot/raspberrypi-ua-netinst/config/boot/config.txt /rootfs/boot/config.txt From 9517a844c8493ffc5c50effb22e9c30050e5bb0b Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 08:48:23 -0500 Subject: [PATCH 15/49] Copy libtic library to proper file name --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index e2fadc1d..a95cdc18 100755 --- a/build.sh +++ b/build.sh @@ -624,7 +624,7 @@ function create_cpio { # libtinfo6 components cp --preserve=xattr,timestamps tmp/lib/*/libtinfo.so.6.* rootfs/lib/libtinfo.so.6 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libtic.so.6.* rootfs/usr/lib/libtinfo.so.6 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libtic.so.6.* rootfs/usr/lib/libtic.so.6 # libuuid1 components cp --preserve=xattr,timestamps tmp/lib/*/libuuid.so.1.* rootfs/lib/libuuid.so.1 From 4207b7614521a326528bba7299a7da8e77b1c7a0 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 08:49:36 -0500 Subject: [PATCH 16/49] Cleanup additional files from .deb unpacking .deb files contain multiple components; clean up all of them after completing the processing of each package. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index a95cdc18..ff08e90a 100755 --- a/build.sh +++ b/build.sh @@ -717,7 +717,7 @@ rm -rf tmp && mkdir tmp # extract debs for i in ../packages/*.deb; do - cd tmp && ar x "../${i}" && tar -xf data.tar.*; rm data.tar.*; cd .. + cd tmp && ar x "../${i}" && tar -xf data.tar.*; rm -f data.tar.* control.tar.* debian-binary; cd .. done # get kernel versions From 69e02d47523b5164311d8011b02fdd8e270c1d17 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 08:51:42 -0500 Subject: [PATCH 17/49] Avoid creation of an unnecessary directory /rootfs/boot was being created in the in-memory temporary filesystem, when only /rootfs was required. --- scripts/opt/raspberrypi-ua-netinst/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 06280940..b7be36c8 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -520,7 +520,7 @@ mkdir -p /usr/bin mkdir -p /usr/sbin mkdir -p /var/run mkdir -p /etc/raspberrypi-ua-netinst -mkdir -p /rootfs/boot +mkdir -p /rootfs mkdir -p /tmp mkdir -p "${tmp_bootfs}" mkdir -p /opt/busybox/bin From 323fd52b7c75f7e8a19e10b23e8a40a79acff09e Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 08:52:44 -0500 Subject: [PATCH 18/49] Add /etc/mtab symbolic link mkfs.e2fs complains if it cannot find /etc/mtab when creating the root filesystem; a symbolic link to /proc/mounts resolves the problem. --- scripts/opt/raspberrypi-ua-netinst/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index b7be36c8..eba4de8f 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -533,6 +533,7 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bu echo "export PATH=${PATH}" > /etc/profile mount -t proc proc /proc +ln -sf /proc/mounts /etc/mtab mount -t sysfs sysfs /sys mount -t tmpfs -o size=64k,mode=0755 tmpfs /dev From 2f2bc7e3324181aeaea8a0dfdaf80880ec857c75 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 08:54:08 -0500 Subject: [PATCH 19/49] gnupg package is required The 'apt-key' tool requires gnupg but does not have a required dependency on it, so add the gnupg package to the 'base' list. --- doc/INSTALL_CUSTOM.md | 2 +- scripts/opt/raspberrypi-ua-netinst/install.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/INSTALL_CUSTOM.md b/doc/INSTALL_CUSTOM.md index 6b803726..1f3ca8b9 100644 --- a/doc/INSTALL_CUSTOM.md +++ b/doc/INSTALL_CUSTOM.md @@ -27,7 +27,7 @@ | Preset | Packages | |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `base` | _\,apt,kmod_ | +| `base` | _\,apt,gnupg,kmod_ | | `minimal` | _\,cpufrequtils,fake-hwclock,ifupdown,net-tools,ntp,openssh-server,dosfstools,raspberrypi-sys-mods_ | | `server` | _\,systemd-sysv,vim-tiny,iputils-ping,wget,ca-certificates,rsyslog,cron,dialog,locales,tzdata,less,man-db,logrotate,bash-completion,console-setup,apt-utils,libraspberrypi-bin,raspi-copies-and-fills_ | diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index eba4de8f..8efdd041 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1199,7 +1199,8 @@ if [ -z "${cdebootstrap_cmdline}" ]; then fi # base - base_packages="kmod" + # gnupg is required for 'apt-key' used later in the script + base_packages="kmod,gnupg" base_packages="${custom_packages},${base_packages}" if [ "${init_system}" = "systemd" ]; then base_packages="${base_packages},libpam-systemd" From b9a46847f42ac5b8f5479064c6b99882f9c99569 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 09:03:09 -0500 Subject: [PATCH 20/49] Add missing 'OK' during non-root-user SSH configuration --- scripts/opt/raspberrypi-ua-netinst/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 8efdd041..ad67bb74 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1702,6 +1702,7 @@ if [ -n "${username}" ]; then else echo -n "... " echo "${user_ssh_pubkey}" > "/rootfs/home/${username}/.ssh/authorized_keys" + echo "OK" fi echo -n " Setting owner as '${username}' on SSH directory... " chroot /rootfs /bin/chown -R "${username}:${username}" "/home/${username}/.ssh" || fail From f2e7846ad0ce6d6f1256bccfe6597af58696e761 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 09:58:33 -0500 Subject: [PATCH 21/49] Add outbound telnet support `installer_telnet` can now be set to `listen` (the previous mode), `connect`, or `none`. When `connect` is set, the installer will make an outbound connection to a specified host and port to deliver console output during the installation process. --- doc/INSTALL_CUSTOM.md | 4 ++- scripts/opt/raspberrypi-ua-netinst/install.sh | 27 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/doc/INSTALL_CUSTOM.md b/doc/INSTALL_CUSTOM.md index 6b803726..43bd301f 100644 --- a/doc/INSTALL_CUSTOM.md +++ b/doc/INSTALL_CUSTOM.md @@ -141,7 +141,9 @@ Note that if the networking configuration is set to use DHCP, no additional pack | `cleanup_logfiles` | `0` | `0`/`1` | Removes installer log files after success. | | `cmdline` | `"dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 elevator=deadline fsck.repair=yes"` | | | | `final_action` | `reboot` | `reboot`/ `poweroff`/ `halt`/ `console` | Action at the end of install. | -| `installer_telnet` | `1` | `0`/`1` | Send installer console output via telnet. | +| `installer_telnet` | `listen` | `none`/`connect`/`listen` | Connect to, or listen for, a telnet connection to send installer console output. | +| `installer_telnet_host` | | | Host name or address to use when `installer_telnet` is set to `connect`. | +| `installer_telnet_port` | '9923' | | Port number to use when `installer_telnet` is set to `connect`. | | `installer_retries` | `3` | | Number of retries if installation fails. | | `installer_networktimeout` | `15` | | Timeout in seconds for network interface initialization. | | `installer_pkg_updateretries` | `3` | | Number of retries if package update fails. | diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 5cce4305..9669dda3 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -77,6 +77,8 @@ variables_reset() { cmdline= rootfstype= installer_telnet= + installer_telnet_host= + installer_telnet_port= installer_retries= installer_networktimeout= installer_pkg_updateretries= @@ -126,6 +128,15 @@ variables_set_defaults() { if [ -n "${ip_broadcast}" ]; then echo " Variable 'ip_broadcast' is deprecated. This variable will be ignored!" fi + if [ "${installer_telnet}" = "1" ]; then + echo "'installer_telnet' now accepts 'connect' and 'listen' settings, not '1'." + echo "'listen' mode is being enabled." + installer_telnet="listen" + elif [ "${installer_telnet}" = "0" ]; then + echo "'installer_telnet' now accepts 'connect' and 'listen' settings, not '0'." + echo "Neither mode is enabled." + installer_telnet="none" + fi # set config defaults variable_set "preset" "server" @@ -153,7 +164,8 @@ variables_set_defaults() { variable_set "cmdline" "dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 elevator=deadline fsck.repair=yes" variable_set "rootfstype" "f2fs" variable_set "final_action" "reboot" - variable_set "installer_telnet" "1" + variable_set "installer_telnet" "listen" + variable_set "installer_telnet_port" "9923" variable_set "installer_retries" "3" variable_set "installer_networktimeout" "15" variable_set "installer_pkg_updateretries" "3" @@ -992,15 +1004,24 @@ else fi # Start telnet console output -if [ "${installer_telnet}" = "1" ]; then +if [ "${installer_telnet}" = "listen" ] || [ "${installer_telnet}" = "connect" ]; then mkfifo telnet.pipe mkfifo /dev/installer-telnet tee < telnet.pipe /dev/installer-telnet & + if [ "${installer_telnet}" = "listen" ]; then + nc_opts=(-klC -p 23) + else # connect + if [ -z "${installer_telnet_host}" ]; then + echo "'installer_telnet' set to 'connect' but no 'installer_telnet_host' specified." + echo "Telnet mode will not be enabled." + fi + nc_opts=(-C "${installer_telnet_host}" "${installer_telnet_port}") + fi while IFS= read -r line; do if [[ ! "${line}" =~ userpw|rootpw ]]; then echo "${line}" fi - done < "/dev/installer-telnet" | /bin/nc -klC -p 23 > /dev/null & + done < "/dev/installer-telnet" | /bin/nc "${nc_opts[@]}" > /dev/null & exec &> telnet.pipe rm telnet.pipe echo "Printing console to telnet output started." From 8e2021d02eabaa3e9cae5ec2347a7fb17df7da17 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 09:03:28 -0500 Subject: [PATCH 22/49] Use CR-LF translation when reading buildroot.conf --- buildroot.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/buildroot.sh b/buildroot.sh index 9d88ecc7..aecc6d33 100755 --- a/buildroot.sh +++ b/buildroot.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# shellcheck source=./buildroot.conf +# shellcheck disable=SC1091 set -e # exit if any command fails @@ -14,9 +16,8 @@ compress_xz=1 use_sudo=0 # If a configuration file exists, import its settings -if [ -e buildroot.conf ]; then - # shellcheck disable=SC1091 - source buildroot.conf +if [ -r buildroot.conf ]; then + source <(tr -d "\015" < buildroot.conf) fi if [ "$use_sudo" = "1" ]; then From e958abcfba8624c7b4bb290cf6bc6cb6d4ed3d96 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 2 Jan 2021 09:06:30 -0500 Subject: [PATCH 23/49] Improve console-on-UART handling For Pi3 and Pi4, disable the Bluetooth module so that the hardware UART can be used for the console. Using the mini UART requires that the CPU clock speed be fixed, which is not optimal. --- build.sh | 4 +++- update.sh | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index ff08e90a..ee767d3c 100755 --- a/build.sh +++ b/build.sh @@ -746,7 +746,9 @@ mv raspberrypi-ua-netinst.cpio.gz bootfs/raspberrypi-ua-netinst/initramfs.gz echo "initramfs initramfs.gz" echo "gpu_mem=16" echo "[pi3]" - echo "enable_uart=1" + echo "dtoverlay=disable-bt" + echo "[pi4]" + echo "dtoverlay=disable-bt" } >> bootfs/raspberrypi-ua-netinst/config.txt cp bootfs/raspberrypi-ua-netinst/config.txt bootfs/config.txt diff --git a/update.sh b/update.sh index 0328d576..2625a6b5 100755 --- a/update.sh +++ b/update.sh @@ -456,10 +456,14 @@ fi download_remote_file https://downloads.raspberrypi.org/raspbian/ "boot.tar.xz" xzcat ./config.txt sed -i "s/^\(dtparam=audio=on\)/#\1/" config.txt # disable audio { - echo -e "\n[pi3]" - echo -e "# Enable serial port\nenable_uart=1" - echo -e "\n[all]" - echo -e "# Add other config parameters below this line." + echo "" + echo "[pi3]" + echo "dtoverlay=disable-bt" + echo "[pi4]" + echo "dtoverlay=disable-bt" + echo "" + echo "[all]" + echo "# Add other config parameters below this line." } >> config.txt chmod 644 config.txt cd ../.. || exit 1 From 698145454d6a04b097dd08faf04455329ad9a601 Mon Sep 17 00:00:00 2001 From: ignaciojimenez Date: Sat, 6 Feb 2021 01:19:23 +0100 Subject: [PATCH 24/49] Fixing typo about current directory in use --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d22e3c93..d613a53e 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ If you want to reinstall with the same settings you did your first install you c Note: If the original installation was performed with `cleanup` set to `1`, then the files necessary for a reinstallation will not be available. ``` -cp /boot/raspberrypi-ua-netinst/config.txt /boot/config.txt +cp /boot/raspberrypi-ua-netinst/reinstall/config.txt /boot/config.txt reboot ``` From 6300b460dabe714f57765a2948cbf3f18ddba87f Mon Sep 17 00:00:00 2001 From: "Maurice (mausy5043) Hendrix" Date: Sun, 11 Apr 2021 14:14:59 +0200 Subject: [PATCH 25/49] Don't abort the build if source doesn't exist. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index ee767d3c..c237b5ee 100755 --- a/build.sh +++ b/build.sh @@ -38,7 +38,7 @@ function get_kernels { # copies files replacing "kernel*" with kernel versions in path function cp_kernelfiles { for kernel in "${kernels[@]}"; do - eval cp --preserve=xattr,timestamps -r "${1//kernel\*/${kernel}}" "${2//kernel\*/${kernel}}" + eval cp --preserve=xattr,timestamps -r "${1//kernel\*/${kernel}}" "${2//kernel\*/${kernel}}" || true done } From 8867a53c6a2c02beb959c3542281ceb6afd7f78f Mon Sep 17 00:00:00 2001 From: "Maurice (mausy5043) Hendrix" Date: Sun, 11 Apr 2021 14:18:21 +0200 Subject: [PATCH 26/49] mkfs.btrfs has moved --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c237b5ee..85093810 100755 --- a/build.sh +++ b/build.sh @@ -218,7 +218,7 @@ function create_cpio { sed -i "s/__DATE__/$(date)/" rootfs/opt/raspberrypi-ua-netinst/install.sh # btrfs-progs components - cp --preserve=xattr,timestamps tmp/bin/mkfs.btrfs rootfs/bin/ + cp --preserve=xattr,timestamps tmp/sbin/mkfs.btrfs rootfs/sbin/ cp --preserve=xattr,timestamps tmp/usr/lib/*/libbtrfs.so.0 rootfs/lib/ # busybox components From 90b1846a7340316c5efb233229aacdc86b9015b9 Mon Sep 17 00:00:00 2001 From: "Maurice (mausy5043) Hendrix" Date: Sun, 11 Jul 2021 19:10:39 +0200 Subject: [PATCH 27/49] insert group netdev into /etc/group This should fix install errors when the `wpa_supplicant.conf` file contains a `GROUP` directive. e.g. `DIR=/var/run/wpa_supplicant GROUP=netdev` --- scripts/opt/raspberrypi-ua-netinst/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index cff3fd00..9050ee6d 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -872,6 +872,7 @@ if [ "${ip_addr}" != "dhcp" ]; then fi if echo "${ifname}" | grep -q "wlan"; then + echo "netdev:x:111:" >> /etc/group if [ -e "${tmp_bootfs}"/raspberrypi-ua-netinst/config/wpa_supplicant.conf ]; then cp "${tmp_bootfs}"/raspberrypi-ua-netinst/config/wpa_supplicant.conf "${wlan_configfile}" inputfile_sanitize "${wlan_configfile}" From ce9731c878dea4da8957b52d046bde46417720a8 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 8 Mar 2023 13:42:25 +0100 Subject: [PATCH 28/49] Upgrade to bullseye. --- build.sh | 170 ++++++------------ scripts/opt/raspberrypi-ua-netinst/install.sh | 4 +- update.sh | 33 ++-- 3 files changed, 75 insertions(+), 132 deletions(-) diff --git a/build.sh b/build.sh index 85093810..c90d6f99 100755 --- a/build.sh +++ b/build.sh @@ -114,7 +114,6 @@ function create_cpio { mkdir -p rootfs # create all the directories needed to copy the various components into place mkdir -p rootfs/bin/ - mkdir -p rootfs/lib/arm-linux-gnueabihf/ mkdir -p rootfs/lib/lsb/init-functions.d/ mkdir -p rootfs/etc/{alternatives,cron.daily,default,init,init.d,iproute2,ld.so.conf.d,logrotate.d,network/if-up.d/} mkdir -p rootfs/etc/dpkg/dpkg.cfg.d/ @@ -125,7 +124,6 @@ function create_cpio { mkdir -p rootfs/sbin/ mkdir -p rootfs/usr/bin/ mkdir -p rootfs/usr/lib/mime/packages/ - mkdir -p rootfs/usr/lib/openssl-1.0.2/engines/ mkdir -p rootfs/usr/lib/engines-1.1/ mkdir -p rootfs/usr/lib/{tar,tc} mkdir -p rootfs/usr/sbin/ @@ -194,8 +192,8 @@ function create_cpio { for kernel in "${kernels[@]}"; do mkdir -p "rootfs/lib/modules/${kernel}/kernel/drivers/i2c/busses" done - cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/i2c/busses/i2c-bcm2708.ko rootfs/lib/modules/kernel*/kernel/drivers/i2c/busses/ - cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/i2c/busses/i2c-bcm2835.ko rootfs/lib/modules/kernel*/kernel/drivers/i2c/busses/ + cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/i2c/busses/i2c-bcm2708.ko* rootfs/lib/modules/kernel*/kernel/drivers/i2c/busses/ + cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/i2c/busses/i2c-bcm2835.ko* rootfs/lib/modules/kernel*/kernel/drivers/i2c/busses/ # copy rtc drivers for kernel in "${kernels[@]}"; do @@ -203,7 +201,7 @@ function create_cpio { mkdir -p "rootfs/lib/modules/${kernel}/kernel/drivers/hwmon" done cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/rtc rootfs/lib/modules/kernel*/kernel/drivers/ - cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/hwmon/raspberrypi-hwmon.ko rootfs/lib/modules/kernel*/kernel/drivers/hwmon/ + cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/hwmon/raspberrypi-hwmon.ko* rootfs/lib/modules/kernel*/kernel/drivers/hwmon/ # create dependency lists for kernel in "${kernels[@]}"; do @@ -219,7 +217,6 @@ function create_cpio { # btrfs-progs components cp --preserve=xattr,timestamps tmp/sbin/mkfs.btrfs rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/libbtrfs.so.0 rootfs/lib/ # busybox components cp --preserve=xattr,timestamps tmp/bin/busybox rootfs/bin @@ -341,9 +338,6 @@ function create_cpio { ln -s mke2fs mkfs.ext4dev cd ../.. - # libf2fs5 components - cp --preserve=xattr,timestamps tmp/lib/*/libf2fs.so.5.* rootfs/lib/libf2fs.so.5 - # f2fs-tools components cp --preserve=xattr,timestamps tmp/sbin/mkfs.f2fs rootfs/sbin/ @@ -398,7 +392,7 @@ function create_cpio { # lsb-base components cp --preserve=xattr,timestamps tmp/lib/lsb/init-functions rootfs/lib/lsb/ - cp --preserve=xattr,timestamps tmp/lib/lsb/init-functions.d/20-left-info-blocks rootfs/lib/lsb/init-functions.d/ + cp --preserve=xattr,timestamps tmp/lib/lsb/init-functions.d/00-verbose rootfs/lib/lsb/init-functions.d/ # netbase components cp --preserve=xattr,timestamps tmp/etc/protocols rootfs/etc/ @@ -420,11 +414,9 @@ function create_cpio { # raspbian-archive-keyring components cp --preserve=xattr,timestamps tmp/usr/share/keyrings/raspbian-archive-keyring.gpg rootfs/usr/share/keyrings/ - # rng-tools components + # rng-tools5 components cp --preserve=xattr,timestamps tmp/usr/bin/rngtest rootfs/usr/bin/ cp --preserve=xattr,timestamps tmp/usr/sbin/rngd rootfs/usr/sbin/ - cp --preserve=xattr,timestamps tmp/etc/default/rng-tools rootfs/etc/default/ - cp --preserve=xattr,timestamps tmp/etc/init.d/rng-tools rootfs/etc/init.d/ # tar components cp --preserve=xattr,timestamps tmp/bin/tar rootfs/bin/ @@ -448,20 +440,14 @@ function create_cpio { # libacl1 components cp --preserve=xattr,timestamps tmp/usr/lib/*/libacl.so.1.* rootfs/usr/lib/libacl.so.1 - # libatm1 components - cp --preserve=xattr,timestamps tmp/lib/*/libatm.so.1.* rootfs/lib/libatm.so.1 - # libattr1 components cp --preserve=xattr,timestamps tmp/usr/lib/*/libattr.so.1.* rootfs/usr/lib/libattr.so.1 - # libaudit-common components - cp --preserve=xattr,timestamps tmp/etc/libaudit.conf rootfs/etc/ - - # libaudit1 components - cp --preserve=xattr,timestamps tmp/lib/*/libaudit.so.1.* rootfs/lib/libaudit.so.1 - # libblkid1 components - cp --preserve=xattr,timestamps tmp/lib/*/libblkid.so.1.* rootfs/lib/libblkid.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libblkid.so.1.* rootfs/usr/lib/libblkid.so.1 + + # libbpf0 components + cp --preserve=xattr,timestamps tmp/usr/lib/*/libbpf.so.0.* rootfs/usr/lib/libbpf.so.0 # libbsd0 components cp --preserve=xattr,timestamps tmp/usr/lib/*/libbsd.so.0.* rootfs/usr/lib/libbsd.so.0 @@ -493,13 +479,9 @@ function create_cpio { # libc6 components cp --preserve=xattr,timestamps tmp/lib/*/ld-*.so rootfs/lib/ld-linux-armhf.so.3 - # some executables require the dynamic linker to be found - # at this path, so leave a symlink there - ln -s /lib/ld-linux-armhf.so.3 rootfs/lib/arm-linux-gnueabihf/ld-linux.so.3 cp --preserve=xattr,timestamps tmp/lib/*/libanl-*.so rootfs/lib/libanl.so.1 cp --preserve=xattr,timestamps tmp/lib/*/libBrokenLocale-*.so rootfs/lib/libBrokenLocale.so.1 cp --preserve=xattr,timestamps tmp/lib/*/libc-*.so rootfs/lib/libc.so.6 - cp --preserve=xattr,timestamps tmp/lib/*/libcrypt-*.so rootfs/lib/libcrypt.so.1 cp --preserve=xattr,timestamps tmp/lib/*/libdl-*.so rootfs/lib/libdl.so.2 cp --preserve=xattr,timestamps tmp/lib/*/libm-*.so rootfs/lib/libm.so.6 cp --preserve=xattr,timestamps tmp/lib/*/libmemusage.so rootfs/lib/ @@ -508,7 +490,6 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/lib/*/libnss_dns-*.so rootfs/lib/libnss_dns.so.2 cp --preserve=xattr,timestamps tmp/lib/*/libnss_files-*.so rootfs/lib/libnss_files.so.2 cp --preserve=xattr,timestamps tmp/lib/*/libnss_hesiod-*.so rootfs/lib/libnss_hesiod.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/libnss_nis-*.so rootfs/lib/libnss_nis.so.2 cp --preserve=xattr,timestamps tmp/lib/*/libpcprofile.so rootfs/lib/ cp --preserve=xattr,timestamps tmp/lib/*/libpthread-*.so rootfs/lib/libpthread.so.0 cp --preserve=xattr,timestamps tmp/lib/*/libresolv-*.so rootfs/lib/libresolv.so.2 @@ -524,7 +505,7 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/lib/*/libcom_err.so.2.* rootfs/lib/libcom_err.so.2 # libdb5.3 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libdb-5.3.so rootfs/usr/lib/libdb5.3.so + cp --preserve=xattr,timestamps tmp/usr/lib/*/libdb-5.3.so rootfs/usr/lib/libdb-5.3.so # libdbus-1-3 components cp --preserve=xattr,timestamps tmp/lib/*/libdbus-1.so.3 rootfs/lib/libdbus-1.so.3 @@ -534,14 +515,13 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/usr/lib/*/libelf.so.1 rootfs/usr/lib/libelf.so.1 # libfdisk1 components - cp --no-dereference --preserve=xattr,timestamps tmp/lib/*/libfdisk.so.1.* rootfs/lib/libfdisk.so.1 + cp --no-dereference --preserve=xattr,timestamps tmp/usr/lib/*/libfdisk.so.1.* rootfs/usr/lib/libfdisk.so.1 - # libgcc1 components + # libgcc-s1 components cp --preserve=xattr,timestamps tmp/lib/*/libgcc_s.so.1 rootfs/lib/ - cp --preserve=xattr,timestamps tmp/lib/*/librt.so.1 rootfs/lib/ # libgcrypt20 components - cp --no-dereference --preserve=xattr,timestamps tmp/lib/*/libgcrypt.so.20.* rootfs/lib/libgcrypt.so.20 + cp --no-dereference --preserve=xattr,timestamps tmp/usr/lib/*/libgcrypt.so.20.* rootfs/usr/lib/libgcrypt.so.20 # libgpg-error0 components cp --no-dereference --preserve=xattr,timestamps tmp/lib/*/libgpg-error.so.0.* rootfs/lib/libgpg-error.so.0 @@ -552,20 +532,14 @@ function create_cpio { # liblzma5 components cp --preserve=xattr,timestamps tmp/lib/*/liblzma.so.5.* rootfs/lib/liblzma.so.5 - # liblzo2-2 components - cp --preserve=xattr,timestamps tmp/lib/*/liblzo2.so.2 rootfs/lib/ + # libmd0 components + cp --preserve=xattr,timestamps tmp/usr/lib/*/libmd.so.0.* rootfs/usr/lib/libmd.so.0 # libmount1 components - cp --preserve=xattr,timestamps tmp/lib/*/libmount.so.1.* rootfs/lib/libmount.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libmount.so.1.* rootfs/usr/lib/libmount.so.1 # libmnl0 components - cp --preserve=xattr,timestamps tmp/lib/*/libmnl.so.0.* rootfs/lib/libmnl.so.0 - - # libncurses5 components - cp --preserve=xattr,timestamps tmp/lib/*/libncurses.so.5.* rootfs/lib/libncurses.so.5 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libform.so.5.* rootfs/usr/lib/libform.so.5 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libmenu.so.5.* rootfs/usr/lib/libmenu.so.5 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libpanel.so.5.* rootfs/usr/lib/libpanel.so.5 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libmnl.so.0.* rootfs/usr/lib/libmnl.so.0 # libnl-3-200 components cp --preserve=xattr,timestamps tmp/lib/*/libnl-3.so.200 rootfs/lib/libnl-3.so.200 @@ -576,14 +550,8 @@ function create_cpio { # libnl-route-3-200 components cp --preserve=xattr,timestamps tmp/usr/lib/*/libnl-route-3.so.200.* rootfs/usr/lib/libnl-route-3.so.200 - # libpam0g components - cp --preserve=xattr,timestamps tmp/lib/*/libpam.so.0.* rootfs/lib/libpam.so.0 - cp --preserve=xattr,timestamps tmp/lib/*/libpam_misc.so.0.* rootfs/lib/libpam_misc.so.0 - cp --preserve=xattr,timestamps tmp/lib/*/libpamc.so.0.* rootfs/lib/libpamc.so.0 - - # libpcre3 components - cp --preserve=xattr,timestamps tmp/lib/*/libpcre.so.3.* rootfs/lib/libpcre.so.3 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libpcreposix.so.3.* rootfs/usr/lib/libpcreposix.so.3 + # libpcre2-8-0 components + cp --preserve=xattr,timestamps tmp/usr/lib/*/libpcre2-8.so.0.* rootfs/usr/lib/libpcre2-8.so.0 # libpcsclite components cp --preserve=xattr,timestamps tmp/usr/lib/*/libpcsclite.so.1 rootfs/lib/libpcsclite.so.1 @@ -591,43 +559,33 @@ function create_cpio { # libselinux1 components cp --preserve=xattr,timestamps tmp/lib/*/libselinux.so.1 rootfs/lib/ - # libslang2 components - cp --preserve=xattr,timestamps tmp/lib/*/libslang.so.2.* rootfs/lib/libslang.so.2 - # libsmartcols1 components - cp --preserve=xattr,timestamps tmp/lib/*/libsmartcols.so.1.* rootfs/lib/libsmartcols.so.1 - - # libssl1.0.2 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libcrypto.so.1.0.2 rootfs/usr/lib/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/libssl.so.1.0.2 rootfs/usr/lib/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/lib4758cca.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libaep.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libatalla.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libcapi.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libchil.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libcswift.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libgmp.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libgost.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libnuron.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libpadlock.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libsureware.so rootfs/usr/lib/openssl-1.0.2/engines/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/openssl-1.0.2/engines/libubsec.so rootfs/usr/lib/openssl-1.0.2/engines/ + cp --preserve=xattr,timestamps tmp/usr/lib/*/libsmartcols.so.1.* rootfs/usr/lib/libsmartcols.so.1 + + # libss2 components + cp --preserve=xattr,timestamps tmp/lib/*/libss.so.2.* rootfs/lib/libss.so.2 # libssl1.1 components cp --preserve=xattr,timestamps tmp/usr/lib/*/libcrypto.so.1.1 rootfs/usr/lib/ cp --preserve=xattr,timestamps tmp/usr/lib/*/libssl.so.1.1 rootfs/usr/lib/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/engines-1.1/capi.so rootfs/usr/lib/engines-1.1/ + cp --preserve=xattr,timestamps tmp/usr/lib/*/engines-1.1/afalg.so rootfs/usr/lib/engines-1.1/ cp --preserve=xattr,timestamps tmp/usr/lib/*/engines-1.1/padlock.so rootfs/usr/lib/engines-1.1/ # libsystemd0 components - cp --no-dereference --preserve=xattr,timestamps tmp/lib/*/libsystemd.so* rootfs/lib/ + cp --preserve=xattr,timestamps tmp/usr/lib/*/libsystemd.so.0.* rootfs/usr/lib/libsystemd.so.0 # libtinfo6 components cp --preserve=xattr,timestamps tmp/lib/*/libtinfo.so.6.* rootfs/lib/libtinfo.so.6 cp --preserve=xattr,timestamps tmp/usr/lib/*/libtic.so.6.* rootfs/usr/lib/libtic.so.6 # libuuid1 components - cp --preserve=xattr,timestamps tmp/lib/*/libuuid.so.1.* rootfs/lib/libuuid.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libuuid.so.1.* rootfs/usr/lib/libuuid.so.1 + + # libxtables12 components + cp --preserve=xattr,timestamps tmp/usr/lib/*/libxtables.so.12.* rootfs/usr/lib/libxtables.so.12 + + # libzstd1 components + cp --preserve=xattr,timestamps tmp/usr/lib/*/libzstd.so.1.* rootfs/usr/lib/libzstd.so.1 # zlib1g components cp --preserve=xattr,timestamps tmp/lib/*/libz.so.1 rootfs/lib/ @@ -645,17 +603,11 @@ function create_cpio { # vcgencmd ## libraspberrypi-bin - mkdir -p rootfs/opt/vc/bin - cp --preserve=xattr,timestamps tmp/opt/vc/bin/vcgencmd rootfs/opt/vc/bin/ mkdir -p rootfs/usr/bin - ln -s /opt/vc/bin/vcgencmd rootfs/usr/bin/vcgencmd - cp --preserve=xattr,timestamps tmp/usr/share/doc/libraspberrypi-bin/LICENCE rootfs/opt/vc/ + cp --preserve=xattr,timestamps tmp/usr/bin/vcgencmd rootfs/usr/bin/ ## libraspberrypi0 - mkdir -p rootfs/etc/ld.so.conf.d - cp --preserve=xattr,timestamps tmp/etc/ld.so.conf.d/00-vmcs.conf rootfs/etc/ld.so.conf.d/ - mkdir -p rootfs/opt/vc/lib - cp --preserve=xattr,timestamps tmp/opt/vc/lib/libvcos.so rootfs/opt/vc/lib/ - cp --preserve=xattr,timestamps tmp/opt/vc/lib/libvchiq_arm.so rootfs/opt/vc/lib/ + cp --preserve=xattr,timestamps tmp/usr/lib/*/libvcos.so.0 rootfs/usr/lib/ + cp --preserve=xattr,timestamps tmp/usr/lib/*/libvchiq_arm.so.0 rootfs/usr/lib/ # xxd mkdir -p rootfs/usr/bin @@ -669,34 +621,30 @@ function create_cpio { # curl cp --preserve=xattr,timestamps tmp/usr/bin/curl rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/libcurl.so.4 rootfs/lib/arm-linux-gnueabihf/libcurl.so.4 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libnghttp2.so.14 rootfs/lib/arm-linux-gnueabihf/libnghttp2.so.14 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libidn2.so.0 rootfs/lib/arm-linux-gnueabihf/libidn2.so.0 - cp --preserve=xattr,timestamps tmp/usr/lib/*/librtmp.so.1 rootfs/lib/arm-linux-gnueabihf/librtmp.so.1 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libssh2.so.1 rootfs/lib/arm-linux-gnueabihf/libssh2.so.1 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libpsl.so.5 rootfs/lib/arm-linux-gnueabihf/libpsl.so.5 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libgssapi_krb5.so.2 rootfs/lib/arm-linux-gnueabihf/libgssapi_krb5.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libkrb5.so.3 rootfs/lib/arm-linux-gnueabihf/libkrb5.so.3 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libk5crypto.so.3 rootfs/lib/arm-linux-gnueabihf/libk5crypto.so.3 - cp --preserve=xattr,timestamps tmp/usr/lib/*/liblber-2.4.so.2 rootfs/lib/arm-linux-gnueabihf/liblber-2.4.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libldap_r-2.4.so.2 rootfs/lib/arm-linux-gnueabihf/libldap_r-2.4.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libunistring.so.2.* rootfs/lib/arm-linux-gnueabihf/libunistring.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libgnutls.so.30 rootfs/lib/arm-linux-gnueabihf/libgnutls.so.30 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libhogweed.so.4 rootfs/lib/arm-linux-gnueabihf/libhogweed.so.4 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libnettle.so.6 rootfs/lib/arm-linux-gnueabihf/libnettle.so.6 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libgmp.so.10 rootfs/lib/arm-linux-gnueabihf/libgmp.so.10 - cp --preserve=xattr,timestamps tmp/lib/*/libgcrypt.so.20 rootfs/lib/arm-linux-gnueabihf/libgcrypt.so.20 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libkrb5support.so.0 rootfs/lib/arm-linux-gnueabihf/libkrb5support.so.0 - cp --preserve=xattr,timestamps tmp/lib/*/libkeyutils.so.1 rootfs/lib/arm-linux-gnueabihf/libkeyutils.so.1 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libsasl2.so.2 rootfs/lib/arm-linux-gnueabihf/libsasl2.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libp11-kit.so.0 rootfs/lib/arm-linux-gnueabihf/libp11-kit.so.0 - cp --preserve=xattr,timestamps tmp/lib/*/libidn.so.11 rootfs/lib/arm-linux-gnueabihf/libidn.so.11 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libtasn1.so.6 rootfs/lib/arm-linux-gnueabihf/libtasn1.so.6 - cp --preserve=xattr,timestamps tmp/lib/*/libgpg-error.so.0 rootfs/lib/arm-linux-gnueabihf/libgpg-error.so.0 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libffi.so.6 rootfs/lib/arm-linux-gnueabihf/libffi.so.6 - - # libudev - cp --preserve=xattr,timestamps tmp/lib/*/libudev.so.1 rootfs/lib/arm-linux-gnueabihf/libudev.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libcurl.so.4 rootfs/usr/lib/libcurl.so.4 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libnghttp2.so.14 rootfs/usr/lib/libnghttp2.so.14 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libidn2.so.0 rootfs/usr/lib/libidn2.so.0 + cp --preserve=xattr,timestamps tmp/usr/lib/*/librtmp.so.1 rootfs/usr/lib/librtmp.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libssh2.so.1 rootfs/usr/lib/libssh2.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libpsl.so.5 rootfs/usr/lib/libpsl.so.5 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libgssapi_krb5.so.2 rootfs/usr/lib/libgssapi_krb5.so.2 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libkrb5.so.3 rootfs/usr/lib/libkrb5.so.3 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libk5crypto.so.3 rootfs/usr/lib/libk5crypto.so.3 + cp --preserve=xattr,timestamps tmp/usr/lib/*/liblber-2.4.so.2 rootfs/usr/lib/liblber-2.4.so.2 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libldap_r-2.4.so.2 rootfs/usr/lib/libldap_r-2.4.so.2 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libunistring.so.2.* rootfs/usr/lib/libunistring.so.2 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libgnutls.so.30 rootfs/usr/lib/libgnutls.so.30 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libhogweed.so.6 rootfs/usr/lib/libhogweed.so.6 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libnettle.so.8 rootfs/usr/lib/libnettle.so.8 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libgmp.so.10 rootfs/usr/lib/libgmp.so.10 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libkrb5support.so.0 rootfs/usr/lib/libkrb5support.so.0 + cp --preserve=xattr,timestamps tmp/lib/*/libkeyutils.so.1 rootfs/usr/lib/libkeyutils.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libsasl2.so.2 rootfs/usr/lib/libsasl2.so.2 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libp11-kit.so.0 rootfs/usr/lib/libp11-kit.so.0 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libtasn1.so.6 rootfs/usr/lib/libtasn1.so.6 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libffi.so.7 rootfs/usr/lib/libffi.so.7 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libbrotlidec.so.1 rootfs/usr/lib/libbrotlidec.so.1 + cp --preserve=xattr,timestamps tmp/usr/lib/*/libbrotlicommon.so.1 rootfs/usr/lib/libbrotlicommon.so.1 INITRAMFS="../raspberrypi-ua-netinst.cpio.gz" (cd rootfs && find . | cpio -H newc -ov | gzip --best > $INITRAMFS) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 9050ee6d..4164099a 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -141,7 +141,7 @@ variables_set_defaults() { # set config defaults variable_set "preset" "server" variable_set "mirror" "http://mirrordirector.raspbian.org/raspbian/" - variable_set "release" "buster" + variable_set "release" "bullseye" variable_set "hostname" "pi" variable_set "rootpw" "raspbian" variable_set "root_ssh_pwlogin" "1" @@ -1172,7 +1172,7 @@ fi # determine available releases mirror_base=http://archive.raspberrypi.org/debian/dists/ -release_fallback=buster +release_fallback=bullseye release_base="${release}" release_raspbian="${release}" if ! wget --spider "${mirror_base}/${release}/" &> /dev/null; then diff --git a/update.sh b/update.sh index 2625a6b5..3a1b32b6 100755 --- a/update.sh +++ b/update.sh @@ -16,7 +16,7 @@ mirror_raspbian=http://mirrordirector.raspbian.org/raspbian mirror_raspberrypi=http://archive.raspberrypi.org/debian declare mirror_raspbian_cache declare mirror_raspberrypi_cache -release=buster +release=bullseye packages=() @@ -25,7 +25,6 @@ packages+=("raspberrypi-bootloader") packages+=("raspberrypi-kernel") packages+=("firmware-brcm80211") packages+=("btrfs-progs") -packages+=("libbtrfs0") packages+=("busybox") packages+=("bash-static") packages+=("cdebootstrap-static") @@ -44,7 +43,7 @@ packages+=("netbase") packages+=("netcat-openbsd") packages+=("ntpdate") packages+=("raspbian-archive-keyring") -packages+=("rng-tools") +packages+=("rng-tools5") packages+=("tar") packages+=("fdisk") packages+=("util-linux") @@ -52,14 +51,14 @@ packages+=("wpasupplicant") packages+=("libraspberrypi-bin") packages+=("xxd") packages+=("curl") +packages+=("logsave") # libraries packages+=("libacl1") -packages+=("libatm1") packages+=("libattr1") -packages+=("libaudit-common") -packages+=("libaudit1") packages+=("libblkid1") +packages+=("libbpf0") +packages+=("libbrotli1") packages+=("libbsd0") packages+=("libbz2-1.0") packages+=("libc-bin") @@ -70,17 +69,15 @@ packages+=("libcurl4") packages+=("libdb5.3") packages+=("libdbus-1-3") packages+=("libelf1") -packages+=("libf2fs5") packages+=("libfdisk1") -packages+=("libffi6") -packages+=("libgcc1") +packages+=("libffi7") +packages+=("libgcc-s1") packages+=("libgcrypt20") packages+=("libgmp10") packages+=("libgnutls30") packages+=("libgpg-error0") packages+=("libgssapi-krb5-2") -packages+=("libhogweed4") -packages+=("libidn11") +packages+=("libhogweed6") packages+=("libidn2-0") packages+=("libk5crypto3") packages+=("libkeyutils1") @@ -89,17 +86,15 @@ packages+=("libkrb5support0") packages+=("libldap-2.4-2") packages+=("liblz4-1") packages+=("liblzma5") -packages+=("liblzo2-2") +packages+=("libmd0") packages+=("libmount1") packages+=("libmnl0") -packages+=("libncurses5") -packages+=("libnettle6") +packages+=("libnettle8") packages+=("libnghttp2-14") packages+=("libnl-3-200") packages+=("libnl-genl-3-200") packages+=("libnl-route-3-200") -packages+=("libpam0g") -packages+=("libpcre3") +packages+=("libpcre2-8-0") packages+=("libpcsclite1") packages+=("libp11-kit0") packages+=("libpsl5") @@ -107,17 +102,17 @@ packages+=("libraspberrypi0") packages+=("librtmp1") packages+=("libsasl2-2") packages+=("libselinux1") -packages+=("libslang2") packages+=("libsmartcols1") +packages+=("libss2") packages+=("libssh2-1") packages+=("libssl1.1") -packages+=("libssl1.0.2") packages+=("libsystemd0") packages+=("libtasn1-6") packages+=("libtinfo6") -packages+=("libudev1") packages+=("libunistring2") packages+=("libuuid1") +packages+=("libxtables12") +packages+=("libzstd1") packages+=("zlib1g") From c2def44905bfd243b8b589b638d9908a26bbf7c7 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 8 Mar 2023 13:56:24 +0100 Subject: [PATCH 29/49] installer: update model detection database --- scripts/opt/raspberrypi-ua-netinst/install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 4164099a..e9514937 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -687,9 +687,19 @@ case "${rpi_hardware}" in "a32082") rpi_hardware_version="3 Model B" ;; "a020d3") rpi_hardware_version="3 Model B+" ;; "9020e0") rpi_hardware_version="3 Model A+" ;; + "a02100") rpi_hardware_version="Compute Module 3+" ;; "a03111") rpi_hardware_version="4 Model B" ;; "b03111") rpi_hardware_version="4 Model B" ;; + "b03112") rpi_hardware_version="4 Model B" ;; + "b03114") rpi_hardware_version="4 Model B" ;; + "b03115") rpi_hardware_version="4 Model B" ;; "c03111") rpi_hardware_version="4 Model B" ;; + "c03112") rpi_hardware_version="4 Model B" ;; + "c03114") rpi_hardware_version="4 Model B" ;; + "c03115") rpi_hardware_version="4 Model B" ;; + "d03114") rpi_hardware_version="4 Model B" ;; + "d03115") rpi_hardware_version="4 Model B" ;; + "902120") rpi_hardware_version="Zero 2 W" ;; *) rpi_hardware_version="unknown (${rpi_hardware})" ;; esac From 34b7b05a1d9f1b32b5f9d363f9bf0eff2df9107c Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Thu, 9 Mar 2023 15:04:34 +0100 Subject: [PATCH 30/49] installer: drop to shell instead of halting when reaching maximum number of retries --- scripts/opt/raspberrypi-ua-netinst/install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index e9514937..8e176b52 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -285,10 +285,11 @@ fail() { echo " The maximum number of retries is reached!" echo " Check the logfiles for errors. Then delete or edit \"installer-retries.txt\" in installer folder to (re)set the counter." fi - echo " The system is stopped to prevent an infinite loop." + echo " Dropping to shell to prevent an infinite loop." while true; do led_sos - done + done & + exit else echo " ${installer_retries} retries left." fi From ce32d2e895fea4146d58b37055e39cf4f6ff805b Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Thu, 9 Mar 2023 16:37:54 +0100 Subject: [PATCH 31/49] Add support for 64-bit arm64 architecture. The installer userspace remains 32-bit. 64-bit kernel is booted on 64-bit CPUs so it can run 64-bit binaries when installing an arm64 system. 32-bit system comes from Raspbian while 64-bit comes from Debian, so there are two default mirrors now, depending on arch. This also means that Debian keys must be included in the installer. The sources.list file of the installed system must reflect this too so remove the static one and generate it during install (using the current mirror). --- build.sh | 5 +- doc/INSTALL_CUSTOM.md | 7 +- res/initramfs/etc/apt/sources.list | 1 - scripts/opt/raspberrypi-ua-netinst/install.sh | 33 +++++++-- update.sh | 74 +++++++++++++++++++ 5 files changed, 108 insertions(+), 12 deletions(-) delete mode 100644 res/initramfs/etc/apt/sources.list diff --git a/build.sh b/build.sh index c90d6f99..d6360430 100755 --- a/build.sh +++ b/build.sh @@ -411,8 +411,8 @@ function create_cpio { # raspberrypi.org GPG key cp --preserve=xattr,timestamps ../"${packages_dir}"/raspberrypi.gpg.key rootfs/usr/share/keyrings/ - # raspbian-archive-keyring components - cp --preserve=xattr,timestamps tmp/usr/share/keyrings/raspbian-archive-keyring.gpg rootfs/usr/share/keyrings/ + # *-archive-keyring components + cp --preserve=xattr,timestamps tmp/usr/share/keyrings/*.gpg rootfs/usr/share/keyrings/ # rng-tools5 components cp --preserve=xattr,timestamps tmp/usr/bin/rngtest rootfs/usr/bin/ @@ -690,6 +690,7 @@ mv raspberrypi-ua-netinst.cpio.gz bootfs/raspberrypi-ua-netinst/initramfs.gz { echo "[all]" + echo "arm_64bit=1" echo "os_prefix=raspberrypi-ua-netinst/" echo "initramfs initramfs.gz" echo "gpu_mem=16" diff --git a/doc/INSTALL_CUSTOM.md b/doc/INSTALL_CUSTOM.md index 824cd870..f5d1bd46 100644 --- a/doc/INSTALL_CUSTOM.md +++ b/doc/INSTALL_CUSTOM.md @@ -17,9 +17,10 @@ | `preset` | `server` | `base`/ `minimal`/ `server` | The current packages that are installed by default are listed below. | | `packages` | | | Install these additional packages (comma separated and quoted). (e.g. "pi-bluetooth,cifs-utils,curl") | | `firmware_packages` | `0` | `0`/`1` | Set to "1" to install common firmware packages (Atheros, Broadcom, Libertas, Ralink and Realtek). | -| `mirror` | `http:// mirrordirector.raspbian.org/ raspbian/` | | | +| `mirror` | `http:// mirrordirector.raspbian.org/ raspbian/` or `http:// deb.debian.org/ debian/` | | default value depends on arch | | `mirror_cache` | | | Set address and port for HTTP apt-cacher or apt-cacher-ng (e.g. "192.168.0.1:3142"). If set, the cacher will be used to cache packages during installation downloaded from the repository set in `mirror` as well as "http://archive.raspberrypi.org/debian". | | `release` | `buster` | | Raspbian release name | +| `arch` | `armhf` | | Raspbian architecture: "armhf" = 32-bit (all Raspberry models), "arm64" = 64-bit (only for Model 3 and up, Zero 2) | ### Description: Presets @@ -29,7 +30,7 @@ |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `base` | _\,apt,gnupg,kmod_ | | `minimal` | _\,cpufrequtils,fake-hwclock,ifupdown,net-tools,ntp,openssh-server,dosfstools,raspberrypi-sys-mods_ | -| `server` | _\,systemd-sysv,vim-tiny,iputils-ping,wget,ca-certificates,rsyslog,cron,dialog,locales,tzdata,less,man-db,logrotate,bash-completion,console-setup,apt-utils,libraspberrypi-bin,raspi-copies-and-fills_ | +| `server` | _\,systemd-sysv,vim-tiny,iputils-ping,wget,ca-certificates,rsyslog,cron,dialog,locales,tzdata,less,man-db,logrotate,bash-completion,console-setup,apt-utils,libraspberrypi-bin,raspi-copies-and-fills (raspi-copies-and-fills is not available on arm64)_ | Note that if the networking configuration is set to use DHCP, `isc-dhcp-client` will also be installed. @@ -39,7 +40,7 @@ Note that if the networking configuration is set to use DHCP, `isc-dhcp-client` |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `base` | _\,apt,kmod_ | | `minimal` | _\,cpufrequtils,iproute2,openssh-server,dosfstools,raspberrypi-sys-mods_ | -| `server` | _\,systemd-sysv,vim-tiny,iputils-ping,wget,ca-certificates,rsyslog,cron,dialog,locales,tzdata,less,man-db,logrotate,bash-completion,console-setup,apt-utils,libraspberrypi-bin,raspi-copies-and-fills_ | +| `server` | _\,systemd-sysv,vim-tiny,iputils-ping,wget,ca-certificates,rsyslog,cron,dialog,locales,tzdata,less,man-db,logrotate,bash-completion,console-setup,apt-utils,libraspberrypi-bin,raspi-copies-and-fills (raspi-copies-and-fills is not available on arm64)_ | Note that if the networking configuration is set to use DHCP, no additional packages will be installed as `systemd-networkd` provides DHCP client support. diff --git a/res/initramfs/etc/apt/sources.list b/res/initramfs/etc/apt/sources.list deleted file mode 100644 index 6ddf7d27..00000000 --- a/res/initramfs/etc/apt/sources.list +++ /dev/null @@ -1 +0,0 @@ -deb http://mirrordirector.raspbian.org/raspbian __RELEASE__ main contrib non-free firmware diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 8e176b52..a67f113e 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -23,6 +23,7 @@ variables_reset() { mirror= mirror_cache= release= + arch= hostname= boot_volume_label= root_volume_label= @@ -140,7 +141,12 @@ variables_set_defaults() { # set config defaults variable_set "preset" "server" - variable_set "mirror" "http://mirrordirector.raspbian.org/raspbian/" + variable_set "arch" "armhf" + if [ "${arch}" = "arm64" ]; then + variable_set "mirror" "http://deb.debian.org/debian/" + else + variable_set "mirror" "http://mirrordirector.raspbian.org/raspbian/" + fi variable_set "release" "bullseye" variable_set "hostname" "pi" variable_set "rootpw" "raspbian" @@ -1269,7 +1275,10 @@ if [ -z "${cdebootstrap_cmdline}" ]; then server_packages="${server_packages},systemd-sysv" fi server_packages_postinstall="${minimal_packages_postinstall},${server_packages_postinstall}" - server_packages_postinstall="${server_packages_postinstall},libraspberrypi-bin,raspi-copies-and-fills" + server_packages_postinstall="${server_packages_postinstall},libraspberrypi-bin" + if [ "${arch}" != "arm64" ]; then + server_packages_postinstall="${server_packages_postinstall},raspi-copies-and-fills" + fi # cleanup package variables used by cdebootstrap_cmdline variable_sanitize base_packages @@ -1370,6 +1379,7 @@ echo " firmware_packages = ${firmware_packages}" echo " mirror = ${mirror}" echo " mirror_cache = ${mirror_cache}" echo " release = ${release_raspbian}" +echo " arch = ${arch}" echo " hostname = ${hostname}" echo " domainname = ${domainname}" echo " rootpw = ${rootpw}" @@ -1643,7 +1653,12 @@ for i in $(seq 1 "${installer_pkg_downloadretries}"); do if [ -n "${mirror_cache}" ]; then export http_proxy="http://${mirror_cache}/" fi - eval cdebootstrap-static --arch=armhf "${cdebootstrap_cmdline}" "${release_raspbian}" /rootfs "${mirror}" --keyring=/usr/share/keyrings/raspbian-archive-keyring.gpg 2>&1 | output_filter + if [ "${arch}" = "arm64" ]; then + keyring="debian-archive-keyring.gpg" + else + keyring="raspbian-archive-keyring.gpg" + fi + eval cdebootstrap-static --arch="${arch}" "${cdebootstrap_cmdline}" "${release_raspbian}" /rootfs "${mirror}" --keyring=/usr/share/keyrings/${keyring} 2>&1 | output_filter cdebootstrap_exitcode="${PIPESTATUS[0]}" if [ "${cdebootstrap_exitcode}" -eq 0 ]; then unset http_proxy @@ -2096,15 +2111,21 @@ fi # copy apt's sources.list to the target system echo "Configuring apt:" -echo -n " Configuring Raspbian repository... " +echo -n " Configuring Raspbian/Debian repository... " if [ -e "/rootfs/boot/raspberrypi-ua-netinst/config/apt/sources.list" ]; then sed "s/__RELEASE__/${release_raspbian}/g" "/rootfs/boot/raspberrypi-ua-netinst/config/apt/sources.list" > "/rootfs/etc/apt/sources.list" || fail else - sed "s/__RELEASE__/${release_raspbian}/g" "/opt/raspberrypi-ua-netinst/res/etc/apt/sources.list" > "/rootfs/etc/apt/sources.list" || fail + if [ "${arch}" = "arm64" ]; then + echo "deb ${mirror} ${release_raspbian} main contrib non-free" > "/rootfs/etc/apt/sources.list" || fail + echo "deb http://security.debian.org/debian-security ${release_raspbian}-security main contrib non-free" >> "/rootfs/etc/apt/sources.list" || fail + echo "deb ${mirror} ${release_raspbian}-updates main contrib non-free" >> "/rootfs/etc/apt/sources.list" || fail + else + echo "deb ${mirror} ${release_raspbian} main contrib non-free firmware" > "/rootfs/etc/apt/sources.list" || fail + fi fi echo "OK" # if __RELEASE__ is still present, something went wrong -echo -n " Checking Raspbian repository entry... " +echo -n " Checking Raspbian/Debian repository entry... " if grep -l '__RELEASE__' /rootfs/etc/apt/sources.list > /dev/null; then fail else diff --git a/update.sh b/update.sh index 3a1b32b6..b4fdaf5a 100755 --- a/update.sh +++ b/update.sh @@ -12,10 +12,27 @@ RASPBERRYPI_ARCHIVE_KEY_FILE_NAME="raspberrypi.gpg.key" RASPBERRYPI_ARCHIVE_KEY_URL="${RASPBERRYPI_ARCHIVE_KEY_DIRECTORY}/${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}" RASPBERRYPI_ARCHIVE_KEY_FINGERPRINT="CF8A1AF502A2AA2D763BAE7E82B129927FA3303E" +DEBIAN_ARCHIVE10_KEY_DIRECTORY="https://ftp-master.debian.org/keys" +DEBIAN_ARCHIVE10_KEY_FILE_NAME="archive-key-10.asc" +DEBIAN_ARCHIVE10_KEY_URL="${DEBIAN_ARCHIVE10_KEY_DIRECTORY}/${DEBIAN_ARCHIVE10_KEY_FILE_NAME}" +DEBIAN_ARCHIVE10_KEY_FINGERPRINT="80D15823B7FD1561F9F7BCDDDC30D7C23CBBABEE" + +DEBIAN_ARCHIVE_KEY_DIRECTORY="https://ftp-master.debian.org/keys" +DEBIAN_ARCHIVE_KEY_FILE_NAME="archive-key-11.asc" +DEBIAN_ARCHIVE_KEY_URL="${DEBIAN_ARCHIVE_KEY_DIRECTORY}/${DEBIAN_ARCHIVE_KEY_FILE_NAME}" +DEBIAN_ARCHIVE_KEY_FINGERPRINT="1F89983E0081FDE018F3CC9673A4F27B8DD47936" + +DEBIAN_RELEASE_KEY_DIRECTORY="https://ftp-master.debian.org/keys" +DEBIAN_RELEASE_KEY_FILE_NAME="release-11.asc" +DEBIAN_RELEASE_KEY_URL="${DEBIAN_RELEASE_KEY_DIRECTORY}/${DEBIAN_RELEASE_KEY_FILE_NAME}" +DEBIAN_RELEASE_KEY_FINGERPRINT="A4285295FC7B1A81600062A9605C66F00D6C9793" + mirror_raspbian=http://mirrordirector.raspbian.org/raspbian mirror_raspberrypi=http://archive.raspberrypi.org/debian +mirror_debian=http://deb.debian.org/debian declare mirror_raspbian_cache declare mirror_raspberrypi_cache +declare mirror_debian_cache release=bullseye packages=() @@ -43,6 +60,7 @@ packages+=("netbase") packages+=("netcat-openbsd") packages+=("ntpdate") packages+=("raspbian-archive-keyring") +packages+=("debian-archive-keyring") packages+=("rng-tools5") packages+=("tar") packages+=("fdisk") @@ -235,6 +253,57 @@ setup_archive_keys() { return 1 fi + echo "" + + echo "Downloading ${DEBIAN_ARCHIVE10_KEY_FILE_NAME}." + download_file ${DEBIAN_ARCHIVE10_KEY_URL} + if check_key "${DEBIAN_ARCHIVE10_KEY_FILE_NAME}" "${DEBIAN_ARCHIVE10_KEY_FINGERPRINT}"; then + # GPG key checks out, thus import it into our own keyring + echo -n "Importing '${DEBIAN_ARCHIVE10_KEY_FILE_NAME}' into keyring... " + if gpg -q --homedir gnupg --import "${DEBIAN_ARCHIVE10_KEY_FILE_NAME}"; then + echo "OK" + else + echo "FAILED!" + return 1 + fi + else + return 1 + fi + + echo "" + + echo "Downloading ${DEBIAN_ARCHIVE_KEY_FILE_NAME}." + download_file ${DEBIAN_ARCHIVE_KEY_URL} + if check_key "${DEBIAN_ARCHIVE_KEY_FILE_NAME}" "${DEBIAN_ARCHIVE_KEY_FINGERPRINT}"; then + # GPG key checks out, thus import it into our own keyring + echo -n "Importing '${DEBIAN_ARCHIVE_KEY_FILE_NAME}' into keyring... " + if gpg -q --homedir gnupg --import "${DEBIAN_ARCHIVE_KEY_FILE_NAME}"; then + echo "OK" + else + echo "FAILED!" + return 1 + fi + else + return 1 + fi + + echo "" + + echo "Downloading ${DEBIAN_RELEASE_KEY_FILE_NAME}." + download_file ${DEBIAN_RELEASE_KEY_URL} + if check_key "${DEBIAN_RELEASE_KEY_FILE_NAME}" "${DEBIAN_RELEASE_KEY_FINGERPRINT}"; then + # GPG key checks out, thus import it into our own keyring + echo -n "Importing '${DEBIAN_RELEASE_KEY_FILE_NAME}' into keyring... " + if gpg -q --homedir gnupg --import "${DEBIAN_RELEASE_KEY_FILE_NAME}"; then + echo "OK" + else + echo "FAILED!" + return 1 + fi + else + return 1 + fi + return 0 } @@ -420,10 +489,14 @@ fi if [ -n "${mirror_raspberrypi_cache}" ]; then mirror_raspberrypi=${mirror_raspberrypi/:\/\//:\/\/${mirror_raspberrypi_cache}\/} fi + if [ -n "${mirror_debian_cache}" ]; then + mirror_debian=${mirror_debian/:\/\//:\/\/${mirror_debian_cache}\/} + fi ## Download package list download_package_lists raspberry ${mirror_raspberrypi} download_package_lists raspbian ${mirror_raspbian} + download_package_lists debian ${mirror_debian} ## Select packages for download packages_debs=() @@ -431,6 +504,7 @@ fi add_packages raspberry ${mirror_raspberrypi} add_packages raspbian ${mirror_raspbian} + add_packages debian ${mirror_debian} if ! allfound; then echo "ERROR: Unable to find all required packages in package list!" echo "Missing packages: '${packages[*]}'" From 24d12d1d8f03142a470d2f65a13b2573b7f68ac9 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 21 Mar 2023 10:04:16 +0100 Subject: [PATCH 32/49] clean up kernel command line parameters dwc_otg.lpm_enable is zero by default and elevator is obsolete. Remove them from cmdline.txt --- build.sh | 2 +- doc/INSTALL_CUSTOM.md | 2 +- scripts/opt/raspberrypi-ua-netinst/install.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index d6360430..1142da7b 100755 --- a/build.sh +++ b/build.sh @@ -702,7 +702,7 @@ mv raspberrypi-ua-netinst.cpio.gz bootfs/raspberrypi-ua-netinst/initramfs.gz cp bootfs/raspberrypi-ua-netinst/config.txt bootfs/config.txt -echo "dwc_otg.lpm_enable=0 consoleblank=0 console=serial0,115200 console=tty1 elevator=deadline rootwait" > bootfs/raspberrypi-ua-netinst/cmdline.txt +echo "consoleblank=0 console=serial0,115200 console=tty1 rootwait" > bootfs/raspberrypi-ua-netinst/cmdline.txt if [ ! -f bootfs/TIMEOUT ] ; then touch bootfs/TIMEOUT diff --git a/doc/INSTALL_CUSTOM.md b/doc/INSTALL_CUSTOM.md index f5d1bd46..b71b1734 100644 --- a/doc/INSTALL_CUSTOM.md +++ b/doc/INSTALL_CUSTOM.md @@ -140,7 +140,7 @@ Note that if the networking configuration is set to use DHCP, no additional pack | `disable_splash` | `0` | `0`/`1` | Disables the rainbow splash screen on boot. | | `cleanup` | `0` | `0`/`1` | Remove installer files after success. To also remove log files, note the option below. | | `cleanup_logfiles` | `0` | `0`/`1` | Removes installer log files after success. | -| `cmdline` | `"dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 elevator=deadline fsck.repair=yes"` | | | +| `cmdline` | `"console=serial0,115200 console=tty1 fsck.repair=yes"` | | | | `final_action` | `reboot` | `reboot`/ `poweroff`/ `halt`/ `console` | Action at the end of install. | | `installer_telnet` | `listen` | `none`/`connect`/`listen` | Connect to, or listen for, a telnet connection to send installer console output. | | `installer_telnet_host` | | | Host name or address to use when `installer_telnet` is set to `connect`. | diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index a67f113e..b2e663d4 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -167,7 +167,7 @@ variables_set_defaults() { variable_set "hdmi_system_only" "0" variable_set "usbroot" "0" variable_set "usbboot" "0" - variable_set "cmdline" "dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 elevator=deadline fsck.repair=yes" + variable_set "cmdline" "console=serial0,115200 console=tty1 fsck.repair=yes" variable_set "rootfstype" "f2fs" variable_set "final_action" "reboot" variable_set "installer_telnet" "listen" From 7031c04fc37322b318ab5a7834d8eb3629148d5e Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 21 Mar 2023 12:45:14 +0100 Subject: [PATCH 33/49] installer: update predictable network interface names disabling method raspi-config does not use net.ifnames=0 kernel command line parameter or persistent-net-generator.rules anymore. It masks 99-default.link and 73-usb-net-by-mac.link udev files instead. --- scripts/opt/raspberrypi-ua-netinst/install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index b2e663d4..2e10896e 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1961,12 +1961,12 @@ if [ "${use_systemd_services}" != "0" ]; then echo "OK" fi -# Customize cmdline.txt if predictable network interface names are not desired +# Mask udev link files if predictable network interface names are not desired if [ "${disable_predictable_nin}" = "1" ]; then # as described here: https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames - # adding net.ifnames=0 to /boot/cmdline and disabling the persistent-net-generator.rules - line_add cmdline_custom "net.ifnames=0" - ln -s /dev/null /rootfs/etc/udev/rules.d/75-persistent-net-generator.rules + # masking 99-default.link and also 73-usb-net-by-mac.link (as raspi-config does) + ln -s /dev/null /rootfs/etc/systemd/network/99-default.link + ln -s /dev/null /rootfs/etc/systemd/network/73-usb-net-by-mac.link fi # set timezone and reconfigure tzdata package From 114f9542bd7872424842428e006adf3c8b1aac82 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 21 Mar 2023 13:58:21 +0100 Subject: [PATCH 34/49] installer: use PARTUUID for boot and root partitions Use PARTUUID instead of device names for boot and root partitions in /etc/fstab and cmdline.txt --- scripts/opt/raspberrypi-ua-netinst/install.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 2e10896e..eb160450 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1810,17 +1810,20 @@ if [ -n "${username}" ]; then fi fi +bootpartition_uuid=PARTUUID=$(blkid -o value -s PARTUUID ${bootpartition}) +rootpartition_uuid=PARTUUID=$(blkid -o value -s PARTUUID ${rootpartition}) + # default mounts echo -n " Configuring /etc/fstab... " touch /rootfs/etc/fstab || fail { - echo "${bootpartition} /boot vfat defaults 0 2" + echo "${bootpartition_uuid} /boot vfat defaults 0 2" if [ "${rootfstype}" = "f2fs" ]; then - echo "${rootpartition} / ${rootfstype} ${rootfs_mount_options} 0 0" + echo "${rootpartition_uuid} / ${rootfstype} ${rootfs_mount_options} 0 0" elif [ "${rootfstype}" = "btrfs" ]; then - echo "${rootpartition} / ${rootfstype} ${rootfs_mount_options} 0 0" + echo "${rootpartition_uuid} / ${rootfstype} ${rootfs_mount_options} 0 0" else - echo "${rootpartition} / ${rootfstype} ${rootfs_mount_options} 0 1" + echo "${rootpartition_uuid} / ${rootfstype} ${rootfs_mount_options} 0 1" fi # also specify /tmp on tmpfs in /etc/fstab so it works across init systems echo "tmpfs /tmp tmpfs defaults,nodev,nosuid 0 0" @@ -2293,7 +2296,7 @@ echo "OK" # create cmdline.txt echo -n "Creating cmdline.txt... " -line_add cmdline "root=${rootpartition} rootfstype=${rootfstype} rootwait" +line_add cmdline "root=${rootpartition_uuid} rootfstype=${rootfstype} rootwait" line_add_if_boolean quiet_boot cmdline_custom "quiet" "loglevel=3" line_add_if_boolean disable_raspberries cmdline_custom "logo.nologo" line_add_if_set console_blank cmdline_custom "consoleblank=${console_blank}" From 20558729f8cba1a52ca5475117e1b8a88c0d9f66 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 21 Mar 2023 14:15:46 +0100 Subject: [PATCH 35/49] build: Use recent config.txt The raspbian boot.tar.xz contains outdated config.txt. Change directory in download URL to raspios_armhf. --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index b4fdaf5a..1bce7919 100755 --- a/update.sh +++ b/update.sh @@ -522,7 +522,7 @@ fi ## Download default /boot/config.txt and do default changes mkdir -p initramfs/boot cd initramfs/boot || exit 1 - download_remote_file https://downloads.raspberrypi.org/raspbian/ "boot.tar.xz" xzcat ./config.txt + download_remote_file https://downloads.raspberrypi.org/raspios_armhf/ "boot.tar.xz" xzcat ./config.txt sed -i "s/^\(dtparam=audio=on\)/#\1/" config.txt # disable audio { echo "" From 99b5efd77a170ad05940388f115b9e79242cf083 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 21 Mar 2023 16:12:17 +0100 Subject: [PATCH 36/49] installer: install console-setup, keyboard-configuration or tzdata early When using base or minimal presets and including keyboard-configuration (or console-setup which depends on it) or tzdata packages manually, the initial configuration of keyboard layout and timezone will fail. Install these packages early using cdebootstrap to fix the configuration. --- scripts/opt/raspberrypi-ua-netinst/install.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index eb160450..a8daad1a 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1280,6 +1280,21 @@ if [ -z "${cdebootstrap_cmdline}" ]; then server_packages_postinstall="${server_packages_postinstall},raspi-copies-and-fills" fi + # if using base or minimal preset and custom packages include console-setup, keyboard-configuration or tzdata, + # install them early using cdebootstrap or the initial configuration of keyboard layout or timezone will fail + if echo "${packages}" | grep -q "console-setup"; then + base_packages="${base_packages},console-setup" + minimal_packages="${minimal_packages},console-setup" + fi + if echo "${packages}" | grep -q "keyboard-configuration"; then + base_packages="${base_packages},keyboard-configuration" + minimal_packages="${minimal_packages},keyboard-configuration" + fi + if echo "${packages}" | grep -q "tzdata"; then + base_packages="${base_packages},tzdata" + minimal_packages="${minimal_packages},tzdata" + fi + # cleanup package variables used by cdebootstrap_cmdline variable_sanitize base_packages variable_sanitize minimal_packages From c9fe4dd018e1a9adaa4ecd52d24e70a23b55fb44 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Mon, 19 Jun 2023 10:59:51 +0200 Subject: [PATCH 37/49] build: don't force 64-bit mode for all models arm_64bit=1 in boot.txt fails on 32-bit CPUs (I expected the firmware on 32-bit models to ignore it but it just fails to boot instead). Enable it on 64-bit models only - pi3, pi4, pi02 (Zero 2 W) and 2B rev 1.2 (board IDs a02042 and a22042). --- build.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1142da7b..673d6845 100755 --- a/build.sh +++ b/build.sh @@ -690,14 +690,21 @@ mv raspberrypi-ua-netinst.cpio.gz bootfs/raspberrypi-ua-netinst/initramfs.gz { echo "[all]" - echo "arm_64bit=1" echo "os_prefix=raspberrypi-ua-netinst/" echo "initramfs initramfs.gz" echo "gpu_mem=16" echo "[pi3]" echo "dtoverlay=disable-bt" + echo "arm_64bit=1" echo "[pi4]" echo "dtoverlay=disable-bt" + echo "arm_64bit=1" + echo "[pi02]" + echo "arm_64bit=1" + echo "[board-type=a02042]" + echo "arm_64bit=1" + echo "[board-type=a22042]" + echo "arm_64bit=1" } >> bootfs/raspberrypi-ua-netinst/config.txt cp bootfs/raspberrypi-ua-netinst/config.txt bootfs/config.txt From 982a4f323b528a22a061f0c7f8f60ebfd04bf50e Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 20 Jun 2023 12:53:32 +0200 Subject: [PATCH 38/49] build: optimize package list parsing Adding packages can be very slow because of extreme bash overhead when reading large files. Use a temporary filtered file and grep it for each package instead. before: $ time ./update.sh real 16m22.086s user 5m23.705s sys 7m14.264s after: $ time ./update.sh real 2m37.367s user 0m46.084s sys 0m42.517s --- update.sh | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/update.sh b/update.sh index 1bce7919..880fb491 100755 --- a/update.sh +++ b/update.sh @@ -308,13 +308,6 @@ setup_archive_keys() { } -required() { - for i in "${packages[@]}"; do - [[ $i = "${1}" ]] && return 0 - done - return 1 -} - unset_required() { for i in "${!packages[@]}"; do [[ ${packages[$i]} = "${1}" ]] && unset "packages[$i]" && return 0 @@ -407,28 +400,27 @@ download_package_lists() { add_packages() { echo -e "\nAdding required packages..." - while read -r k v - do - if [ "${k}" = "Package:" ]; then - current_package=${v} - elif [ "${k}" = "Filename:" ]; then - current_filename=${v} - elif [ "${k}" = "SHA256:" ]; then - current_sha256=${v} - elif [ "${k}" = "" ]; then - if required "${current_package}"; then + filter_package_list < "${1}_Packages" >"${1}_Packages.tmp" + for pkg in "${packages[@]}"; do + while read -r k v + do + if [ "${k}" = "Package:" ]; then + current_package=${v} + elif [ "${k}" = "Filename:" ]; then + current_filename=${v} + elif [ "${k}" = "SHA256:" ]; then + current_sha256=${v} + elif [ "${k}" = "" ]; then printf " %-32s %s\n" "${current_package}" "$(basename "${current_filename}")" unset_required "${current_package}" packages_debs+=("${2}/${current_filename}") packages_sha256+=("${current_sha256} $(basename "${current_filename}")") - allfound && break + current_package= + current_filename= + current_sha256= fi - - current_package= - current_filename= - current_sha256= - fi - done < <(filter_package_list <"${1}_Packages") + done < <(grep -A 3 -m 1 ^Package:\ "$pkg"$ "${1}_Packages.tmp") + done } download_packages() { From 5eec109dbe0ecdf987953aa4a1a9dea04bd8795e Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 20 Jun 2023 13:37:01 +0200 Subject: [PATCH 39/49] build: setup archive keys only once The archive keys are currently downloaded and set up 3 times (once in each download_package_list call). Do it only once before calling download_package_list. --- update.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/update.sh b/update.sh index 880fb491..b4e0130d 100755 --- a/update.sh +++ b/update.sh @@ -371,12 +371,6 @@ download_package_list() { } download_package_lists() { - if ! setup_archive_keys; then - echo -e "ERROR\nSetting up the archives failed! Exiting." - cd .. - exit 1 - fi - echo -e "\nDownloading Release file and its signature..." download_file "${2}/dists/$release/Release" "${1}_Release" download_file "${2}/dists/$release/Release.gpg" "${1}_Release.gpg" @@ -485,6 +479,12 @@ fi mirror_debian=${mirror_debian/:\/\//:\/\/${mirror_debian_cache}\/} fi + if ! setup_archive_keys; then + echo -e "ERROR\nSetting up the archives failed! Exiting." + cd .. + exit 1 + fi + ## Download package list download_package_lists raspberry ${mirror_raspberrypi} download_package_lists raspbian ${mirror_raspbian} From ac654a997dddc35ff36aab20dced235d76fbaf13 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 20 Jun 2023 15:22:39 +0200 Subject: [PATCH 40/49] build: improve code for setting up archive keys Use array and a for loop to set up archive keys instead of multiple copies of the same code. --- update.sh | 126 +++++++++--------------------------------------------- 1 file changed, 21 insertions(+), 105 deletions(-) diff --git a/update.sh b/update.sh index b4e0130d..18475a90 100755 --- a/update.sh +++ b/update.sh @@ -2,30 +2,12 @@ # shellcheck source=./build.conf # shellcheck disable=SC1091 -RASPBIAN_ARCHIVE_KEY_DIRECTORY="https://archive.raspbian.org" -RASPBIAN_ARCHIVE_KEY_FILE_NAME="raspbian.public.key" -RASPBIAN_ARCHIVE_KEY_URL="${RASPBIAN_ARCHIVE_KEY_DIRECTORY}/${RASPBIAN_ARCHIVE_KEY_FILE_NAME}" -RASPBIAN_ARCHIVE_KEY_FINGERPRINT="A0DA38D0D76E8B5D638872819165938D90FDDD2E" - -RASPBERRYPI_ARCHIVE_KEY_DIRECTORY="https://archive.raspberrypi.org/debian" -RASPBERRYPI_ARCHIVE_KEY_FILE_NAME="raspberrypi.gpg.key" -RASPBERRYPI_ARCHIVE_KEY_URL="${RASPBERRYPI_ARCHIVE_KEY_DIRECTORY}/${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}" -RASPBERRYPI_ARCHIVE_KEY_FINGERPRINT="CF8A1AF502A2AA2D763BAE7E82B129927FA3303E" - -DEBIAN_ARCHIVE10_KEY_DIRECTORY="https://ftp-master.debian.org/keys" -DEBIAN_ARCHIVE10_KEY_FILE_NAME="archive-key-10.asc" -DEBIAN_ARCHIVE10_KEY_URL="${DEBIAN_ARCHIVE10_KEY_DIRECTORY}/${DEBIAN_ARCHIVE10_KEY_FILE_NAME}" -DEBIAN_ARCHIVE10_KEY_FINGERPRINT="80D15823B7FD1561F9F7BCDDDC30D7C23CBBABEE" - -DEBIAN_ARCHIVE_KEY_DIRECTORY="https://ftp-master.debian.org/keys" -DEBIAN_ARCHIVE_KEY_FILE_NAME="archive-key-11.asc" -DEBIAN_ARCHIVE_KEY_URL="${DEBIAN_ARCHIVE_KEY_DIRECTORY}/${DEBIAN_ARCHIVE_KEY_FILE_NAME}" -DEBIAN_ARCHIVE_KEY_FINGERPRINT="1F89983E0081FDE018F3CC9673A4F27B8DD47936" - -DEBIAN_RELEASE_KEY_DIRECTORY="https://ftp-master.debian.org/keys" -DEBIAN_RELEASE_KEY_FILE_NAME="release-11.asc" -DEBIAN_RELEASE_KEY_URL="${DEBIAN_RELEASE_KEY_DIRECTORY}/${DEBIAN_RELEASE_KEY_FILE_NAME}" -DEBIAN_RELEASE_KEY_FINGERPRINT="A4285295FC7B1A81600062A9605C66F00D6C9793" +ARCHIVE_KEYS=() +ARCHIVE_KEYS+=("https://archive.raspbian.org;raspbian.public.key;A0DA38D0D76E8B5D638872819165938D90FDDD2E") +ARCHIVE_KEYS+=("https://archive.raspberrypi.org/debian;raspberrypi.gpg.key;CF8A1AF502A2AA2D763BAE7E82B129927FA3303E") +ARCHIVE_KEYS+=("https://ftp-master.debian.org/keys;archive-key-10.asc;80D15823B7FD1561F9F7BCDDDC30D7C23CBBABEE") +ARCHIVE_KEYS+=("https://ftp-master.debian.org/keys;archive-key-11.asc;1F89983E0081FDE018F3CC9673A4F27B8DD47936") +ARCHIVE_KEYS+=("https://ftp-master.debian.org/keys;release-11.asc;A4285295FC7B1A81600062A9605C66F00D6C9793") mirror_raspbian=http://mirrordirector.raspbian.org/raspbian mirror_raspberrypi=http://archive.raspberrypi.org/debian @@ -219,93 +201,27 @@ setup_archive_keys() { # Let gpg set itself up already in the 'gnupg' dir before we actually use it echo "Setting up gpg... " gpg --homedir gnupg --list-secret-keys - echo "" - - echo "Downloading ${RASPBIAN_ARCHIVE_KEY_FILE_NAME}." - download_file ${RASPBIAN_ARCHIVE_KEY_URL} - if check_key "${RASPBIAN_ARCHIVE_KEY_FILE_NAME}" "${RASPBIAN_ARCHIVE_KEY_FINGERPRINT}"; then - # GPG key checks out, thus import it into our own keyring - echo -n "Importing '${RASPBIAN_ARCHIVE_KEY_FILE_NAME}' into keyring... " - if gpg -q --homedir gnupg --import "${RASPBIAN_ARCHIVE_KEY_FILE_NAME}"; then - echo "OK" - else - echo "FAILED!" - return 1 - fi - else - return 1 - fi - - echo "" - - echo "Downloading ${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}." - download_file ${RASPBERRYPI_ARCHIVE_KEY_URL} - if check_key "${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}" "${RASPBERRYPI_ARCHIVE_KEY_FINGERPRINT}"; then - # GPG key checks out, thus import it into our own keyring - echo -n "Importing '${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}' into keyring..." - if gpg -q --homedir gnupg --import "${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}"; then - echo "OK" - else - echo "FAILED!" - return 1 - fi - else - return 1 - fi - - echo "" - - echo "Downloading ${DEBIAN_ARCHIVE10_KEY_FILE_NAME}." - download_file ${DEBIAN_ARCHIVE10_KEY_URL} - if check_key "${DEBIAN_ARCHIVE10_KEY_FILE_NAME}" "${DEBIAN_ARCHIVE10_KEY_FINGERPRINT}"; then - # GPG key checks out, thus import it into our own keyring - echo -n "Importing '${DEBIAN_ARCHIVE10_KEY_FILE_NAME}' into keyring... " - if gpg -q --homedir gnupg --import "${DEBIAN_ARCHIVE10_KEY_FILE_NAME}"; then - echo "OK" - else - echo "FAILED!" - return 1 - fi - else - return 1 - fi - - echo "" - - echo "Downloading ${DEBIAN_ARCHIVE_KEY_FILE_NAME}." - download_file ${DEBIAN_ARCHIVE_KEY_URL} - if check_key "${DEBIAN_ARCHIVE_KEY_FILE_NAME}" "${DEBIAN_ARCHIVE_KEY_FINGERPRINT}"; then - # GPG key checks out, thus import it into our own keyring - echo -n "Importing '${DEBIAN_ARCHIVE_KEY_FILE_NAME}' into keyring... " - if gpg -q --homedir gnupg --import "${DEBIAN_ARCHIVE_KEY_FILE_NAME}"; then - echo "OK" - else - echo "FAILED!" - return 1 - fi - else - return 1 - fi - echo "" - - echo "Downloading ${DEBIAN_RELEASE_KEY_FILE_NAME}." - download_file ${DEBIAN_RELEASE_KEY_URL} - if check_key "${DEBIAN_RELEASE_KEY_FILE_NAME}" "${DEBIAN_RELEASE_KEY_FINGERPRINT}"; then - # GPG key checks out, thus import it into our own keyring - echo -n "Importing '${DEBIAN_RELEASE_KEY_FILE_NAME}' into keyring... " - if gpg -q --homedir gnupg --import "${DEBIAN_RELEASE_KEY_FILE_NAME}"; then - echo "OK" + for archive_key in ${ARCHIVE_KEYS[@]}; do + echo "" + IFS=';' read -r KEY_URL KEY_FILE KEY_FINGERPRINT <<< "$archive_key" + echo "Downloading ${KEY_FILE}." + download_file ${KEY_URL}/${KEY_FILE} + if check_key "${KEY_FILE}" "${KEY_FINGERPRINT}"; then + # GPG key checks out, thus import it into our own keyring + echo -n "Importing '${KEY_FILE}' into keyring... " + if gpg -q --homedir gnupg --import "${KEY_FILE}"; then + echo "OK" + else + echo "FAILED!" + return 1 + fi else - echo "FAILED!" return 1 fi - else - return 1 - fi + done return 0 - } unset_required() { From 7443652c99d4dbef9760e13d16b2f2787e83ff3b Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 21 Jun 2023 14:52:34 +0200 Subject: [PATCH 41/49] build: add dependency libraries automatically Maintaining the library list in update.sh is a pain. Remove it and add dependency libraries automatically by parsing the Depends: and Pre-Depends: data from package lists and adding the libs to package list (taking care of duplicates). --- update.sh | 127 +++++++++++++++++++----------------------------------- 1 file changed, 45 insertions(+), 82 deletions(-) diff --git a/update.sh b/update.sh index 18475a90..ef5cc0e1 100755 --- a/update.sh +++ b/update.sh @@ -31,7 +31,7 @@ packages+=("coreutils") packages+=("diffutils") packages+=("dosfstools") packages+=("dpkg") -packages+=("libext2fs2") +packages+=("libc-bin") packages+=("e2fsprogs") packages+=("f2fs-tools") packages+=("gpgv") @@ -53,71 +53,10 @@ packages+=("xxd") packages+=("curl") packages+=("logsave") -# libraries -packages+=("libacl1") -packages+=("libattr1") -packages+=("libblkid1") -packages+=("libbpf0") -packages+=("libbrotli1") -packages+=("libbsd0") -packages+=("libbz2-1.0") -packages+=("libc-bin") -packages+=("libc6") -packages+=("libcap2") -packages+=("libcom-err2") -packages+=("libcurl4") -packages+=("libdb5.3") -packages+=("libdbus-1-3") -packages+=("libelf1") -packages+=("libfdisk1") -packages+=("libffi7") -packages+=("libgcc-s1") -packages+=("libgcrypt20") -packages+=("libgmp10") -packages+=("libgnutls30") -packages+=("libgpg-error0") -packages+=("libgssapi-krb5-2") -packages+=("libhogweed6") -packages+=("libidn2-0") -packages+=("libk5crypto3") -packages+=("libkeyutils1") -packages+=("libkrb5-3") -packages+=("libkrb5support0") -packages+=("libldap-2.4-2") -packages+=("liblz4-1") -packages+=("liblzma5") -packages+=("libmd0") -packages+=("libmount1") -packages+=("libmnl0") -packages+=("libnettle8") -packages+=("libnghttp2-14") -packages+=("libnl-3-200") -packages+=("libnl-genl-3-200") -packages+=("libnl-route-3-200") -packages+=("libpcre2-8-0") -packages+=("libpcsclite1") -packages+=("libp11-kit0") -packages+=("libpsl5") -packages+=("libraspberrypi0") -packages+=("librtmp1") -packages+=("libsasl2-2") -packages+=("libselinux1") -packages+=("libsmartcols1") -packages+=("libss2") -packages+=("libssh2-1") -packages+=("libssl1.1") -packages+=("libsystemd0") -packages+=("libtasn1-6") -packages+=("libtinfo6") -packages+=("libunistring2") -packages+=("libuuid1") -packages+=("libxtables12") -packages+=("libzstd1") -packages+=("zlib1g") - packages_debs= packages_sha256= +packages_done=() download_file() { local download_source=$1 @@ -237,7 +176,7 @@ allfound() { } filter_package_list() { - grep -E 'Package:|Filename:|SHA256:|^$' + grep -E '^Package:|^Pre-Depends:|^Depends:|^Filename:|^SHA256:|^$' } download_package_list() { @@ -311,25 +250,49 @@ download_package_lists() { add_packages() { echo -e "\nAdding required packages..." filter_package_list < "${1}_Packages" >"${1}_Packages.tmp" - for pkg in "${packages[@]}"; do - while read -r k v - do - if [ "${k}" = "Package:" ]; then - current_package=${v} - elif [ "${k}" = "Filename:" ]; then - current_filename=${v} - elif [ "${k}" = "SHA256:" ]; then - current_sha256=${v} - elif [ "${k}" = "" ]; then - printf " %-32s %s\n" "${current_package}" "$(basename "${current_filename}")" - unset_required "${current_package}" - packages_debs+=("${2}/${current_filename}") - packages_sha256+=("${current_sha256} $(basename "${current_filename}")") - current_package= - current_filename= - current_sha256= + while true; do + libs=() + for pkg in "${packages[@]}"; do + current_package= + current_depends=() + current_filename= + current_sha256= + while read -r k v + do + if [ "${k}" = "Package:" ]; then + current_package=${v} + elif [ "${k}" = "Pre-Depends:" ]; then + current_depends+=($(echo "${v}" | sed -e 's/, /\n/g' -e 's/\ Pre-Depends:\ //' -e 's/ ([^)]*)//g')) + elif [ "${k}" = "Depends:" ]; then + current_depends+=($(echo "${v}" | sed -e 's/, /\n/g' -e 's/\ Depends:\ //' -e 's/ ([^)]*)//g')) + elif [ "${k}" = "Filename:" ]; then + current_filename=${v} + elif [ "${k}" = "SHA256:" ]; then + current_sha256=${v} + elif [ "${k}" = "" ]; then + break + fi + done < <(grep -A 4 -m 1 ^Package:\ "$pkg"$ "${1}_Packages.tmp") + if [ -z ${current_package} ]; then # package not found + continue fi - done < <(grep -A 3 -m 1 ^Package:\ "$pkg"$ "${1}_Packages.tmp") + printf " %-32s %s\n" "${current_package}" "$(basename "${current_filename}")" + unset_required "${current_package}" + packages_debs+=("${2}/${current_filename}") + packages_sha256+=("${current_sha256} $(basename "${current_filename}")") + packages_done+=("${current_package}") + libs+=($(printf '%s\n' "${current_depends[@]}" | grep "lib")) + done + # remove duplicate libs + libs=($(printf '%s\n' "${libs[@]}" | sort | uniq)) + # remove libs already done + libs=($(printf '%s\n' "${packages_done[@]}" "${packages_done[@]}" "${libs[@]}" | sort | uniq -u)) + # we're done if no libs to add + if [ ${#libs[@]} -eq 0 ]; then + break + fi + packages+=(${libs[@]}) + echo -e "\nAdding dependency libraries..." done } From 0edaaaf8fe5cb07bd62607dc9589d3ed9412925a Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 27 Jun 2023 13:32:47 +0200 Subject: [PATCH 42/49] build: add dependency libraries automatically #2 Maintaining the library list in build.sh is a pain. Remove it and add dependency libraries automatically by using readelf -d on all copied executable files. --- build.sh | 427 +++++++++++++++++++------------------------------------ 1 file changed, 149 insertions(+), 278 deletions(-) diff --git a/build.sh b/build.sh index 673d6845..87e1cc23 100755 --- a/build.sh +++ b/build.sh @@ -8,6 +8,8 @@ packages_dir=./packages resources_dir=./res scripts_dir=./scripts +libs_to_copy=() + # update version and date version_tag="$(git describe --exact-match --tags HEAD 2> /dev/null || true)" version_commit="$(git rev-parse --short "@{0}" 2> /dev/null || true)" @@ -108,12 +110,44 @@ function create_tempfile { fi } +# copy an executable file and add all needed libraries to libs_to_copy array +function cp_executable { + echo "Copying executable $1" + cp --preserve=xattr,timestamps "$1" "$2" + + LIB_PATH=("tmp/lib" "tmp/usr/lib") + libs_todo=("$1") + while true; do + needed_libs=($(readelf -d "${libs_todo[0]}" 2>/dev/null | grep \(NEEDED\) | sed -e 's/.*\[//' -e 's/\]//')) + for lib in "${needed_libs[@]}"; do + if printf '%s\n' "${libs_to_copy[@]}" | grep -q "/$lib$"; then + continue + fi + echo -n " Adding dependency $lib => " + lib_found=$(find -L "${LIB_PATH[@]}" -name "$lib" 2>/dev/null | head -n 1) + if [ -n "$lib_found" ]; then + echo "$lib_found" + libs_to_copy+=("$lib_found") + libs_todo+=("$lib_found") + else + echo " not found!" + exit 1 + fi + done + libs_todo=("${libs_todo[@]:1}") + if [ ${#libs_todo[@]} -eq 0 ]; then + break + fi + done +} + function create_cpio { # initialize rootfs rm -rf rootfs mkdir -p rootfs # create all the directories needed to copy the various components into place mkdir -p rootfs/bin/ + mkdir -p rootfs/lib/arm-linux-gnueabihf/ mkdir -p rootfs/lib/lsb/init-functions.d/ mkdir -p rootfs/etc/{alternatives,cron.daily,default,init,init.d,iproute2,ld.so.conf.d,logrotate.d,network/if-up.d/} mkdir -p rootfs/etc/dpkg/dpkg.cfg.d/ @@ -123,9 +157,7 @@ function create_cpio { mkdir -p rootfs/lib/modules/ mkdir -p rootfs/sbin/ mkdir -p rootfs/usr/bin/ - mkdir -p rootfs/usr/lib/mime/packages/ - mkdir -p rootfs/usr/lib/engines-1.1/ - mkdir -p rootfs/usr/lib/{tar,tc} + mkdir -p rootfs/usr/lib/arm-linux-gnueabihf/ mkdir -p rootfs/usr/sbin/ mkdir -p rootfs/usr/share/{dpkg,keyrings,libc-bin} mkdir -p rootfs/var/lib/dpkg/{alternatives,info,parts,updates} @@ -215,11 +247,13 @@ function create_cpio { sed -i "s/__VERSION__/${version_info}/" rootfs/opt/raspberrypi-ua-netinst/install.sh sed -i "s/__DATE__/$(date)/" rootfs/opt/raspberrypi-ua-netinst/install.sh + ln -s arm-linux-gnueabihf/ld-linux-armhf.so.3 rootfs/lib/ld-linux-armhf.so.3 + # btrfs-progs components - cp --preserve=xattr,timestamps tmp/sbin/mkfs.btrfs rootfs/sbin/ + cp_executable tmp/sbin/mkfs.btrfs rootfs/sbin/ # busybox components - cp --preserve=xattr,timestamps tmp/bin/busybox rootfs/bin + cp_executable tmp/bin/busybox rootfs/bin cd rootfs && ln -s bin/busybox init; cd .. echo "\$MODALIAS=.* 0:0 660 @/opt/busybox/bin/modprobe \"\$MODALIAS\"" > rootfs/etc/mdev.conf @@ -232,42 +266,42 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/usr/bin/cdebootstrap-static rootfs/usr/bin/ # coreutils components - cp --preserve=xattr,timestamps tmp/bin/cat rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/chgrp rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/chmod rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/chown rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/cp --preserve=xattr,timestamps rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/date rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/dd rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/df rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/dir rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/echo rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/false rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/ln rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/ls rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/mkdir rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/mknod rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/mktemp rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/mv rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/pwd rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/readlink rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/rm rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/rmdir rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/sleep rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/stty rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/sync rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/touch rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/true rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/uname rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/vdir rootfs/bin/ + cp_executable tmp/bin/cat rootfs/bin/ + cp_executable tmp/bin/chgrp rootfs/bin/ + cp_executable tmp/bin/chmod rootfs/bin/ + cp_executable tmp/bin/chown rootfs/bin/ + cp_executable tmp/bin/cp rootfs/bin/ + cp_executable tmp/bin/date rootfs/bin/ + cp_executable tmp/bin/dd rootfs/bin/ + cp_executable tmp/bin/df rootfs/bin/ + cp_executable tmp/bin/dir rootfs/bin/ + cp_executable tmp/bin/echo rootfs/bin/ + cp_executable tmp/bin/false rootfs/bin/ + cp_executable tmp/bin/ln rootfs/bin/ + cp_executable tmp/bin/ls rootfs/bin/ + cp_executable tmp/bin/mkdir rootfs/bin/ + cp_executable tmp/bin/mknod rootfs/bin/ + cp_executable tmp/bin/mktemp rootfs/bin/ + cp_executable tmp/bin/mv rootfs/bin/ + cp_executable tmp/bin/pwd rootfs/bin/ + cp_executable tmp/bin/readlink rootfs/bin/ + cp_executable tmp/bin/rm rootfs/bin/ + cp_executable tmp/bin/rmdir rootfs/bin/ + cp_executable tmp/bin/sleep rootfs/bin/ + cp_executable tmp/bin/stty rootfs/bin/ + cp_executable tmp/bin/sync rootfs/bin/ + cp_executable tmp/bin/touch rootfs/bin/ + cp_executable tmp/bin/true rootfs/bin/ + cp_executable tmp/bin/uname rootfs/bin/ + cp_executable tmp/bin/vdir rootfs/bin/ # diffutils components - cp --preserve=xattr,timestamps tmp/usr/bin/cmp rootfs/usr/bin/ + cp_executable tmp/usr/bin/cmp rootfs/usr/bin/ # dosfstools components - cp --preserve=xattr,timestamps tmp/sbin/fatlabel rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/fsck.fat rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/mkfs.fat rootfs/sbin/ + cp_executable tmp/sbin/fatlabel rootfs/sbin/ + cp_executable tmp/sbin/fsck.fat rootfs/sbin/ + cp_executable tmp/sbin/mkfs.fat rootfs/sbin/ cd rootfs/sbin ln -s fatlabel dosfslabel ln -s fsck.fat dosfsck @@ -283,16 +317,16 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/etc/cron.daily/dpkg rootfs/etc/cron.daily/ cp --preserve=xattr,timestamps tmp/etc/dpkg/dpkg.cfg rootfs/etc/dpkg/ cp --preserve=xattr,timestamps tmp/etc/logrotate.d/dpkg rootfs/etc/logrotate.d/ - cp --preserve=xattr,timestamps tmp/sbin/start-stop-daemon rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg-deb rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg-divert rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg-maintscript-helper rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg-query rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg-split rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg-statoverride rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/dpkg-trigger rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/update-alternatives rootfs/usr/bin/ + cp_executable tmp/sbin/start-stop-daemon rootfs/sbin/ + cp_executable tmp/usr/bin/dpkg rootfs/usr/bin/ + cp_executable tmp/usr/bin/dpkg-deb rootfs/usr/bin/ + cp_executable tmp/usr/bin/dpkg-divert rootfs/usr/bin/ + cp_executable tmp/usr/bin/dpkg-maintscript-helper rootfs/usr/bin/ + cp_executable tmp/usr/bin/dpkg-query rootfs/usr/bin/ + cp_executable tmp/usr/bin/dpkg-split rootfs/usr/bin/ + cp_executable tmp/usr/bin/dpkg-statoverride rootfs/usr/bin/ + cp_executable tmp/usr/bin/dpkg-trigger rootfs/usr/bin/ + cp_executable tmp/usr/bin/update-alternatives rootfs/usr/bin/ cp --preserve=xattr,timestamps tmp/usr/share/dpkg/abitable rootfs/usr/share/dpkg/ cp --preserve=xattr,timestamps tmp/usr/share/dpkg/cputable rootfs/usr/share/dpkg/ cp --preserve=xattr,timestamps tmp/usr/share/dpkg/ostable rootfs/usr/share/dpkg/ @@ -304,28 +338,24 @@ function create_cpio { cd ../../.. touch rootfs/var/lib/dpkg/status - # libext2fs2 components - cp --preserve=xattr,timestamps tmp/lib/*/libe2p.so.2.* rootfs/lib/libe2p.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/libext2fs.so.2.* rootfs/lib/libext2fs.so.2 - # e2fsprogs components cp --preserve=xattr,timestamps tmp/etc/mke2fs.conf rootfs/etc/ - cp --preserve=xattr,timestamps tmp/sbin/badblocks rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/debugfs rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/dumpe2fs rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/e2fsck rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/e2image rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/e2undo rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/logsave rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/mke2fs rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/resize2fs rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/tune2fs rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/usr/bin/chattr rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/lsattr rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/sbin/e2freefrag rootfs/usr/sbin/ - cp --preserve=xattr,timestamps tmp/usr/sbin/e4defrag rootfs/usr/sbin/ - cp --preserve=xattr,timestamps tmp/usr/sbin/filefrag rootfs/usr/sbin/ - cp --preserve=xattr,timestamps tmp/usr/sbin/mklost+found rootfs/usr/sbin/ + cp_executable tmp/sbin/badblocks rootfs/sbin/ + cp_executable tmp/sbin/debugfs rootfs/sbin/ + cp_executable tmp/sbin/dumpe2fs rootfs/sbin/ + cp_executable tmp/sbin/e2fsck rootfs/sbin/ + cp_executable tmp/sbin/e2image rootfs/sbin/ + cp_executable tmp/sbin/e2undo rootfs/sbin/ + cp_executable tmp/sbin/logsave rootfs/sbin/ + cp_executable tmp/sbin/mke2fs rootfs/sbin/ + cp_executable tmp/sbin/resize2fs rootfs/sbin/ + cp_executable tmp/sbin/tune2fs rootfs/sbin/ + cp_executable tmp/usr/bin/chattr rootfs/usr/bin/ + cp_executable tmp/usr/bin/lsattr rootfs/usr/bin/ + cp_executable tmp/usr/sbin/e2freefrag rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/e4defrag rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/filefrag rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/mklost+found rootfs/usr/sbin/ cd rootfs/sbin ln -s tune2fs e2lablel ln -s e2fsck fsck.ext2 @@ -339,24 +369,24 @@ function create_cpio { cd ../.. # f2fs-tools components - cp --preserve=xattr,timestamps tmp/sbin/mkfs.f2fs rootfs/sbin/ + cp_executable tmp/sbin/mkfs.f2fs rootfs/sbin/ # gpgv components - cp --preserve=xattr,timestamps tmp/usr/bin/gpgv rootfs/usr/bin/ + cp_executable tmp/usr/bin/gpgv rootfs/usr/bin/ # ifupdown components cp --preserve=xattr,timestamps tmp/etc/default/networking rootfs/etc/default/ cp --preserve=xattr,timestamps tmp/etc/init.d/networking rootfs/etc/init.d/ cp --preserve=xattr,timestamps tmp/lib/ifupdown/settle-dad.sh rootfs/lib/ifupdown/ - cp --preserve=xattr,timestamps tmp/sbin/ifup rootfs/sbin/ + cp_executable tmp/sbin/ifup rootfs/sbin/ cd rootfs/sbin ln -s ifup ifdown ln -s ifup ifquery cd ../.. # iproute2 components - cp --preserve=xattr,timestamps tmp/bin/ip rootfs/bin/ - cp --preserve=xattr,timestamps tmp/bin/ss rootfs/bin/ + cp_executable tmp/bin/ip rootfs/bin/ + cp_executable tmp/bin/ss rootfs/bin/ cp --preserve=xattr,timestamps tmp/etc/iproute2/ematch_map rootfs/etc/iproute2/ cp --preserve=xattr,timestamps tmp/etc/iproute2/group rootfs/etc/iproute2/ cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_dsfield rootfs/etc/iproute2/ @@ -364,31 +394,22 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_realms rootfs/etc/iproute2/ cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_scopes rootfs/etc/iproute2/ cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_tables rootfs/etc/iproute2/ - cp --preserve=xattr,timestamps tmp/sbin/bridge rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/rtacct rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/rtmon rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/tc rootfs/sbin/ + cp_executable tmp/sbin/bridge rootfs/sbin/ + cp_executable tmp/sbin/rtacct rootfs/sbin/ + cp_executable tmp/sbin/rtmon rootfs/sbin/ + cp_executable tmp/sbin/tc rootfs/sbin/ cd rootfs/sbin ln -s ../bin/ip ip cd ../.. - cp --preserve=xattr,timestamps tmp/usr/bin/lnstat rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/nstat rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/routef rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/routel rootfs/usr/bin/ + cp_executable tmp/usr/bin/lnstat rootfs/usr/bin/ + cp_executable tmp/usr/bin/nstat rootfs/usr/bin/ + cp_executable tmp/usr/bin/routef rootfs/usr/bin/ + cp_executable tmp/usr/bin/routel rootfs/usr/bin/ cd rootfs/usr/bin ln -s lnstat ctstat ln -s lnstat rtstat cd ../../.. - cp --preserve=xattr,timestamps tmp/usr/lib/tc/experimental.dist rootfs/usr/lib/tc - cp --preserve=xattr,timestamps tmp/usr/lib/tc/m_xt.so rootfs/usr/lib/tc - cp --preserve=xattr,timestamps tmp/usr/lib/tc/normal.dist rootfs/usr/lib/tc - cp --preserve=xattr,timestamps tmp/usr/lib/tc/pareto.dist rootfs/usr/lib/tc - cp --preserve=xattr,timestamps tmp/usr/lib/tc/paretonormal.dist rootfs/usr/lib/tc - cp --preserve=xattr,timestamps tmp/usr/lib/tc/q_atm.so rootfs/usr/lib/tc - cd rootfs/usr/lib/tc - ln -s m_xt.so m_ipt.so - cd ../../../.. - cp --preserve=xattr,timestamps tmp/usr/sbin/arpd rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/arpd rootfs/usr/sbin/ # lsb-base components cp --preserve=xattr,timestamps tmp/lib/lsb/init-functions rootfs/lib/lsb/ @@ -400,13 +421,13 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/etc/services rootfs/etc/ # netcat-openbsd - cp --preserve=xattr,timestamps tmp/bin/nc.openbsd rootfs/bin/nc + cp_executable tmp/bin/nc.openbsd rootfs/bin/nc # ntpdate components cp --preserve=xattr,timestamps tmp/etc/default/ntpdate rootfs/etc/default/ sed -i s/NTPDATE_USE_NTP_CONF=yes/NTPDATE_USE_NTP_CONF=no/ rootfs/etc/default/ntpdate - cp --preserve=xattr,timestamps tmp/usr/sbin/ntpdate rootfs/usr/sbin/ - cp --preserve=xattr,timestamps tmp/usr/sbin/ntpdate-debian rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/ntpdate rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/ntpdate-debian rootfs/usr/sbin/ # raspberrypi.org GPG key cp --preserve=xattr,timestamps ../"${packages_dir}"/raspberrypi.gpg.key rootfs/usr/share/keyrings/ @@ -415,180 +436,52 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/usr/share/keyrings/*.gpg rootfs/usr/share/keyrings/ # rng-tools5 components - cp --preserve=xattr,timestamps tmp/usr/bin/rngtest rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/sbin/rngd rootfs/usr/sbin/ + cp_executable tmp/usr/bin/rngtest rootfs/usr/bin/ + cp_executable tmp/usr/sbin/rngd rootfs/usr/sbin/ # tar components - cp --preserve=xattr,timestamps tmp/bin/tar rootfs/bin/ - cp --preserve=xattr,timestamps tmp/usr/lib/mime/packages/tar rootfs/usr/lib/mime/packages/ - cp --preserve=xattr,timestamps tmp/usr/sbin/tarcat rootfs/usr/sbin/ + cp_executable tmp/bin/tar rootfs/bin/ + cp_executable tmp/usr/sbin/tarcat rootfs/usr/sbin/ # fdisk components - cp --preserve=xattr,timestamps tmp/sbin/fdisk rootfs/sbin/ + cp_executable tmp/sbin/fdisk rootfs/sbin/ # util-linux components - cp --preserve=xattr,timestamps tmp/sbin/blkid rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/blockdev rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/fsck rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/mkswap rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/sbin/swaplabel rootfs/sbin/ + cp_executable tmp/sbin/blkid rootfs/sbin/ + cp_executable tmp/sbin/blockdev rootfs/sbin/ + cp_executable tmp/sbin/fsck rootfs/sbin/ + cp_executable tmp/sbin/mkswap rootfs/sbin/ + cp_executable tmp/sbin/swaplabel rootfs/sbin/ # wpa_supplicant components - cp --preserve=xattr,timestamps tmp/sbin/wpa_supplicant rootfs/sbin/wpa_supplicant + cp_executable tmp/sbin/wpa_supplicant rootfs/sbin/wpa_supplicant cp --preserve=xattr,timestamps -r tmp/etc/wpa_supplicant rootfs/etc/wpa_supplicant - # libacl1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libacl.so.1.* rootfs/usr/lib/libacl.so.1 - - # libattr1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libattr.so.1.* rootfs/usr/lib/libattr.so.1 - - # libblkid1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libblkid.so.1.* rootfs/usr/lib/libblkid.so.1 - - # libbpf0 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libbpf.so.0.* rootfs/usr/lib/libbpf.so.0 - - # libbsd0 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libbsd.so.0.* rootfs/usr/lib/libbsd.so.0 - - # libbz2-1.0 components - cp --preserve=xattr,timestamps tmp/lib/*/libbz2.so.1.0.* rootfs/lib/libbz2.so.1.0 - # libc-bin components cp --preserve=xattr,timestamps tmp/etc/default/nss rootfs/etc/default/ - cp --preserve=xattr,timestamps tmp/etc/ld.so.conf.d/libc.conf rootfs/etc/ld.so.conf.d/ + cp --preserve=xattr,timestamps tmp/etc/ld.so.conf.d/* rootfs/etc/ld.so.conf.d/ cp --preserve=xattr,timestamps tmp/etc/bindresvport.blacklist rootfs/etc/ cp --preserve=xattr,timestamps tmp/etc/gai.conf rootfs/etc/ cp --preserve=xattr,timestamps tmp/etc/ld.so.conf rootfs/etc/ - cp --preserve=xattr,timestamps tmp/sbin/ldconfig rootfs/sbin/ - cp --preserve=xattr,timestamps tmp/usr/bin/catchsegv rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/getconf rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/getent rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/iconv rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/ldd rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/locale rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/localedef rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/pldd rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/tzselect rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/bin/zdump rootfs/usr/bin/ + cp_executable tmp/sbin/ldconfig rootfs/sbin/ + cp_executable tmp/usr/bin/catchsegv rootfs/usr/bin/ + cp_executable tmp/usr/bin/getconf rootfs/usr/bin/ + cp_executable tmp/usr/bin/getent rootfs/usr/bin/ + cp_executable tmp/usr/bin/iconv rootfs/usr/bin/ + cp_executable tmp/usr/bin/ldd rootfs/usr/bin/ + cp_executable tmp/usr/bin/locale rootfs/usr/bin/ + cp_executable tmp/usr/bin/localedef rootfs/usr/bin/ + cp_executable tmp/usr/bin/pldd rootfs/usr/bin/ + cp_executable tmp/usr/bin/tzselect rootfs/usr/bin/ + cp_executable tmp/usr/bin/zdump rootfs/usr/bin/ # lib/locale ? - cp --preserve=xattr,timestamps tmp/usr/sbin/iconvconfig rootfs/usr/sbin/ - cp --preserve=xattr,timestamps tmp/usr/sbin/zic rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/iconvconfig rootfs/usr/sbin/ + cp_executable tmp/usr/sbin/zic rootfs/usr/sbin/ cp --preserve=xattr,timestamps tmp/usr/share/libc-bin/nsswitch.conf rootfs/usr/share/libc-bin/ # libc6 components - cp --preserve=xattr,timestamps tmp/lib/*/ld-*.so rootfs/lib/ld-linux-armhf.so.3 - cp --preserve=xattr,timestamps tmp/lib/*/libanl-*.so rootfs/lib/libanl.so.1 - cp --preserve=xattr,timestamps tmp/lib/*/libBrokenLocale-*.so rootfs/lib/libBrokenLocale.so.1 - cp --preserve=xattr,timestamps tmp/lib/*/libc-*.so rootfs/lib/libc.so.6 - cp --preserve=xattr,timestamps tmp/lib/*/libdl-*.so rootfs/lib/libdl.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/libm-*.so rootfs/lib/libm.so.6 - cp --preserve=xattr,timestamps tmp/lib/*/libmemusage.so rootfs/lib/ - cp --preserve=xattr,timestamps tmp/lib/*/libnsl-*.so rootfs/lib/libnsl.so.1 - cp --preserve=xattr,timestamps tmp/lib/*/libnss_compat-*.so rootfs/lib/libnss_compat.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/libnss_dns-*.so rootfs/lib/libnss_dns.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/libnss_files-*.so rootfs/lib/libnss_files.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/libnss_hesiod-*.so rootfs/lib/libnss_hesiod.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/libpcprofile.so rootfs/lib/ - cp --preserve=xattr,timestamps tmp/lib/*/libpthread-*.so rootfs/lib/libpthread.so.0 - cp --preserve=xattr,timestamps tmp/lib/*/libresolv-*.so rootfs/lib/libresolv.so.2 - cp --preserve=xattr,timestamps tmp/lib/*/librt-*.so rootfs/lib/librt.so.1 - cp --preserve=xattr,timestamps tmp/lib/*/libSegFault.so rootfs/lib/ - cp --preserve=xattr,timestamps tmp/lib/*/libthread_db-*.so rootfs/lib/libthread_db.so.1 - cp --preserve=xattr,timestamps tmp/lib/*/libutil-*.so rootfs/lib/libutil.so.1 - - # libcap2 components - cp --preserve=xattr,timestamps tmp/lib/*/libcap.so.2.* rootfs/lib/libcap.so.2 - - # libcom-err2 components - cp --preserve=xattr,timestamps tmp/lib/*/libcom_err.so.2.* rootfs/lib/libcom_err.so.2 - - # libdb5.3 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libdb-5.3.so rootfs/usr/lib/libdb-5.3.so - - # libdbus-1-3 components - cp --preserve=xattr,timestamps tmp/lib/*/libdbus-1.so.3 rootfs/lib/libdbus-1.so.3 - cp --preserve=xattr,timestamps tmp/lib/*/libdl.so.2 rootfs/lib/libdl.so.2 - - # libelf1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libelf.so.1 rootfs/usr/lib/libelf.so.1 - - # libfdisk1 components - cp --no-dereference --preserve=xattr,timestamps tmp/usr/lib/*/libfdisk.so.1.* rootfs/usr/lib/libfdisk.so.1 - - # libgcc-s1 components - cp --preserve=xattr,timestamps tmp/lib/*/libgcc_s.so.1 rootfs/lib/ - - # libgcrypt20 components - cp --no-dereference --preserve=xattr,timestamps tmp/usr/lib/*/libgcrypt.so.20.* rootfs/usr/lib/libgcrypt.so.20 - - # libgpg-error0 components - cp --no-dereference --preserve=xattr,timestamps tmp/lib/*/libgpg-error.so.0.* rootfs/lib/libgpg-error.so.0 - - # liblz4-1 components - cp --no-dereference --preserve=xattr,timestamps tmp/usr/lib/*/liblz4.so.1.* rootfs/usr/lib/liblz4.so.1 - - # liblzma5 components - cp --preserve=xattr,timestamps tmp/lib/*/liblzma.so.5.* rootfs/lib/liblzma.so.5 - - # libmd0 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libmd.so.0.* rootfs/usr/lib/libmd.so.0 - - # libmount1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libmount.so.1.* rootfs/usr/lib/libmount.so.1 - - # libmnl0 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libmnl.so.0.* rootfs/usr/lib/libmnl.so.0 - - # libnl-3-200 components - cp --preserve=xattr,timestamps tmp/lib/*/libnl-3.so.200 rootfs/lib/libnl-3.so.200 - - # libnl-genl-3-200 components - cp --preserve=xattr,timestamps tmp/lib/*/libnl-genl-3.so.200 rootfs/lib/libnl-genl-3.so.200 - - # libnl-route-3-200 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libnl-route-3.so.200.* rootfs/usr/lib/libnl-route-3.so.200 - - # libpcre2-8-0 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libpcre2-8.so.0.* rootfs/usr/lib/libpcre2-8.so.0 - - # libpcsclite components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libpcsclite.so.1 rootfs/lib/libpcsclite.so.1 - - # libselinux1 components - cp --preserve=xattr,timestamps tmp/lib/*/libselinux.so.1 rootfs/lib/ - - # libsmartcols1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libsmartcols.so.1.* rootfs/usr/lib/libsmartcols.so.1 - - # libss2 components - cp --preserve=xattr,timestamps tmp/lib/*/libss.so.2.* rootfs/lib/libss.so.2 - - # libssl1.1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libcrypto.so.1.1 rootfs/usr/lib/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/libssl.so.1.1 rootfs/usr/lib/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/engines-1.1/afalg.so rootfs/usr/lib/engines-1.1/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/engines-1.1/padlock.so rootfs/usr/lib/engines-1.1/ - - # libsystemd0 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libsystemd.so.0.* rootfs/usr/lib/libsystemd.so.0 - - # libtinfo6 components - cp --preserve=xattr,timestamps tmp/lib/*/libtinfo.so.6.* rootfs/lib/libtinfo.so.6 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libtic.so.6.* rootfs/usr/lib/libtic.so.6 - - # libuuid1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libuuid.so.1.* rootfs/usr/lib/libuuid.so.1 - - # libxtables12 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libxtables.so.12.* rootfs/usr/lib/libxtables.so.12 - - # libzstd1 components - cp --preserve=xattr,timestamps tmp/usr/lib/*/libzstd.so.1.* rootfs/usr/lib/libzstd.so.1 - - # zlib1g components - cp --preserve=xattr,timestamps tmp/lib/*/libz.so.1 rootfs/lib/ + cp_executable tmp/lib/*/libnss_dns.so.* rootfs/lib/arm-linux-gnueabihf/ + cp_executable tmp/lib/*/libnss_files.so.* rootfs/lib/arm-linux-gnueabihf/ # Binary firmware for version 3 Model B wireless mkdir -p rootfs/lib/firmware/brcm @@ -604,14 +497,11 @@ function create_cpio { # vcgencmd ## libraspberrypi-bin mkdir -p rootfs/usr/bin - cp --preserve=xattr,timestamps tmp/usr/bin/vcgencmd rootfs/usr/bin/ - ## libraspberrypi0 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libvcos.so.0 rootfs/usr/lib/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/libvchiq_arm.so.0 rootfs/usr/lib/ + cp_executable tmp/usr/bin/vcgencmd rootfs/usr/bin/ # xxd mkdir -p rootfs/usr/bin - cp --preserve=xattr,timestamps tmp/usr/bin/xxd rootfs/usr/bin/ + cp_executable tmp/usr/bin/xxd rootfs/usr/bin/ # install additional resources mkdir -p rootfs/opt/raspberrypi-ua-netinst/res @@ -620,31 +510,12 @@ function create_cpio { (cd ../"${resources_dir}"/initramfs/ && find . -type f -exec echo rootfs/opt/raspberrypi-ua-netinst/res/{} \;) | xargs chmod +r # curl - cp --preserve=xattr,timestamps tmp/usr/bin/curl rootfs/usr/bin/ - cp --preserve=xattr,timestamps tmp/usr/lib/*/libcurl.so.4 rootfs/usr/lib/libcurl.so.4 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libnghttp2.so.14 rootfs/usr/lib/libnghttp2.so.14 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libidn2.so.0 rootfs/usr/lib/libidn2.so.0 - cp --preserve=xattr,timestamps tmp/usr/lib/*/librtmp.so.1 rootfs/usr/lib/librtmp.so.1 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libssh2.so.1 rootfs/usr/lib/libssh2.so.1 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libpsl.so.5 rootfs/usr/lib/libpsl.so.5 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libgssapi_krb5.so.2 rootfs/usr/lib/libgssapi_krb5.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libkrb5.so.3 rootfs/usr/lib/libkrb5.so.3 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libk5crypto.so.3 rootfs/usr/lib/libk5crypto.so.3 - cp --preserve=xattr,timestamps tmp/usr/lib/*/liblber-2.4.so.2 rootfs/usr/lib/liblber-2.4.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libldap_r-2.4.so.2 rootfs/usr/lib/libldap_r-2.4.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libunistring.so.2.* rootfs/usr/lib/libunistring.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libgnutls.so.30 rootfs/usr/lib/libgnutls.so.30 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libhogweed.so.6 rootfs/usr/lib/libhogweed.so.6 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libnettle.so.8 rootfs/usr/lib/libnettle.so.8 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libgmp.so.10 rootfs/usr/lib/libgmp.so.10 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libkrb5support.so.0 rootfs/usr/lib/libkrb5support.so.0 - cp --preserve=xattr,timestamps tmp/lib/*/libkeyutils.so.1 rootfs/usr/lib/libkeyutils.so.1 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libsasl2.so.2 rootfs/usr/lib/libsasl2.so.2 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libp11-kit.so.0 rootfs/usr/lib/libp11-kit.so.0 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libtasn1.so.6 rootfs/usr/lib/libtasn1.so.6 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libffi.so.7 rootfs/usr/lib/libffi.so.7 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libbrotlidec.so.1 rootfs/usr/lib/libbrotlidec.so.1 - cp --preserve=xattr,timestamps tmp/usr/lib/*/libbrotlicommon.so.1 rootfs/usr/lib/libbrotlicommon.so.1 + cp_executable tmp/usr/bin/curl rootfs/usr/bin/ + + # copy all libraries needed by executable files above + for lib in "${libs_to_copy[@]}"; do + cp --preserve=xattr,timestamps "$lib" $(echo "$lib" | sed -e 's/^tmp\//rootfs\//') + done INITRAMFS="../raspberrypi-ua-netinst.cpio.gz" (cd rootfs && find . | cpio -H newc -ov | gzip --best > $INITRAMFS) From 9a15a1c757bcc08f8a42bf3f612b9d425d7ca1e4 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 12 Jul 2023 09:45:24 +0200 Subject: [PATCH 43/49] build: omit unneeded executable files Many of the copied files are not used during install. Don't copy them to initramfs. --- build.sh | 74 +------------------------------------------------------- 1 file changed, 1 insertion(+), 73 deletions(-) diff --git a/build.sh b/build.sh index 87e1cc23..87d51612 100755 --- a/build.sh +++ b/build.sh @@ -149,7 +149,7 @@ function create_cpio { mkdir -p rootfs/bin/ mkdir -p rootfs/lib/arm-linux-gnueabihf/ mkdir -p rootfs/lib/lsb/init-functions.d/ - mkdir -p rootfs/etc/{alternatives,cron.daily,default,init,init.d,iproute2,ld.so.conf.d,logrotate.d,network/if-up.d/} + mkdir -p rootfs/etc/{alternatives,cron.daily,default,init,init.d,ld.so.conf.d,logrotate.d,network/if-up.d/} mkdir -p rootfs/etc/dpkg/dpkg.cfg.d/ mkdir -p rootfs/etc/network/{if-down.d,if-post-down.d,if-pre-up.d,if-up.d,interfaces.d} mkdir -p rootfs/lib/ifupdown/ @@ -299,16 +299,8 @@ function create_cpio { cp_executable tmp/usr/bin/cmp rootfs/usr/bin/ # dosfstools components - cp_executable tmp/sbin/fatlabel rootfs/sbin/ - cp_executable tmp/sbin/fsck.fat rootfs/sbin/ cp_executable tmp/sbin/mkfs.fat rootfs/sbin/ cd rootfs/sbin - ln -s fatlabel dosfslabel - ln -s fsck.fat dosfsck - ln -s fsck.fat fsck.msdos - ln -s fsck.fat fsck.vfat - ln -s mkfs.fat mkdosfs - ln -s mkfs.fat mkfs.msdos ln -s mkfs.fat mkfs.vfat cd ../.. @@ -340,32 +332,9 @@ function create_cpio { # e2fsprogs components cp --preserve=xattr,timestamps tmp/etc/mke2fs.conf rootfs/etc/ - cp_executable tmp/sbin/badblocks rootfs/sbin/ - cp_executable tmp/sbin/debugfs rootfs/sbin/ - cp_executable tmp/sbin/dumpe2fs rootfs/sbin/ - cp_executable tmp/sbin/e2fsck rootfs/sbin/ - cp_executable tmp/sbin/e2image rootfs/sbin/ - cp_executable tmp/sbin/e2undo rootfs/sbin/ - cp_executable tmp/sbin/logsave rootfs/sbin/ cp_executable tmp/sbin/mke2fs rootfs/sbin/ - cp_executable tmp/sbin/resize2fs rootfs/sbin/ - cp_executable tmp/sbin/tune2fs rootfs/sbin/ - cp_executable tmp/usr/bin/chattr rootfs/usr/bin/ - cp_executable tmp/usr/bin/lsattr rootfs/usr/bin/ - cp_executable tmp/usr/sbin/e2freefrag rootfs/usr/sbin/ - cp_executable tmp/usr/sbin/e4defrag rootfs/usr/sbin/ - cp_executable tmp/usr/sbin/filefrag rootfs/usr/sbin/ - cp_executable tmp/usr/sbin/mklost+found rootfs/usr/sbin/ cd rootfs/sbin - ln -s tune2fs e2lablel - ln -s e2fsck fsck.ext2 - ln -s e2fsck fsck.ext3 - ln -s e2fsck fsck.ext4 - ln -s e2fsck fsck.ext4dev - ln -s mke2fs mkfs.ext2 - ln -s mke2fs mkfs.ext3 ln -s mke2fs mkfs.ext4 - ln -s mke2fs mkfs.ext4dev cd ../.. # f2fs-tools components @@ -386,30 +355,6 @@ function create_cpio { # iproute2 components cp_executable tmp/bin/ip rootfs/bin/ - cp_executable tmp/bin/ss rootfs/bin/ - cp --preserve=xattr,timestamps tmp/etc/iproute2/ematch_map rootfs/etc/iproute2/ - cp --preserve=xattr,timestamps tmp/etc/iproute2/group rootfs/etc/iproute2/ - cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_dsfield rootfs/etc/iproute2/ - cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_protos rootfs/etc/iproute2/ - cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_realms rootfs/etc/iproute2/ - cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_scopes rootfs/etc/iproute2/ - cp --preserve=xattr,timestamps tmp/etc/iproute2/rt_tables rootfs/etc/iproute2/ - cp_executable tmp/sbin/bridge rootfs/sbin/ - cp_executable tmp/sbin/rtacct rootfs/sbin/ - cp_executable tmp/sbin/rtmon rootfs/sbin/ - cp_executable tmp/sbin/tc rootfs/sbin/ - cd rootfs/sbin - ln -s ../bin/ip ip - cd ../.. - cp_executable tmp/usr/bin/lnstat rootfs/usr/bin/ - cp_executable tmp/usr/bin/nstat rootfs/usr/bin/ - cp_executable tmp/usr/bin/routef rootfs/usr/bin/ - cp_executable tmp/usr/bin/routel rootfs/usr/bin/ - cd rootfs/usr/bin - ln -s lnstat ctstat - ln -s lnstat rtstat - cd ../../.. - cp_executable tmp/usr/sbin/arpd rootfs/usr/sbin/ # lsb-base components cp --preserve=xattr,timestamps tmp/lib/lsb/init-functions rootfs/lib/lsb/ @@ -436,22 +381,17 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/usr/share/keyrings/*.gpg rootfs/usr/share/keyrings/ # rng-tools5 components - cp_executable tmp/usr/bin/rngtest rootfs/usr/bin/ cp_executable tmp/usr/sbin/rngd rootfs/usr/sbin/ # tar components cp_executable tmp/bin/tar rootfs/bin/ - cp_executable tmp/usr/sbin/tarcat rootfs/usr/sbin/ # fdisk components cp_executable tmp/sbin/fdisk rootfs/sbin/ # util-linux components cp_executable tmp/sbin/blkid rootfs/sbin/ - cp_executable tmp/sbin/blockdev rootfs/sbin/ - cp_executable tmp/sbin/fsck rootfs/sbin/ cp_executable tmp/sbin/mkswap rootfs/sbin/ - cp_executable tmp/sbin/swaplabel rootfs/sbin/ # wpa_supplicant components cp_executable tmp/sbin/wpa_supplicant rootfs/sbin/wpa_supplicant @@ -464,19 +404,7 @@ function create_cpio { cp --preserve=xattr,timestamps tmp/etc/gai.conf rootfs/etc/ cp --preserve=xattr,timestamps tmp/etc/ld.so.conf rootfs/etc/ cp_executable tmp/sbin/ldconfig rootfs/sbin/ - cp_executable tmp/usr/bin/catchsegv rootfs/usr/bin/ - cp_executable tmp/usr/bin/getconf rootfs/usr/bin/ - cp_executable tmp/usr/bin/getent rootfs/usr/bin/ - cp_executable tmp/usr/bin/iconv rootfs/usr/bin/ - cp_executable tmp/usr/bin/ldd rootfs/usr/bin/ - cp_executable tmp/usr/bin/locale rootfs/usr/bin/ - cp_executable tmp/usr/bin/localedef rootfs/usr/bin/ - cp_executable tmp/usr/bin/pldd rootfs/usr/bin/ - cp_executable tmp/usr/bin/tzselect rootfs/usr/bin/ - cp_executable tmp/usr/bin/zdump rootfs/usr/bin/ # lib/locale ? - cp_executable tmp/usr/sbin/iconvconfig rootfs/usr/sbin/ - cp_executable tmp/usr/sbin/zic rootfs/usr/sbin/ cp --preserve=xattr,timestamps tmp/usr/share/libc-bin/nsswitch.conf rootfs/usr/share/libc-bin/ # libc6 components From 7029fcb50fcf4de9c12356c028109db0e87f6d3c Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 12 Jul 2023 09:47:18 +0200 Subject: [PATCH 44/49] build: fix wireless firmware The firmware files in firmware-brcm80211 are now symlinks - copying them with -r parameter results in broken symlinks instead of the real files. Copy them without -r parameter. The cyfmac43455-sdio.bin file comes in two variants (standard, minimal) which are managed by update-alternatives during postinst and thus needed to be symlinked manually. Also add missing firmware files for other Zero 2 W, Compute Module 4 and 400 models. --- build.sh | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 87d51612..c086b14e 100755 --- a/build.sh +++ b/build.sh @@ -411,16 +411,29 @@ function create_cpio { cp_executable tmp/lib/*/libnss_dns.so.* rootfs/lib/arm-linux-gnueabihf/ cp_executable tmp/lib/*/libnss_files.so.* rootfs/lib/arm-linux-gnueabihf/ - # Binary firmware for version 3 Model B wireless + # Binary firmware for version 3 Model B, Zero W wireless mkdir -p rootfs/lib/firmware/brcm - cp --preserve=xattr,timestamps -r tmp/lib/firmware/brcm/brcmfmac43430-sdio.bin rootfs/lib/firmware/brcm/ - cp --preserve=xattr,timestamps -r tmp/lib/firmware/brcm/brcmfmac43430-sdio.txt rootfs/lib/firmware/brcm/ - - # Binary firmware for version 3 Model B+ wireless - mkdir -p rootfs/lib/firmware/brcm - cp --preserve=xattr,timestamps -r tmp/lib/firmware/brcm/brcmfmac43455-sdio.bin rootfs/lib/firmware/brcm/ - cp --preserve=xattr,timestamps -r tmp/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob rootfs/lib/firmware/brcm/ - cp --preserve=xattr,timestamps -r tmp/lib/firmware/brcm/brcmfmac43455-sdio.txt rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43430-sdio.bin rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43430-sdio.txt rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob rootfs/lib/firmware/brcm/ + + # Binary firmware for Zero 2 W wireless + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43436-sdio.bin rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43436-sdio.clm_blob rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43436-sdio.txt rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43436s-sdio.bin rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43436s-sdio.txt rootfs/lib/firmware/brcm/ + + # Binary firmware for version 3 Model A+/B+, 4 Model B wireless + ln -s cyfmac43455-sdio-standard.bin tmp/lib/firmware/cypress/cyfmac43455-sdio.bin + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43455-sdio.bin rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43455-sdio.txt rootfs/lib/firmware/brcm/ + + # Binary firmware for version 4 Compute Module, 400 wireless + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43456-sdio.bin rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43456-sdio.clm_blob rootfs/lib/firmware/brcm/ + cp --preserve=xattr,timestamps tmp/lib/firmware/brcm/brcmfmac43456-sdio.txt rootfs/lib/firmware/brcm/ # vcgencmd ## libraspberrypi-bin From 09a473f999d81aff2c11ee3af4b9414c76a74bd2 Mon Sep 17 00:00:00 2001 From: FooDeas Date: Tue, 15 Aug 2023 20:10:48 +0200 Subject: [PATCH 45/49] doc: update default release --- doc/INSTALL_CUSTOM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/INSTALL_CUSTOM.md b/doc/INSTALL_CUSTOM.md index b71b1734..16f73075 100644 --- a/doc/INSTALL_CUSTOM.md +++ b/doc/INSTALL_CUSTOM.md @@ -19,7 +19,7 @@ | `firmware_packages` | `0` | `0`/`1` | Set to "1" to install common firmware packages (Atheros, Broadcom, Libertas, Ralink and Realtek). | | `mirror` | `http:// mirrordirector.raspbian.org/ raspbian/` or `http:// deb.debian.org/ debian/` | | default value depends on arch | | `mirror_cache` | | | Set address and port for HTTP apt-cacher or apt-cacher-ng (e.g. "192.168.0.1:3142"). If set, the cacher will be used to cache packages during installation downloaded from the repository set in `mirror` as well as "http://archive.raspberrypi.org/debian". | -| `release` | `buster` | | Raspbian release name | +| `release` | `bullseye` | | Raspbian release name | | `arch` | `armhf` | | Raspbian architecture: "armhf" = 32-bit (all Raspberry models), "arm64" = 64-bit (only for Model 3 and up, Zero 2) | ### Description: Presets From a46d84e82ede4f933f5bf5d3ddf3576beb69b6e5 Mon Sep 17 00:00:00 2001 From: FooDeas Date: Tue, 15 Aug 2023 21:06:11 +0200 Subject: [PATCH 46/49] build: fix libs --- build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sh b/build.sh index c086b14e..3254be61 100755 --- a/build.sh +++ b/build.sh @@ -247,8 +247,6 @@ function create_cpio { sed -i "s/__VERSION__/${version_info}/" rootfs/opt/raspberrypi-ua-netinst/install.sh sed -i "s/__DATE__/$(date)/" rootfs/opt/raspberrypi-ua-netinst/install.sh - ln -s arm-linux-gnueabihf/ld-linux-armhf.so.3 rootfs/lib/ld-linux-armhf.so.3 - # btrfs-progs components cp_executable tmp/sbin/mkfs.btrfs rootfs/sbin/ From 96e276cc35410e30c8a91867076deb062ad00814 Mon Sep 17 00:00:00 2001 From: FooDeas Date: Tue, 15 Aug 2023 21:42:13 +0200 Subject: [PATCH 47/49] doc: fix reinstall instruction --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d613a53e..d22e3c93 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ If you want to reinstall with the same settings you did your first install you c Note: If the original installation was performed with `cleanup` set to `1`, then the files necessary for a reinstallation will not be available. ``` -cp /boot/raspberrypi-ua-netinst/reinstall/config.txt /boot/config.txt +cp /boot/raspberrypi-ua-netinst/config.txt /boot/config.txt reboot ``` From 4f0a78f0aa0d03aca4c54bc7377f9a7605d051b2 Mon Sep 17 00:00:00 2001 From: FooDeas Date: Tue, 15 Aug 2023 21:48:34 +0200 Subject: [PATCH 48/49] installer: fix max retries action --- scripts/opt/raspberrypi-ua-netinst/install.sh | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index a8daad1a..46c494f1 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -194,8 +194,8 @@ variables_set_defaults() { } led_sos() { - local led0=/sys/class/leds/led0 # Power LED - local led1=/sys/class/leds/led1 # Activity LED + local led0=/sys/class/leds/PWR # Power LED + local led1=/sys/class/leds/ACT # Activity LED local led_on local led_off @@ -209,32 +209,32 @@ led_sos() { led_off=1 fi - if [ -e /sys/class/leds/led0 ]; then (echo none > /sys/class/leds/led0/trigger || true) &> /dev/null; else led0=; fi - if [ -e /sys/class/leds/led1 ]; then (echo none > /sys/class/leds/led1/trigger || true) &> /dev/null; else led1=; fi + if [ -e "${led0}" ]; then (echo none > "${led0}/trigger" || true) &> /dev/null; else led0=; fi + if [ -e "${led1}" ]; then (echo none > "${led1}/trigger" || true) &> /dev/null; else led1=; fi for i in $(seq 1 3); do - if [ -n "$led0" ]; then (echo ${led_on} > "${led0}"/brightness || true) &> /dev/null; fi - if [ -n "$led1" ]; then (echo ${led_on} > "${led1}"/brightness || true) &> /dev/null; fi + if [ -n "${led0}" ]; then (echo ${led_on} > "${led0}"/brightness || true) &> /dev/null; fi + if [ -n "${led1}" ]; then (echo ${led_on} > "${led1}"/brightness || true) &> /dev/null; fi sleep 0.225s; - if [ -n "$led0" ]; then (echo ${led_off} > "${led0}"/brightness || true) &> /dev/null; fi - if [ -n "$led1" ]; then (echo ${led_off} > "${led1}"/brightness || true) &> /dev/null; fi + if [ -n "${led0}" ]; then (echo ${led_off} > "${led0}"/brightness || true) &> /dev/null; fi + if [ -n "${led1}" ]; then (echo ${led_off} > "${led1}"/brightness || true) &> /dev/null; fi sleep 0.15s; done sleep 0.075s; for i in $(seq 1 3); do - if [ -n "$led0" ]; then (echo ${led_on} > "${led0}"/brightness || true) &> /dev/null; fi - if [ -n "$led1" ]; then (echo ${led_on} > "${led1}"/brightness || true) &> /dev/null; fi + if [ -n "${led0}" ]; then (echo ${led_on} > "${led0}"/brightness || true) &> /dev/null; fi + if [ -n "${led1}" ]; then (echo ${led_on} > "${led1}"/brightness || true) &> /dev/null; fi sleep 0.6s; - if [ -n "$led0" ]; then (echo ${led_off} > "${led0}"/brightness || true) &> /dev/null; fi - if [ -n "$led1" ]; then (echo ${led_off} > "${led1}"/brightness || true) &> /dev/null; fi + if [ -n "${led0}" ]; then (echo ${led_off} > "${led0}"/brightness || true) &> /dev/null; fi + if [ -n "${led1}" ]; then (echo ${led_off} > "${led1}"/brightness || true) &> /dev/null; fi sleep 0.15s; done sleep 0.075s; for i in $(seq 1 3); do - if [ -n "$led0" ]; then (echo ${led_on} > "${led0}"/brightness || true) &> /dev/null; fi - if [ -n "$led1" ]; then (echo ${led_on} > "${led1}"/brightness || true) &> /dev/null; fi + if [ -n "${led0}" ]; then (echo ${led_on} > "${led0}"/brightness || true) &> /dev/null; fi + if [ -n "${led1}" ]; then (echo ${led_on} > "${led1}"/brightness || true) &> /dev/null; fi sleep 0.225s; - if [ -n "$led0" ]; then (echo ${led_off} > "${led0}"/brightness || true) &> /dev/null; fi - if [ -n "$led1" ]; then (echo ${led_off} > "${led1}"/brightness || true) &> /dev/null; fi + if [ -n "${led0}" ]; then (echo ${led_off} > "${led0}"/brightness || true) &> /dev/null; fi + if [ -n "${led1}" ]; then (echo ${led_off} > "${led1}"/brightness || true) &> /dev/null; fi sleep 0.15s; done sleep 1.225s; @@ -291,7 +291,7 @@ fail() { echo " The maximum number of retries is reached!" echo " Check the logfiles for errors. Then delete or edit \"installer-retries.txt\" in installer folder to (re)set the counter." fi - echo " Dropping to shell to prevent an infinite loop." + sleep 3s while true; do led_sos done & From d2f5cca691b0401d210103435f43ea0378c313ea Mon Sep 17 00:00:00 2001 From: FooDeas Date: Tue, 15 Aug 2023 22:23:55 +0200 Subject: [PATCH 49/49] installer: code improvements --- scripts/opt/raspberrypi-ua-netinst/install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/opt/raspberrypi-ua-netinst/install.sh b/scripts/opt/raspberrypi-ua-netinst/install.sh index 46c494f1..5b180e65 100644 --- a/scripts/opt/raspberrypi-ua-netinst/install.sh +++ b/scripts/opt/raspberrypi-ua-netinst/install.sh @@ -1943,7 +1943,7 @@ if [ "${use_systemd_services}" != "0" ]; then if [ "${ip_addr}" = "dhcp" ]; then echo "DHCP=yes" >> ${NETFILE} else - NETPREFIX=$(/bin/busybox ipcalc -p ${ip_addr} ${ip_netmask} | cut -f2 -d=) + NETPREFIX=$(/bin/busybox ipcalc -p "${ip_addr}" "${ip_netmask}" | cut -f2 -d=) { echo "Address=${ip_addr}/${NETPREFIX}" for i in ${ip_nameservers}; do @@ -1968,11 +1968,11 @@ if [ "${use_systemd_services}" != "0" ]; then if [ -e "${wlan_configfile}" ]; then # copy the installer version of `wpa_supplicant.conf` mkdir -p /rootfs/etc/wpa_supplicant - cp "${wlan_configfile}" /rootfs/etc/wpa_supplicant/wpa_supplicant-${ifname}.conf - chmod 600 /rootfs/etc/wpa_supplicant/wpa_supplicant-${ifname}.conf + cp "${wlan_configfile}" "/rootfs/etc/wpa_supplicant/wpa_supplicant-${ifname}.conf" + chmod 600 "/rootfs/etc/wpa_supplicant/wpa_supplicant-${ifname}.conf" fi # enable wpa_supplicant service - ln -s /lib/systemd/system/wpa_supplicant@.service /rootfs/etc/systemd/system/multi-user.target.wants/wpa_supplicant@${ifname}.service + ln -s /lib/systemd/system/wpa_supplicant@.service "/rootfs/etc/systemd/system/multi-user.target.wants/wpa_supplicant@${ifname}.service" rm /rootfs/etc/systemd/system/multi-user.target.wants/wpa_supplicant.service fi