2021-06-25 16:00:39 +00:00
# Kickstart to build Rocky 8 image for Raspberry Pi 4 hardware (aarch64)
#
# (pull from pgreco: https://github.com/psgreco/sig-core-AltArch/tree/master/image_build
# Basic setup information
%include "Rocky8_Rpi4/010_repos_aarch64.ksi"
%include "Rocky8_Rpi4/020_common.ksi"
%include "Rocky8_Rpi4/040_packages.ksi"
# Disk setup
clearpart --initlabel --all
part /boot --asprimary --fstype=vfat --size=300 --label=boot
part swap --asprimary --fstype=swap --size=512 --label=swap
2021-06-26 13:04:06 +00:00
part / --asprimary --fstype=ext4 --size=2800 --label=RPIROOT
2021-06-25 16:00:39 +00:00
2021-06-25 19:49:11 +00:00
2021-06-25 16:00:39 +00:00
%post
# Generating initrd
# Ensure no ssh keys are present
rm -f /etc/ssh/*_key*
2021-06-25 19:49:11 +00:00
cat > /boot/cmdline.txt << EOF
2021-06-26 13:04:06 +00:00
console=ttyAMA0,115200 console=tty1 root= rootfstype=ext4 elevator=deadline rootwait
2021-06-25 19:49:11 +00:00
EOF
2021-06-26 13:04:06 +00:00
mkdir -p /home/rocky
chown 1000:1000 /home/rocky
# Need to write several files to help with various things here.
# First, the all-important README :
cat >/home/rocky/README << EOF
== Rocky 8 Raspberry Pi Image (experimental) ==
This is a minimal Rocky 8 install intended for Raspberry Pi 4 devices (architecture is aarch64).
It may work on a Pi 3 , but that has not been tested. We are looking for Rpi 3 owners to test if you'd like to try it.
This image WILL NOT WORK on a Raspberry Pi 1 or 2, we are 64-bit only, and have no support for 32-bit ARM processors. Sorry :-/.
IMAGE NOTES / DIFFERENCES FROM STOCK ROCKY 8:
- Based on Rocky Linux 8.4, points to production Rocky 8 aarch64 repositories
- Has an additional repository that contains kernel packages for Raspberry Pi
- Includes script that fixes the wifi. Simple edit of a txt firmware settings file. Will need to be run whenever linux-firmware gets upgraded
- Includes @minimal-install , plus a few quality of life packages like vim, bash-completion, etc.
- Initial User "rocky" (default password: "rockylinux"). Root password disabled, rocky user is a sudoer
- Partitions are 300 MB /boot , 512 MB swap, 2800 MB rootfs. Requires a 4 GB or larger storage device to serve as your disk
If you want to automatically resize your / partition, just type the following (as root user):
rootfs-expand
EOF
chown 1000 /home/rocky/README
2021-06-25 19:49:11 +00:00
2021-06-26 13:04:06 +00:00
# Next, script to fix the wifi firmware setting:
cat >/home/rocky/fix-wifi-rpi4.sh << 'EOF'
#!/bin/bash
# Simple hacky fix to correct wifi settings on the Rpi4 so it loads properly:
sed -i 's/boardflags3=0x48200100/boardflags3=0x44200100/g' /lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
echo "Patched /lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt . You can reboot and wifi should work, or do: rmmod brcmfmac; modprobe brcmfmac; "
EOF
chown 1000 /home/rocky/fix-wifi-rpi4.sh
chmod 755 /home/rocky/fix-wifi-rpi4.sh
# Run this once to fix the wifi:
sed -i 's/boardflags3=0x48200100/boardflags3=0x44200100/g' /lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
# Add rpi-kernel repo:
cat >/etc/yum.repos.d/Rocky_Rpi_kernel.repo << 'EOF'
# Raspberry Pi Kernel repository
#
# This is an additional repository that hosts special kernel builds to use for the Raspberry Pi
# Currently in an unsigned, temporary location - should change soon!
#
# Kernel upstream source is pulled from: https://git.centos.org/rpms/raspberrypi2
#
[Rocky_Rpi_Kernel]
name=Rocky Linux 8 Raspberry Pi Kernel
baseurl=https://rocky.lowend.ninja/RockyRpi/Rpi-Kernel/
gpgcheck=0
enabled=1
EOF
2021-06-25 19:49:11 +00:00
2021-06-25 16:00:39 +00:00
%end