From 764a527bffd1d5045cf9547aaab28ef49f4a5bc1 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Sat, 4 May 2024 01:32:56 -0700 Subject: [PATCH] try genericarm instead --- config.sh | 80 +++++++++++++++++++++++++++++++ sbc/editbootinstall_genericarm.sh | 36 ++++++++++++++ sbc/pi.xml | 37 ++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 sbc/editbootinstall_genericarm.sh diff --git a/config.sh b/config.sh index d30f546..4a5ae56 100644 --- a/config.sh +++ b/config.sh @@ -718,6 +718,83 @@ console=ttyAMA0,115200 console=tty1 root=LABEL=RPIROOT rootfstype=ext4 elevator= EOF } +function genericarm_sbc_steps() { + mkdir -p /boot/efi/EFI/BOOT + if [ -d /boot/efi/EFI/rocky/ ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ];then + for j in grub.cfg grubenv;do + mv -f /boot/grub2/${j} /boot/efi/EFI/rocky/ + ln -s ../efi/EFI/rocky/${j} /boot/grub2/${j} + done + cp -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI + fi + + cp -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin + cp -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin + + rpm -e dracut-config-generic + if [ -x /lib/kernel/install.d/10-devicetree.install ]; then + /lib/kernel/install.d/10-devicetree.install remove + fi + + cat << EOF > /etc/sysconfig/kernel +# Written by image installer +# UPDATEDEFAULT specifies if new-kernel-pkg should make new kernels the default +UPDATEDEFAULT=yes + +# DEFAULTKERNEL specifies the default kernel package type +DEFAULTKERNEL=kernel-core +EOF +chmod 644 /etc/sysconfig/kernel + +### Write grub defaults, turn off OS probing as it is always wrong for image creation +cat << EOF > /etc/default/grub +GRUB_TIMEOUT=5 +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +GRUB_DEFAULT=saved +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="" +GRUB_DISABLE_RECOVERY="true" +GRUB_DISABLE_OS_PROBER="true" +GRUB_ENABLE_BLSCFG="false" +EOF + chmod 644 /etc/default/grub + rm -f /boot/dtb + + cat >/usr/local/bin/rootfs-expand << EOF +#!/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[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 +EOF + chmod +x /usr/local/bin/rootfs-expand +} + # ################################################################################ @@ -830,4 +907,7 @@ if [[ "$kiwi_profiles" == *"SBC"* ]]; then if [[ "$kiwi_profiles" == *"SBC-RaspberryPi"* ]]; then raspberrypi_sbc_steps fi + if [[ "$kiwi_profiles" == *"SBC-GenericArm"* ]]; then + genericarm_sbc_steps + fi fi diff --git a/sbc/editbootinstall_genericarm.sh b/sbc/editbootinstall_genericarm.sh new file mode 100644 index 0000000..332676a --- /dev/null +++ b/sbc/editbootinstall_genericarm.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Modify this script to handle disk changes as needed. +# Some of this may be incorrect or not needed. You will need to verify this. + +set -ex + +#diskname="$1" +#devname="$2" +#loopname="${devname%*p2}" +#loopdev=/dev/${loopname#/dev/mapper/*} + +# shellcheck disable=SC2034 +image_fs="$1" +root_partnum="$2" +root_device="/dev/mapper/loop*p${root_partnum}" +loop_name="$(basename $root_device | cut -f 1-2 -d 'p')" +disk_device="/dev/${loop_name}" + +# pi's probably don't support GPT. + +cat > gdisk.tmp <<-'EOF' + x + r + g + t + 1 + c + w + y + EOF + + dd if="$disk_device" of=mbrid.bin bs=1 skip=440 count=4 + gdisk "$disk_device" < gdisk.tmp + dd of="$disk_device" if=mbrid.bin bs=1 seek=440 count=4 + rm -f mbrid.bin + rm -rf gdisk.tmp diff --git a/sbc/pi.xml b/sbc/pi.xml index a76ab6d..250d459 100644 --- a/sbc/pi.xml +++ b/sbc/pi.xml @@ -6,6 +6,9 @@ + + + @@ -25,6 +28,25 @@ + + + + false + true + true + 500 + + + 3 + + + @@ -46,4 +68,19 @@ + + + + + + + + + + + + + + +