diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index beb1d9eb04..1a4f6fe262 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -127,10 +127,11 @@ case $HW_MODEL in 73) iname='ROCKPiS' HW_ARCH=3 partition_start=16 root_size=880;; 74) iname='RadxaZero' HW_ARCH=3 partition_start=4 root_size=892;; 75) iname='Container' HW_ARCH=${HW_ARCH:-10} root_size=447;; - 76) iname='NanoPiR5S' HW_ARCH=3 root_size=752;; # Special case: Skips image file, partitioning and filesystem generation, but runs debootstrap only! + '76.1') iname='NanoPiR5S' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; + '76.2') iname='NanoPiR5C' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; 77) iname='ROCK3A' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=880;; 78) iname='ROCK5B' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=880;; - 79) iname='NanoPi6' HW_ARCH=3 root_size=752;; # Special case: Skips image file, partitioning and filesystem generation, but runs debootstrap only! + 79) iname='NanoPi6' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=880;; 80) iname='OrangePi5' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=880;; 81) iname='VisionFive2' HW_ARCH=11 root_size=639;; 82) iname='OrangePi5Plus' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=880;; @@ -259,21 +260,6 @@ G_EXIT_CUSTOM(){ [[ -f $OUTPUT_IMG_NAME.img ]] && G_EXEC rm "$OUTPUT_IMG_NAME.img" } -# NanoPi 5/6: Base image download -if [[ $HW_MODEL == 7[69] ]] -then - case $HW_MODEL in - 76) series=5;; - 79) series=6;; - *) :;; - esac - G_EXEC curl -sSfO "https://dietpi.com/downloads/nanopi$series.img.xz" - G_EXEC xz -d "nanopi$series.img.xz" - G_EXEC truncate -s "$(( 140 + $root_size ))M" "nanopi$series.img" - G_EXEC_OUTPUT=1 G_EXEC sgdisk -e "nanopi$series.img" - G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk -fN8 'nanopi$series.img' <<< ',+'" - G_EXEC mv "nanopi$series.img" "$OUTPUT_IMG_NAME.img" -else # Create image file G_EXEC fallocate -l "$((partition_start+efi_size+boot_size+root_size))M" "$OUTPUT_IMG_NAME.img" @@ -311,7 +297,6 @@ else # Set boot flag G_EXEC parted -s "$OUTPUT_IMG_NAME.img" set 1 boot on fi -fi # Create loop device FP_LOOP=$(losetup -f) @@ -339,19 +324,8 @@ cluster_size() # Create and mount filesystems and fstab G_EXEC mkdir rootfs -# - NanoPi 5/6 with base image -if [[ $HW_MODEL == 7[69] ]] -then - FP_ROOT_DEV=8 - G_EXEC_OUTPUT=1 G_EXEC "${afsck[@]}" "${FP_LOOP}p8" - G_EXEC_OUTPUT=1 G_EXEC "${aresize[@]}" "${FP_LOOP}p8" - G_EXEC mount "${FP_LOOP}p8" rootfs - G_EXEC mkdir rootfs/etc - cat << _EOF_ > rootfs/etc/fstab -PARTUUID=$(lsblk -no PARTUUID "${FP_LOOP}p8") / $FSTYPE noatime,lazytime 0 1 -_EOF_ # + EFI partition -elif (( $efi_size )) +if (( $efi_size )) then FP_ROOT_DEV=2 G_EXEC mkfs.fat -F 32 -S 512 -s "$(cluster_size "$efi_size")" "${FP_LOOP}p1" diff --git a/.build/images/dietpi-installer b/.build/images/dietpi-installer old mode 100755 new mode 100644 index 1f63059bb6..159c3eaf53 --- a/.build/images/dietpi-installer +++ b/.build/images/dietpi-installer @@ -405,7 +405,8 @@ _EOF_ '54' ': NanoPi K2' '55' ': NanoPi R2S' '47' ': NanoPi R4S' - '76' ': NanoPi R5S/R5C' + '76.1' ': NanoPi R5S' + '76.2' ': NanoPi R5C' '79' ': NanoPi 6 series' '72.1' ': ROCK 4 (all other variants)' '72.2' ': ROCK 4 SE' @@ -615,7 +616,7 @@ _EOF_ G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot G_EXEC sed --follow-symlinks -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot - elif [[ $G_HW_MODEL =~ ^(12|15|16|40|42|43|44|45|46|47|48|52|54|55|56|57|58|59|60|62|63|64|65|66|67|68|72|73|74|77|78|80|82|83|85|86|87)$ ]] + elif [[ $G_HW_MODEL =~ ^(12|15|16|40|42|43|44|45|46|47|48|52|54|55|56|57|58|59|60|62|63|64|65|66|67|68|72|73|74|76|77|78|79|80|82|83|85|86|87)$ ]] then armbian_repo=1 G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd @@ -656,14 +657,14 @@ setenv rootuuid "true"' /boot/boot.cmd (( $G_HW_MODEL == 15 )) && G_EXEC eval 'echo '\''meson_rng'\'' > /etc/modules-load.d/dietpi-hwrng.conf' # Rockchip 64-bit (configs work with Amlogic OOTB) - elif [[ $G_HW_MODEL =~ ^(42|43|46|47|55|56|58|68|72|73|77|78|80|82|85|86|87)$ ]] + elif [[ $G_HW_MODEL =~ ^(42|43|46|47|55|56|58|68|72|73|76|77|78|79|80|82|85|86|87)$ ]] then G_EXEC sed --follow-symlinks -Ei '/^setenv (kernel|fdt)_addr_r/d' /boot/boot.cmd G_CONFIG_INJECT 'setenv scriptaddr ' 'setenv scriptaddr "0x9000000"' /boot/boot.cmd G_CONFIG_INJECT 'overlay_path=' 'overlay_path=rockchip' /boot/dietpiEnv.txt case $G_HW_MODEL in 73) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3308' /boot/dietpiEnv.txt;; - 78|80|82|85) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3588' /boot/dietpiEnv.txt;; # ToDo: There are multiple other prefixes used in the kernel package, "rock-5b", "rock-5ab", "rockchip" (for fixup), so the boot.cmd need heavy adjustments (eliminate the prefix entirely) to work with all overlays. + 78|79|80|82|85) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3588' /boot/dietpiEnv.txt;; # ToDo: There are multiple other prefixes used in the kernel package, "rock-5b", "rock-5ab", "rockchip" (for fixup), so the boot.cmd need heavy adjustments (eliminate the prefix entirely) to work with all overlays. *) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rockchip' /boot/dietpiEnv.txt;; esac case $G_HW_MODEL in @@ -681,7 +682,7 @@ setenv rootuuid "true"' /boot/boot.cmd case $G_HW_MODEL in 73) G_CONFIG_INJECT 'consoleargs=' 'consoleargs=console=ttyS0,1500000' /boot/dietpiEnv.txt;; # headless 47|55|56) G_CONFIG_INJECT 'consoleargs=' 'consoleargs=console=ttyS2,1500000' /boot/dietpiEnv.txt;; # headless - 78|80|82) G_EXEC sed --follow-symlinks -i 's/ttyAML0,115200/ttyFIQ0,1500000/' /boot/dietpiEnv.txt;; + 78|79|80|82|85) G_EXEC sed --follow-symlinks -i 's/ttyAML0,115200/ttyFIQ0,1500000/' /boot/dietpiEnv.txt;; # RK3588 *) G_EXEC sed --follow-symlinks -i 's/ttyAML0,115200/ttyS2,1500000/' /boot/dietpiEnv.txt;; esac @@ -1089,14 +1090,20 @@ _EOF_ esac;; 73) model='rockpi-s' kernel='rockchip64';; 74) model='radxa-zero';; + 76) kernel='rockchip64';; + case $HW_VARIANT in + 2) model='nanopi-r5c';; + *) model='nanopi-r5s';; + esac;; 77) model='rock-3a' kernel='rockchip64';; 78) model='rock-5b' kernel='rk35xx' branch='legacy';; + 79) model='nanopi-r6s' kernel='rk35xx' branch='legacy';; 80) model='orangepi5' kernel='rk35xx' branch='legacy';; 82) model='orangepi5-plus' kernel='rk35xx' branch='legacy';; 83) model='orangepizero3' kernel='sunxi64';; 85) model='rock-5a' kernel='rk35xx' branch='legacy';; 86) model='tinkerboard-2' kernel='rockchip64';; - 87) model='orangepi3b' kernel='rockchip64'; branch='edge';; + 87) model='orangepi3b' kernel='rockchip64' branch='edge';; *) :;; esac # Download and pre-install U-Boot hosted on dietpi.com where it has not been ported to the Armbian Bookworm repo or has been removed completely @@ -1140,14 +1147,15 @@ _EOF_ G_AGI initramfs-tools u-boot-tools armbian-firmware "${zstd[@]}" [[ ${zstd[0]} ]] && G_CONFIG_INJECT 'COMPRESS=' 'COMPRESS=zstd' /etc/initramfs-tools/initramfs.conf # Download and pre-install kernel hosted on dietpi.com where the Armbian APT repo provides a too old version - if (( ( $G_HW_MODEL == 72 && ${HW_VARIANT:-1} == 2 ) || $G_HW_MODEL == 83 )) + if [[ ( $G_HW_MODEL == 72 && $HW_VARIANT == 2 ) || $G_HW_MODEL =~ ^(76|83)$ ]] then G_EXEC_OUTPUT=1 G_EXEC curl -fo package1.deb "https://dietpi.com/downloads/binaries/linux-image-$branch-$kernel.deb" G_EXEC_OUTPUT=1 G_EXEC curl -fo package2.deb "https://dietpi.com/downloads/binaries/linux-dtb-$branch-$kernel.deb" + G_EXEC_OUTPUT=1 G_EXEC curl -fo package3.deb 'https://dietpi.com/downloads/binaries/armbian-firmware.deb' local uboot=() - (( $HW_VARIANT == 1 )) && { G_EXEC_OUTPUT=1 G_EXEC curl -fo package3.deb "https://dietpi.com/downloads/binaries/linux-u-boot-$model-$branch.deb"; uboot=('package3.deb'); } - G_EXEC_OUTPUT=1 G_EXEC dpkg -i package1.deb package2.deb "${uboot[@]}" - G_EXEC rm package1.deb package2.deb "${uboot[@]}" + [[ ( $G_HW_MODEL =~ ^(72|76)$ && $HW_VARIANT == 2 ) || ( $G_HW_MODEL == 83 && $HW_VARIANT == 1 ) ]] && { G_EXEC_OUTPUT=1 G_EXEC curl -fo package4.deb "https://dietpi.com/downloads/binaries/linux-u-boot-$model-$branch.deb"; uboot=('package4.deb'); } + G_EXEC_OUTPUT=1 G_EXEC dpkg -i package1.deb package2.deb package3.deb "${uboot[@]}" + G_EXEC rm package1.deb package2.deb package3.deb "${uboot[@]}" fi # Orange Pi Zero 3 1.5G RAM variant: Install original Orange Pi bootloader if (( $G_HW_MODEL == 83 )) && (( $HW_VARIANT == 2 )) @@ -1286,22 +1294,6 @@ _EOF_ G_EXEC rm package.deb aPACKAGES_REQUIRED_INSTALL+=("firmware-$variant") - # NanoPi R5S/R5C - elif (( $G_HW_MODEL == 76 )) && { [[ ! $(find /lib/modules -mindepth 1 -maxdepth 1 -type d) ]] || dpkg-query -s 'firmware-nanopi5' &> /dev/null; } - then - G_EXEC curl -sSfo package.deb 'https://dietpi.com/downloads/binaries/firmware-nanopi5.deb' - G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb - G_EXEC rm package.deb - aPACKAGES_REQUIRED_INSTALL+=('firmware-nanopi5') - - # NanoPi 6 - elif (( $G_HW_MODEL == 79 )) && { [[ ! $(find /lib/modules -mindepth 1 -maxdepth 1 -type d) ]] || dpkg-query -s 'firmware-nanopi6' &> /dev/null; } - then - G_EXEC curl -sSfo package.deb 'https://dietpi.com/downloads/binaries/firmware-nanopi6.deb' - G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb - G_EXEC rm package.deb - aPACKAGES_REQUIRED_INSTALL+=('firmware-nanopi6') - # NanoPi M2/T2/Fire2 Linux 4.4: Requires dedicated boot partition, starting at 4 MiB for U-Boot, with ext4 filesystem elif [[ $G_HW_MODEL == 61 && $(findmnt -Ufnro FSTYPE -M /boot) == 'ext4' ]] && (( $(sfdisk -qlo Start "$BOOT_DEVICE" | mawk 'NR==2') >= 8192 )) then @@ -1730,7 +1722,6 @@ _EOF_ # - FriendlyELEC [[ -f 'usr/bin/lcd2usb_print' ]] && G_EXEC rm /usr/bin/lcd2usb_print - (( $G_HW_MODEL == 76 )) && G_EXEC rm -Rf /data /sdcard /udisk /oem /userdata /system /vendor /mnt/{sdcard,external_sd,usb_storage,udisk} /etc/systemd/system/{boot-complete.target.requires,ctrl-alt-del.target,wpa_supplicant-nl80211@.service,wpa_supplicant-wired@.service,wpa_supplicant@.service} [[ -f '/usr/local/bin/cputemp.sh' ]] && G_EXEC rm /usr/local/bin/cputemp.sh [[ -f '/usr/local/bin/drm-hotplug.sh' ]] && G_EXEC rm /usr/local/bin/drm-hotplug.sh [[ -f '/usr/local/bin/setup-net-smp.sh' ]] && G_EXEC rm /usr/local/bin/setup-net-smp.sh @@ -1973,8 +1964,8 @@ _EOF_' /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttySAC0 /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyGS0 - # ROCKPro64, ROCK64, Pinebook Pro, NanoPi R4S, Quartz64, ASUS Tinker Board, NanoPi R2S, NanoPi NEO3, NanoPi M4V2, NanoPi M4/T4/NEO4, ROCK 4, ROCK 3A, ASUS Tinker Board 2 - elif [[ $G_HW_MODEL =~ ^(42|43|46|47|49|52|55|56|58|68|72|77|86|87)$ ]] + # ROCKPro64, ROCK64, Pinebook Pro, NanoPi R4S, Quartz64, ASUS Tinker Board, NanoPi R2S, NanoPi NEO3, NanoPi M4V2, NanoPi M4/T4/NEO4, ROCK 4, NanoPi R5S/R5C, ROCK 3A, ASUS Tinker Board 2, Orange Pi 3B + elif [[ $G_HW_MODEL =~ ^(42|43|46|47|49|52|55|56|58|68|72|76|77|86|87)$ ]] then /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyS2 @@ -1988,8 +1979,8 @@ _EOF_' then /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyS1 - # NanoPi R5S/R5C, ROCK 5B, NanoPi 6, Orange Pi 5, Orange Pi 5 Plus, ROCK 5A - elif [[ $G_HW_MODEL =~ ^(76|78|79|80|82|85)$ ]] + # RK3588: ROCK 5B, NanoPi 6, Orange Pi 5, Orange Pi 5 Plus, ROCK 5A + elif [[ $G_HW_MODEL =~ ^(78|79|80|82|85)$ ]] then /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyFIQ0 @@ -2160,15 +2151,24 @@ _EOF_ SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" SUBSYSTEM=="leds", KERNEL=="lan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" _EOF_ - # NanoPi R5S/R5C: In case, will be updated for R5C on first boot - elif (( $G_HW_MODEL == 76 )) + # NanoPi R5S + elif [[ $G_HW_MODEL == 76 && $HW_VARIANT == 1 ]] then - G_DIETPI-NOTIFY 2 'Enabling NanoPi R5S/R5C Ethernet LEDs' + G_DIETPI-NOTIFY 2 'Enabling NanoPi R5S Ethernet LEDs' G_EXEC eval 'echo '\''ledtrig-netdev'\'' > /etc/modules-load.d/dietpi-eth-leds.conf' cat << '_EOF_' > /etc/udev/rules.d/dietpi-eth-leds.rules -SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" -SUBSYSTEM=="leds", KERNEL=="lan1_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" -SUBSYSTEM=="leds", KERNEL=="lan2_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth2", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth2", RUN+="/bin/ip l s down dev eth2" +SUBSYSTEM=="leds", KERNEL=="green:lan-1", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" +SUBSYSTEM=="leds", KERNEL=="green:lan-2", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" +SUBSYSTEM=="leds", KERNEL=="green:wan", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth2", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth2", RUN+="/bin/ip l s down dev eth2" +_EOF_ + # NanoPi R5C + elif [[ $G_HW_MODEL == 76 && $HW_VARIANT == 2 ]] + then + G_DIETPI-NOTIFY 2 'Enabling NanoPi R5C Ethernet LEDs' + G_EXEC eval 'echo '\''ledtrig-netdev'\'' > /etc/modules-load.d/dietpi-eth-leds.conf' + cat << '_EOF_' > /etc/udev/rules.d/dietpi-eth-leds.rules +SUBSYSTEM=="leds", KERNEL=="green:lan", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" +SUBSYSTEM=="leds", KERNEL=="green:wan", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" _EOF_ # NanoPi 6: These match for R6S and in case will be updated for R6C or NanoPC T6 on first boot, based on /proc/device-tree/model. elif (( $G_HW_MODEL == 79 )) diff --git a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash index 1318f83024..80b9105474 100755 --- a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash +++ b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash @@ -104,17 +104,12 @@ then RPi_Set_Clock_Speeds - # NanoPi R5S/R5C/R6S/R6C/T6: Update udev rules for variants - elif [[ $G_HW_MODEL == 7[69] && -f '/proc/device-tree/model' ]] + # NanoPi R6S/R6C/T6: Update udev rules for variants + elif [[ $G_HW_MODEL == 79 && -f '/proc/device-tree/model' ]] then local variant read -r variant < /proc/device-tree/model case $variant in - *'R5C'*) cat << '_EOF_' > /etc/udev/rules.d/dietpi-eth-leds.rules -SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0; /bin/ip l s down dev eth0" -SUBSYSTEM=="leds", KERNEL=="lan1_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1; /bin/ip l s down dev eth1" -_EOF_ - ;; *'R6C'*) cat << '_EOF_' > /etc/udev/rules.d/dietpi-eth-leds.rules SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0; /bin/ip l s down dev eth0" SUBSYSTEM=="leds", KERNEL=="lan1_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1; /bin/ip l s down dev eth1"