Skip to content

Commit

Permalink
Merge branch 'dev' into fix/calico
Browse files Browse the repository at this point in the history
  • Loading branch information
disconn3ct authored Sep 6, 2024
2 parents 2113e83 + e7131f8 commit 1f846f1
Show file tree
Hide file tree
Showing 17 changed files with 884 additions and 86 deletions.
410 changes: 410 additions & 0 deletions .build/images/VisionFive2/visionfive2_defconfig

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions .build/images/dietpi-build
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
##########################################
# Load DietPi-Globals
##########################################
Error_Exit(){ G_DIETPI-NOTIFY 1 "$1, aborting ..."; exit 1; }
if [[ -f '/boot/dietpi/func/dietpi-globals' ]]
then
. /boot/dietpi/func/dietpi-globals
else
curl -sSf "https://raw.githubusercontent.com/${G_GITOWNER:=MichaIng}/DietPi/${G_GITBRANCH:=master}/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || exit 1
curl -sSf "https://raw.githubusercontent.com/${G_GITOWNER:=MichaIng}/DietPi/${G_GITBRANCH:=master}/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || Error_Exit 'Failed to download DietPi-Globals'
# shellcheck disable=SC1091
. /tmp/dietpi-globals
G_EXEC rm /tmp/dietpi-globals
Expand Down Expand Up @@ -91,8 +92,8 @@ case $HW_MODEL in
0) iname='RPi' HW_ARCH=${HW_ARCH:-1} boot_size=128 root_size=895;;
1) iname='RPi1' HW_ARCH=1 boot_size=128 root_size=895;;
2) iname='RPi2' HW_ARCH=2 boot_size=128 root_size=895;;
4) iname='RPi234' HW_ARCH=3 boot_size=128 root_size=895;;
5) iname='RPi5' HW_ARCH=3 boot_size=128 root_size=895;;
4) iname='RPi234' HW_ARCH=3 boot_size=128 root_size=1000;;
5) iname='RPi5' HW_ARCH=3 boot_size=128 root_size=1000;;
10) iname='OdroidC1' HW_ARCH=2 partition_start=4 boot_size=128 root_size=700 boot_fstype='fat16';;
11) iname='OdroidXU4' HW_ARCH=2 partition_start=4 root_size=800;;
12) iname='OdroidC2' HW_ARCH=3 partition_start=4 root_size=1148;;
Expand Down Expand Up @@ -612,7 +613,8 @@ _EOF_
G_CONFIG_INJECT 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=' 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=0' rootfs/boot/dietpi.txt

# Force ARMv6 arch on Raspbian
(( $HW_ARCH == 1 )) && echo 'sed --follow-symlinks -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh
# shellcheck disable=SC2015
(( $HW_ARCH > 1 )) || { echo -e '#/bin/dash\n[ "$*" = -m ] && echo armv6l || /usr/bin/uname "$@"' > rootfs/usr/local/bin/uname && G_EXEC chmod +x rootfs/usr/local/bin/uname; } || Error_Exit 'Failed to generate /usr/local/bin/uname for ARMv6'

# Skip filesystem expansion
G_EXEC rm rootfs/etc/systemd/system/local-fs.target.wants/dietpi-fs_partition_resize.service
Expand Down Expand Up @@ -672,8 +674,6 @@ G_EXEC rm /etc/bashrc.d/00-dietpi-build.sh /boot/Automation_Custom_Script.sh
poweroff
}
_EOF_
(( $HW_ARCH == 1 )) && G_EXEC sed --follow-symlinks -i 's/Custom_Script/Custom_{Pre,}Script/' rootfs/boot/Automation_Custom_Script.sh

# Start container
# - Bind mounts required to allow container reading its own drive info, /dev/disk for GRUB and probably other tools to detect UUIDs
# - Skip for container images
Expand All @@ -688,6 +688,9 @@ _EOF_
# Reset IPv4 network connectivity check setting
G_CONFIG_INJECT 'CONFIG_CHECK_CONNECTION_IP=' 'CONFIG_CHECK_CONNECTION_IP=9.9.9.9' rootfs/boot/dietpi.txt

# Revert ARMv6 Workaround
(( $HW_ARCH == 1 )) && G_EXEC rm rootfs/usr/local/bin/uname

# Revert workaround for skipped autologin in emulated Trixie/Sid containers: https://gitlab.com/qemu-project/qemu/-/issues/1962
(( $DISTRO == 8 )) && G_EXEC rm rootfs/etc/systemd/system/{multi-user.target.wants/,}dietpi-automation.service

Expand Down
4 changes: 2 additions & 2 deletions .build/images/dietpi-imager
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
Run_fsck

# Shrink last filesystem to minimum
local last_part_dev=$(lsblk -rnpo NAME "$FP_SOURCE"?* | tail -1)
local last_part_dev=$(lsblk -rnpo NAME "$FP_SOURCE" | tail -1)
local last_fs_type=$(lsblk -no FSTYPE "$last_part_dev")
if [[ $last_fs_type == 'ext4' ]]
then
Expand Down Expand Up @@ -753,7 +753,7 @@ _EOF_
# Move GPT backup partition table to end of drive
if [[ $CLONING_TOOL != 'Clonezilla' && $PART_TABLE_TYPE == 'gpt' ]]
then
G_EXEC_DESC='Moving GPT backup partition table to end of drive' G_EXEC_OUTPUT=1 G_EXEC sgdisk -e "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT"
G_EXEC_DESC='Re-creating GPT backup partition table and header at end of image' G_EXEC_OUTPUT=1 G_EXEC sgdisk -e "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT"
G_EXEC sync
fi

Expand Down
68 changes: 41 additions & 27 deletions .build/images/dietpi-installer
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,11 @@ _EOF_
#------------------------------------------------------------------------------------------------

G_EXEC_DESC='Downloading source code' G_EXEC curl -sSfLO "https://github.com/$G_GITOWNER/DietPi/archive/$G_GITBRANCH.tar.gz"
[[ -d DietPi-$G_GITBRANCH ]] && G_EXEC_DESC='Removing old source code' G_EXEC rm -R "DietPi-$G_GITBRANCH"
G_EXEC_DESC='Unpacking source code' G_EXEC tar xf "$G_GITBRANCH.tar.gz"
G_EXEC_DESC='Removing unused files' G_EXEC rm -f "$G_GITBRANCH.tar.gz" "DietPi-$G_GITBRANCH/dietpi/"{pre-patch_file,patch_file,server_version-6}
G_EXEC_DESC='Hardening source code mode' G_EXEC chmod -R g-w "DietPi-$G_GITBRANCH"
local dir="DietPi-${G_GITBRANCH//\//-}" # GitHub translates forward slashes into dashes
[[ -d $dir ]] && G_EXEC_DESC='Removing old source code' G_EXEC rm -R "$dir"
G_EXEC_DESC='Unpacking source code' G_EXEC tar xf "${G_GITBRANCH##*/}.tar.gz" # Support for Git branch names with forward slashes
G_EXEC_DESC='Removing unused files' G_EXEC rm -f "${G_GITBRANCH##*/}.tar.gz" "$dir/"{pre-patch_file,patch_file,server_version-6}
G_EXEC_DESC='Hardening update archive mode' G_EXEC chmod -R g-w "$dir"

[[ -d '/boot' ]] || G_EXEC mkdir /boot

Expand All @@ -605,9 +606,9 @@ _EOF_
then
G_EXEC ln -sf firmware/cmdline.txt /boot/cmdline.txt
G_EXEC ln -sf firmware/config.txt /boot/config.txt
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/RPi/config.txt" /boot/firmware/
G_EXEC mv "$dir/.build/images/RPi/config.txt" /boot/firmware/
else
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/RPi/config.txt" /boot/
G_EXEC mv "$dir/.build/images/RPi/config.txt" /boot/
fi
echo "root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /) rootfstype=$(findmnt -Ufnro FSTYPE -M /) rootwait net.ifnames=0 logo.nologo console=serial0,115200 console=tty1" > /boot/cmdline.txt
# Boot in 64-bit mode if this is a 64-bit image
Expand All @@ -618,26 +619,26 @@ _EOF_
armbian_packages=1
local model='OdroidC1'
(( $G_HW_MODEL == 11 )) && model='OdroidXU4'
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/$model/boot.ini" /boot/boot.ini
G_EXEC mv "$dir/.build/images/$model/boot.ini" /boot/boot.ini
G_EXEC sed --follow-symlinks -i "s/root=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini
G_EXEC sed --follow-symlinks -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/boot.ini
G_EXEC mkdir -p /etc/kernel/post{inst,rm}.d /etc/initramfs/post-update.d
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup
G_EXEC mv "$dir/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup
G_EXEC ln -sf /etc/kernel/post{inst,rm}.d/dietpi-initramfs_cleanup
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot
G_EXEC mv "$dir/.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|76|77|78|79|80|82|83|85|86|87|88|89|90)$ ]]
then
armbian_packages=1
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpiEnv.txt" /boot/dietpiEnv.txt
G_EXEC mv "$dir/.build/images/U-Boot/boot.cmd" /boot/boot.cmd
G_EXEC mv "$dir/.build/images/U-Boot/dietpiEnv.txt" /boot/dietpiEnv.txt
G_CONFIG_INJECT 'rootdev=' "rootdev=UUID=$(findmnt -Ufnro UUID -M /)" /boot/dietpiEnv.txt
G_CONFIG_INJECT 'rootfstype=' "rootfstype=$(findmnt -Ufnro FSTYPE -M /)" /boot/dietpiEnv.txt
G_EXEC mkdir -p /etc/kernel/post{inst,rm}.d /etc/initramfs/post-update.d
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup
G_EXEC mv "$dir/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup
G_EXEC ln -sf /etc/kernel/post{inst,rm}.d/dietpi-initramfs_cleanup
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot
G_EXEC mv "$dir/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot
# Odroid C2: Fix USB device detection: https://github.com/MichaIng/DietPi/issues/5963
if (( $G_HW_MODEL == 12 ))
then
Expand Down Expand Up @@ -787,29 +788,34 @@ setenv rootuuid "true"' /boot/boot.cmd
# NanoPi M3/T3/Fire3 (64-bit)
elif (( $G_HW_MODEL == 62 ))
then
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/NanoPiM3/boot.cmd" /boot/boot.cmd
G_EXEC mv "$dir/.build/images/NanoPiM3/boot.cmd" /boot/boot.cmd
G_EXEC sed --follow-symlinks -i '/overlay/d' /boot/dietpiEnv.txt
G_EXEC sed --follow-symlinks -i 's/ttyAML0/ttySAC0/' /boot/dietpiEnv.txt
# Device tree
case $HW_VARIANT in
2) G_CONFIG_INJECT 'fdtfile=' 'fdtfile=s5p6818-nanopi-fire3.dtb' /boot/dietpiEnv.txt;;
*) G_CONFIG_INJECT 'fdtfile=' 'fdtfile=s5p6818-nanopi-m3.dtb' /boot/dietpiEnv.txt;;
esac
fi
fi

# shellcheck disable=SC2016
[[ -f '/etc/initramfs/post-update.d/99-dietpi-uboot' && $(findmnt -t vfat -M /boot) ]] && G_EXEC sed --follow-symlinks -i '/^ln -s/c\mv -v "/boot/uInitrd-$1" /boot/uInitrd' /etc/initramfs/post-update.d/99-dietpi-uboot # FAT does not support symlinks

G_EXEC mv "DietPi-$G_GITBRANCH/dietpi.txt" /boot/
G_EXEC mv "DietPi-$G_GITBRANCH/README.md" /boot/dietpi-README.md
G_EXEC mv "DietPi-$G_GITBRANCH/LICENSE" /boot/dietpi-LICENSE.txt
G_EXEC mv "$dir/dietpi.txt" /boot/
G_EXEC mv "$dir/README.md" /boot/dietpi-README.md
G_EXEC mv "$dir/LICENSE" /boot/dietpi-LICENSE.txt

# Reading version string for later use
# shellcheck source=.update/version source=/boot/dietpi/.version
. "DietPi-$G_GITBRANCH/.update/version"
. "$dir/.update/version"
G_DIETPI_VERSION_CORE=$G_REMOTE_VERSION_CORE
G_DIETPI_VERSION_SUB=$G_REMOTE_VERSION_SUB
G_DIETPI_VERSION_RC=$G_REMOTE_VERSION_RC

G_EXEC_DESC='Copy DietPi scripts to /boot/dietpi' G_EXEC cp -a "DietPi-$G_GITBRANCH/dietpi" /boot/
G_EXEC_DESC='Copy DietPi system files in place' G_EXEC cp -a "DietPi-$G_GITBRANCH/rootfs/." /
G_EXEC_DESC='Clean download location' G_EXEC rm -R "DietPi-$G_GITBRANCH"
G_EXEC_DESC='Copy DietPi scripts to /boot/dietpi' G_EXEC cp -a "$dir/dietpi" /boot/
G_EXEC_DESC='Copy DietPi system files in place' G_EXEC cp -a "$dir/rootfs/." /
G_EXEC_DESC='Clean download location' G_EXEC rm -R "$dir"

G_DIETPI-NOTIFY 2 'Storing DietPi version info:'
G_CONFIG_INJECT 'DEV_GITBRANCH=' "DEV_GITBRANCH=$G_GITBRANCH" /boot/dietpi.txt
Expand Down Expand Up @@ -1049,15 +1055,23 @@ setenv rootuuid "true"' /boot/boot.cmd
[[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~'

# Remove obsolete lists
find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -v {} +
find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -Rv {} +

# Armbian base images: Downgrade base-files package to the version provided by Debian
dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20 && G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian'
if dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20
then
G_DIETPI-NOTIFY 2 'Enforcing downgrade of Armbian'\''s base-files package to Debian'\''s'
cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian-tmp
Package: base-files
Pin: release o=Debian
Pin-Priority: 1000
_EOF_
G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian'
fi

# Select kernel, device tree and U-Boot packages
local model='odroidn2' kernel='meson64' arch='arm64' branch='current' zstd=()
case $G_HW_MODEL in
10) model='odroidc1' kernel='meson' arch='arm';;
10) model='odroidc1' kernel='meson' arch='arm' branch='edge';;
11) model='odroidxu4' kernel='odroidxu4' arch='arm';;
12) model='odroidc2';;
16) model='odroidc4';;
Expand Down Expand Up @@ -1263,7 +1277,7 @@ _EOF_
# tiny-initramfs to satisfy dependency: https://github.com/RPi-Distro/repo/issues/358
G_AGI raspi-firmware
G_CONFIG_INJECT 'SKIP_INITRAMFS_GEN=' 'SKIP_INITRAMFS_GEN=yes' /etc/default/raspi-firmware
G_AGI "${kernel[@]}" raspi-utils raspberrypi-sys-mods raspberrypi-archive-keyring "${a32bit[@]}" tiny-initramfs
G_AGI "${kernel[@]}" raspi-utils-core raspberrypi-sys-mods raspberrypi-archive-keyring "${a32bit[@]}" tiny-initramfs
G_EXEC apt-mark auto tiny-initramfs
G_EXEC rm -f /boot/initrd.img-* /boot/firmware/initramfs*
else
Expand Down Expand Up @@ -1401,7 +1415,7 @@ _EOF_
[[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~'

# Remove obsolete components from Armbian list and connect via HTTPS
find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -v {} +
find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -Rv {} +
G_EXEC eval "echo 'deb https://apt.armbian.com ${DISTRO_TARGET_NAME/bullseye/bookworm} main' > /etc/apt/sources.list.d/dietpi-armbian.list"

# Skip creating kernel symlinks and remove existing ones
Expand Down
3 changes: 2 additions & 1 deletion .build/software/Amiberry/container_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ G_EXEC mkdir rootfs
G_EXEC mount "${FP_LOOP}p1" rootfs

# Enforce ARMv6 arch on Raspbian
(( $arch > 1 )) || echo 'sed --follow-symlinks -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh || Error_Exit 'Failed to generate Automation_Custom_PreScript.sh'
# shellcheck disable=SC2015
(( $arch > 1 )) || { echo -e '#/bin/dash\n[ "$*" = -m ] && echo armv6l || /usr/bin/uname "$@"' > rootfs/usr/local/bin/uname && G_EXEC chmod +x rootfs/usr/local/bin/uname; } || Error_Exit 'Failed to generate /usr/local/bin/uname for ARMv6'

# Enable automated setup
G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt
Expand Down
3 changes: 2 additions & 1 deletion .build/software/dietpi-software-build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ G_EXEC mkdir rootfs
G_EXEC mount "${FP_LOOP}p1" rootfs

# Enforce ARMv6 arch on Raspbian
(( $arch > 1 )) || echo 'sed --follow-symlinks -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh || Error_Exit 'Failed to generate Automation_Custom_PreScript.sh'
# shellcheck disable=SC2015
(( $arch > 1 )) || { echo -e '#/bin/dash\n[ "$*" = -m ] && echo armv6l || /usr/bin/uname "$@"' > rootfs/usr/local/bin/uname && G_EXEC chmod +x rootfs/usr/local/bin/uname; } || Error_Exit 'Failed to generate /usr/local/bin/uname for ARMv6'

# Enable automated setup
G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/dietpi-software.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
##########################################
# Load DietPi-Globals
##########################################
Error_Exit(){ G_DIETPI-NOTIFY 1 "$1, aborting ..."; exit 1; }
if [[ -f '/boot/dietpi/func/dietpi-globals' ]]
then
. /boot/dietpi/func/dietpi-globals
else
curl -sSf "https://raw.githubusercontent.com/${G_GITOWNER:=MichaIng}/DietPi/${G_GITBRANCH:=master}/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || exit 1
curl -sSf "https://raw.githubusercontent.com/${G_GITOWNER:=MichaIng}/DietPi/${G_GITBRANCH:=master}/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || Error_Exit 'Failed to download DietPi-Globals'
# shellcheck disable=SC1091
. /tmp/dietpi-globals
G_EXEC rm /tmp/dietpi-globals
Expand Down Expand Up @@ -318,7 +319,8 @@ G_EXEC mkdir rootfs
G_EXEC mount "${FP_LOOP}p1" rootfs

# Force ARMv6 arch on Raspbian
(( $arch == 1 )) && G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/iG_EXEC sed -i -e '\''/^G_HW_ARCH=/cG_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/cG_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' rootfs/boot/dietpi/dietpi-login
# shellcheck disable=SC2015
(( $arch > 1 )) || { echo -e '#/bin/dash\n[ "$*" = -m ] && echo armv6l || /usr/bin/uname "$@"' > rootfs/usr/local/bin/uname && G_EXEC chmod +x rootfs/usr/local/bin/uname; } || Error_Exit 'Failed to generate /usr/local/bin/uname for ARMv6'

# Force RPi on ARM systems if requested
if [[ $RPI == 'true' ]] && (( $arch < 10 ))
Expand Down
Loading

0 comments on commit 1f846f1

Please sign in to comment.