diff --git a/Rocky8_Rpi4.ks b/Rocky8_Rpi4.ks index 983cca9..9d22acb 100644 --- a/Rocky8_Rpi4.ks +++ b/Rocky8_Rpi4.ks @@ -9,6 +9,8 @@ %include "Rocky8_Rpi4/020_common.ksi" %include "Rocky8_Rpi4/040_packages.ksi" +%include "Rocky8_Rpi4/050_files.ksi" + #%include "../ks.include/common.ksi" #%include "../ks.include/RaspberryPI.ksi" #%include "../ks.include/wifi.ksi" @@ -25,9 +27,9 @@ part /boot --asprimary --fstype=vfat --size=300 --label=boot part swap --asprimary --fstype=swap --size=512 --label=swap part / --asprimary --fstype=ext4 --size=2800 --label=rootfs + # Package setup %packages -#raspberrypi-vc-utils raspberrypi2-firmware raspberrypi2-kernel4 @@ -35,10 +37,20 @@ raspberrypi2-kernel4 %post # Generating initrd -#export kvr=$(rpm -q --queryformat '%{version}-%{release}' $(rpm -q raspberrypi2-kernel4|tail -n 1)) -#dracut --force /boot/initramfs-$kvr.armv7hl.img $kvr.armv7hl # Ensure no ssh keys are present rm -f /etc/ssh/*_key* + +# Important: find the partuuid and add it to our cmdline.txt so we can boot(!) +partuuid=`blkid | grep '_/' | awk '{print $NF}' | tr -d '"' | tr '[:lower:]' '[:upper:]'` + +cat > /boot/cmdline.txt << EOF +console=ttyAMA0,115200 console=tty1 root=${partuuid} rootfstype=ext4 elevator=deadline rootwait +EOF + + + + + %end diff --git a/Rocky8_Rpi4/020_common.ksi b/Rocky8_Rpi4/020_common.ksi index fe3b971..a978889 100644 --- a/Rocky8_Rpi4/020_common.ksi +++ b/Rocky8_Rpi4/020_common.ksi @@ -1,6 +1,7 @@ install keyboard us --xlayouts=us --vckeymap=us -rootpw --plaintext rocky +rootpw --lock +user --name=rocky --password=rockylinux --gecos="Rocky default user" --groups=wheel timezone --isUtc --nontp UTC selinux --enforcing firewall --enabled --port=22:tcp @@ -11,19 +12,6 @@ bootloader --location=mbr --extlinux lang en_US.UTF-8 %post -# Mandatory README file -cat >/root/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 should work similarly to any other aarch64 device. There is a special repository added that contains -raspberry pi specific kernel builds. - -If you want to automatically resize your / partition, just type the following (as root user): -rootfs-expand - -EOF # Enabling chronyd on boot systemctl enable chronyd @@ -37,12 +25,6 @@ rm -f /etc/machine-id touch /etc/machine-id -# Specific cmdline.txt files needed for raspberrypi2/3/4 -cat > /boot/cmdline.txt << EOF -console=ttyAMA0,115200 console=tty1 root=LABEL=rootfs rootfstype=ext4 elevator=deadline rootwait -EOF - - %end diff --git a/Rocky8_Rpi4/040_packages.ksi b/Rocky8_Rpi4/040_packages.ksi index fbbb6a9..4eacfa8 100644 --- a/Rocky8_Rpi4/040_packages.ksi +++ b/Rocky8_Rpi4/040_packages.ksi @@ -4,5 +4,9 @@ chrony cloud-utils-growpart net-tools NetworkManager-wifi +vim +bash-completion +nano + %end diff --git a/Rocky8_Rpi4/050_files.ksi b/Rocky8_Rpi4/050_files.ksi new file mode 100644 index 0000000..5e192a1 --- /dev/null +++ b/Rocky8_Rpi4/050_files.ksi @@ -0,0 +1,71 @@ +%post +# 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 rocky /home/rocky/README + + +# Next, script to fix the wifi firmware setting: + +echo >/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 rocky /home/rocky/fix-wifi-rpi4.sh +chmod 755 /home/rocky/fix-wifi-rpi4.sh + + + +# Add rpi-kernel repo: +echo >/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 + +%end diff --git a/skips_todo b/skips_todo new file mode 100644 index 0000000..6ab3f74 --- /dev/null +++ b/skips_todo @@ -0,0 +1,13 @@ +#- Disable root pw, disable root ssh, add rocky login w/ default pw + +#- Detect PARTUUID and automatically swap /boot/cmdline.txt + +#- script to fix wifi txt file, in /root/, and also run it at the end + +#- install extra packages: nano,vim,bash-completion + +#- Add rpi-kernel repo file + +- Add README , with notes and how-to's for writing sd card, fixing wifi, and expanding partition + +- Adjust swap/rootfs sizes(?)