try genericarm instead

This commit is contained in:
Louis Abel 2024-05-04 01:32:56 -07:00
parent 4f516b81eb
commit 764a527bff
Signed by: label
GPG Key ID: 2A6975660E424560
3 changed files with 153 additions and 0 deletions

View File

@ -718,6 +718,83 @@ console=ttyAMA0,115200 console=tty1 root=LABEL=RPIROOT rootfstype=ext4 elevator=
EOF 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 if [[ "$kiwi_profiles" == *"SBC-RaspberryPi"* ]]; then
raspberrypi_sbc_steps raspberrypi_sbc_steps
fi fi
if [[ "$kiwi_profiles" == *"SBC-GenericArm"* ]]; then
genericarm_sbc_steps
fi
fi fi

View File

@ -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

View File

@ -6,6 +6,9 @@
<profile name="SBC-RaspberryPi" description="Raspberry Pi Image"> <profile name="SBC-RaspberryPi" description="Raspberry Pi Image">
<requires profile="Core-Pi"/> <requires profile="Core-Pi"/>
</profile> </profile>
<profile name="SBC-GenericArm" description="Generic ARM Image">
<requires profile="Core-Pi"/>
</profile>
</profiles> </profiles>
<!-- RPI --> <!-- RPI -->
<preferences profiles="SBC-RaspberryPi" arch="aarch64"> <preferences profiles="SBC-RaspberryPi" arch="aarch64">
@ -25,6 +28,25 @@
<bootloader name="grub2" console="serial"/> <bootloader name="grub2" console="serial"/>
</type> </type>
</preferences> </preferences>
<preferences profiles="SBC-GenericArm" arch="aarch64">
<type image="oem"
filesystem="ext4"
bootpartition="true" bootpartsize="1000" bootfilesystem="ext4" efipartsize="500" firmware="efi"
kernelcmdline="root=LABEL=rootfs rootfstype=ext4 elevator=deadline rootwait"
devicepersistency="by-label"
editbootinstall="sbc/editbootinstall_genericarm.sh"
rootfs_label="rootfs">
<oemconfig>
<oem-resize>false</oem-resize>
<oem-skip-verify>true</oem-skip-verify>
<oem-swap>true</oem-swap>
<oem-swapsize>500</oem-swapsize>
</oemconfig>
<bootloader name="grub2" console="serial"/>
<size unit="G">3</size>
</type>
</preferences>
<packages type="image" patternType="plusRecommended" profiles="Core-Pi"> <packages type="image" patternType="plusRecommended" profiles="Core-Pi">
<namedCollection name="core"/> <namedCollection name="core"/>
<package name="rocky-release"/> <package name="rocky-release"/>
@ -46,4 +68,19 @@
<package name="raspberrypi2-firmware"/> <package name="raspberrypi2-firmware"/>
<package name="raspberrypi2-kernel4"/> <package name="raspberrypi2-kernel4"/>
</packages> </packages>
<packages type="image" patternType="plusRecommended" profiles="SBC-GenericArm">
<package name="bcm2711-firmware"/>
<package name="bcm2835-firmware"/>
<package name="bcm283x-firmware"/>
<package name="bcm283x-overlay"/>
<package name="dracut-config-generic"/>
<package name="efibootmgr"/>
<package name="kernel"/>
<package name="kernel-core"/>
<package name="systemd-udev"/>
<package name="uboot-images-armv8"/>
<package name="uboot-tools"/>
<ignore name="dracut-config-rescue"/>
<ignore name="java-11-*"/>
</packages>
</image> </image>