From 43dff877cf91ebfc7bda0fc1e9b9f8c90d9e8879 Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 28 Oct 2024 02:37:33 +0000 Subject: [PATCH] split sbc into 3 profiles, gpt, mbr, and rpi --- README.md | 3 ++- components/users.xml | 2 +- config.xml | 2 +- configs/rocky-sbc-genericarm-gpt.xml | 2 +- configs/rocky-sbc-genericarm-mbr.xml | 2 +- configs/rocky-sbc-genericarm.xml | 27 ------------------- configs/rocky-sbc-raspberrypi.xml | 2 +- repositories/gnulab-tmp.xml | 3 +++ rootfs-expand | 29 +++++++++++++++++++++ sbc-build.sh | 16 +++++++++--- sbc/pi.xml | 39 ---------------------------- sbc/sbc-gpt.xml | 1 + sbc/sbc-mbr.xml | 1 + 13 files changed, 53 insertions(+), 76 deletions(-) delete mode 100644 configs/rocky-sbc-genericarm.xml create mode 100644 rootfs-expand diff --git a/README.md b/README.md index 8b57619..dac62f4 100644 --- a/README.md +++ b/README.md @@ -145,5 +145,6 @@ mock environment. ``` % bash live-build.sh --live-image XFCE --output-dir /builddir/xfce ``` - +#### SBC Images +Profiles choices include "GenericArm-GPT", "GenericArm-MBR", "RaspberryPi" diff --git a/components/users.xml b/components/users.xml index f5f9970..afdcc22 100644 --- a/components/users.xml +++ b/components/users.xml @@ -6,7 +6,7 @@ --> - + diff --git a/config.xml b/config.xml index 8bd2f1d..8ec2057 120000 --- a/config.xml +++ b/config.xml @@ -1 +1 @@ -configs/rocky.xml \ No newline at end of file +configs/rocky-sbc-genericarm-gpt.xml \ No newline at end of file diff --git a/configs/rocky-sbc-genericarm-gpt.xml b/configs/rocky-sbc-genericarm-gpt.xml index 73bc796..e630652 100644 --- a/configs/rocky-sbc-genericarm-gpt.xml +++ b/configs/rocky-sbc-genericarm-gpt.xml @@ -1,6 +1,6 @@ - + Release Engineering (SIG/Core) releng@rockylinux.org diff --git a/configs/rocky-sbc-genericarm-mbr.xml b/configs/rocky-sbc-genericarm-mbr.xml index 3dd21be..c352606 100644 --- a/configs/rocky-sbc-genericarm-mbr.xml +++ b/configs/rocky-sbc-genericarm-mbr.xml @@ -1,6 +1,6 @@ - + Release Engineering (SIG/Core) releng@rockylinux.org diff --git a/configs/rocky-sbc-genericarm.xml b/configs/rocky-sbc-genericarm.xml deleted file mode 100644 index 6348717..0000000 --- a/configs/rocky-sbc-genericarm.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Release Engineering (SIG/Core) - releng@rockylinux.org - Rocky Linux - - - 9 - dnf - en_US - us - UTC - 9 - - - - - - - - - - - - diff --git a/configs/rocky-sbc-raspberrypi.xml b/configs/rocky-sbc-raspberrypi.xml index 7bc17b5..be3ad3e 100644 --- a/configs/rocky-sbc-raspberrypi.xml +++ b/configs/rocky-sbc-raspberrypi.xml @@ -1,6 +1,6 @@ - + Release Engineering (SIG/Core) releng@rockylinux.org diff --git a/repositories/gnulab-tmp.xml b/repositories/gnulab-tmp.xml index 0546c79..eca8929 100644 --- a/repositories/gnulab-tmp.xml +++ b/repositories/gnulab-tmp.xml @@ -6,4 +6,7 @@ + + + diff --git a/rootfs-expand b/rootfs-expand new file mode 100644 index 0000000..aeeff6f --- /dev/null +++ b/rootfs-expand @@ -0,0 +1,29 @@ +#!/bin/bash +clear +part=$(mount |grep '^/dev.* / ' |awk '{print $1}') +if [ -z "\$part" ];then + echo "Error detecting rootfs" + exit -1 +fi +dev=$(echo $part|sed 's/[0-9]*$//g') +devlen=${#dev} +num=${part:$devlen} +if [[ "$dev" =~ ^/dev/(mmcblk|nvme[0-9]+n)[0-9]*p$ ]];then + dev=${dev:0:-1} +fi +if [ ! -x /usr/bin/growpart ];then + echo "Please install cloud-utils-growpart (sudo yum install cloud-utils-growpart)" + exit -2 +fi +if [ ! -x /usr/sbin/resize2fs ];then + echo "Please install e2fsprogs (sudo yum install e2fsprogs)" + exit -3 +fi +echo $part $dev $num + +echo "Extending partition $num to max size ...." +growpart $dev $num +echo "Resizing ext4 filesystem ..." +resize2fs $part +echo "Done." +df -h |grep $part diff --git a/sbc-build.sh b/sbc-build.sh index 5723447..06b547d 100755 --- a/sbc-build.sh +++ b/sbc-build.sh @@ -80,19 +80,27 @@ function switch_repo_to_peridot() { } function main() { - /bin/rm config.xml + if [[ -e config.xml ]]; then + /bin/rm config.xml + fi if [ ! -f "configs/rocky-sbc-${SBC,,}.xml" ]; then echo "${LIVE} was not found. Is it supported?" exit 42 fi - ln -sf "configs/rocky-sbc-${SBC,,}.xml" config.xml + #ln -sf "configs/rocky-sbc-${SBC,,}.xml" config.xml if [ -n "$PERIDOTID" ]; then switch_repo_to_peridot "${PERIDOTID}" fi - + if [[ $SBC == "GenericArm-GPT" ]]; then + ln -s configs/rocky-sbc-genericarm-gpt.xml config.xml + elif [[ $SBC == "GenericArm-MBR" ]]; then + ln -s configs/rocky-sbc-genericarm-mbr.xml config.xml + else + ln -s configs/rocky-sbc-raspberrypi.xml config.xml + fi # shellcheck disable=SC2086 - kiwi-ng $DEBUG --type="oem" --profile="SBC-$SBC" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR" + kiwi-ng $DEBUG --type="oem" --profile="SBC-$SBC" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR" } main diff --git a/sbc/pi.xml b/sbc/pi.xml index bd0e32a..e0c8e45 100644 --- a/sbc/pi.xml +++ b/sbc/pi.xml @@ -6,9 +6,6 @@ - - - @@ -28,25 +25,6 @@ - - - - false - true - true - 500 - - - 3 - - - @@ -62,25 +40,8 @@ - - - - - - - - - - - - - - - - - diff --git a/sbc/sbc-gpt.xml b/sbc/sbc-gpt.xml index 803a490..a7a7d4e 100644 --- a/sbc/sbc-gpt.xml +++ b/sbc/sbc-gpt.xml @@ -50,5 +50,6 @@ + diff --git a/sbc/sbc-mbr.xml b/sbc/sbc-mbr.xml index 38b1200..dc618fb 100644 --- a/sbc/sbc-mbr.xml +++ b/sbc/sbc-mbr.xml @@ -51,5 +51,6 @@ +