Skip to content

Commit

Permalink
v9.1
Browse files Browse the repository at this point in the history
- Nano Pi R5S/R5C and 6 series | Move to Armbian kernel and bootloader builds
  • Loading branch information
MichaIng committed Feb 4, 2024
1 parent 6a7a63b commit 848944b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 59 deletions.
33 changes: 3 additions & 30 deletions .build/images/dietpi-build
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ 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) iname='NanoPiR5S' HW_ARCH=3 partition_start=16 root_size=880;;
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 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;;
Expand Down Expand Up @@ -258,21 +258,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"

Expand Down Expand Up @@ -310,7 +295,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)
Expand Down Expand Up @@ -338,19 +322,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"
Expand Down
50 changes: 21 additions & 29 deletions .build/images/dietpi-installer
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,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
Expand Down Expand Up @@ -655,14 +655,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
Expand All @@ -679,7 +679,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

Expand Down Expand Up @@ -1083,14 +1083,16 @@ _EOF_
72) model='rockpi-4b' kernel='rockchip64';;
73) model='rockpi-s' kernel='rockchip64';;
74) model='radxa-zero';;
76) model='nanopi-r5s' kernel='rockchip64';;
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
Expand Down Expand Up @@ -1138,10 +1140,17 @@ _EOF_
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[@]}"
(( $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.de "${uboot[@]}"
G_EXEC rm package1.deb package2.deb package3.deb "${uboot[@]}"

elif (( $G_HW_MODEL == 76 ))
then
G_EXEC_OUTPUT=1 G_EXEC curl -fo package.deb "https://dietpi.com/downloads/binaries/linux-u-boot-$model-$branch.deb"
G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb
G_EXEC rm package.deb
fi
# Orange Pi Zero 3 1.5G RAM variant: Install original Orange Pi bootloader
if (( $G_HW_MODEL == 83 )) && (( $HW_VARIANT == 2 ))
Expand Down Expand Up @@ -1281,22 +1290,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
Expand Down Expand Up @@ -1725,7 +1718,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,[email protected],[email protected],[email protected]}
[[ -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
Expand Down Expand Up @@ -1968,8 +1960,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

Expand All @@ -1983,8 +1975,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

Expand Down

0 comments on commit 848944b

Please sign in to comment.