Large changes, and added script
Script runs the build with appliacne-creator, but also fetches/inserts the UUID after the fact to cmdline.txt -Skip G.
This commit is contained in:
parent
777d273858
commit
1ea9e39ffb
@ -9,31 +9,15 @@
|
||||
%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"
|
||||
#%include "../ks.include/pkgs_common_7.ksi"
|
||||
#%include "../ks.include/pkgs_exclude_7.ksi"
|
||||
|
||||
# Repositories to use
|
||||
#repo --name="instKern" --baseurl=http://mirror.centos.org/altarch/7/kernel/armhfp/kernel-rpi2/ --cost=100
|
||||
|
||||
|
||||
# Disk setup
|
||||
clearpart --initlabel --all
|
||||
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
|
||||
part / --asprimary --fstype=ext4 --size=2800 --label=RPIROOT
|
||||
|
||||
|
||||
# Package setup
|
||||
%packages
|
||||
raspberrypi2-firmware
|
||||
raspberrypi2-kernel4
|
||||
|
||||
%end
|
||||
|
||||
%post
|
||||
# Generating initrd
|
||||
@ -42,15 +26,85 @@ raspberrypi2-kernel4
|
||||
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
|
||||
console=ttyAMA0,115200 console=tty1 root= rootfstype=ext4 elevator=deadline rootwait
|
||||
EOF
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
%end
|
||||
|
@ -1,7 +1,7 @@
|
||||
install
|
||||
keyboard us --xlayouts=us --vckeymap=us
|
||||
rootpw --lock
|
||||
user --name=rocky --password=rockylinux --gecos="Rocky default user" --groups=wheel
|
||||
user --name=rocky --password=rockylinux --gecos="Rocky default user" --groups=wheel --uid=1000 --gid=1000
|
||||
timezone --isUtc --nontp UTC
|
||||
selinux --enforcing
|
||||
firewall --enabled --port=22:tcp
|
||||
|
@ -8,5 +8,8 @@ vim
|
||||
bash-completion
|
||||
nano
|
||||
|
||||
raspberrypi2-firmware
|
||||
raspberrypi2-kernel4
|
||||
|
||||
|
||||
%end
|
||||
|
38
Rocky8_Rpi4_mkimage.sh
Executable file
38
Rocky8_Rpi4_mkimage.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
OUTDIR=$HOME/RockyRpi_image
|
||||
|
||||
mkdir -p ${OUTDIR}
|
||||
|
||||
|
||||
time appliance-creator -v -c ./Rocky8_Rpi4.ks -n RockyRpi --version=20210626 --release=1 --vmem=1024 --no-compress -o ${OUTDIR}
|
||||
|
||||
|
||||
# Post appliance-creator sequence to
|
||||
|
||||
mkdir -p /mnt/tmp
|
||||
|
||||
# find the image we just made, and make it available on /dev/maper/loop* devices:
|
||||
image=`find ${LOCATION} -iname *.raw | head -1`
|
||||
kpartx -av ${image}
|
||||
|
||||
# Get the UUID of our root partition (the ext4 one) (UUID=e3984938429 , strip out quotes("))
|
||||
uuid=`blkid | grep "mapper/loop0p3" | head -1 | awk '{print $3}' | tr -d '"'`
|
||||
|
||||
# Mount the /boot partition:
|
||||
mkdir -p /mnt/tmp
|
||||
umount /mnt/tmp
|
||||
mount /dev/mapper/loop0p1 /mnt/tmp
|
||||
|
||||
# Swap out the "root=" part of cmdline.txt for our "root=UUID=blah"
|
||||
sed -i "s/root= /root=${uuid} /" /mnt/tmp/cmdline.txt
|
||||
|
||||
# Debug check to make sure it looks right:
|
||||
echo "cmdline.txt looks like this, please review:"
|
||||
cat /mnt/tmp/cmdline.txt
|
||||
|
||||
# Finished, unmount:
|
||||
umount /mnt/tmp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user