Compare commits

..

No commits in common. "r8" and "rpi-installer" have entirely different histories.

8 changed files with 35 additions and 338 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
output/*
logs/*

View File

@ -1,43 +0,0 @@
# RockyRpi
Scripts and kickstarts for building Rocky Linux for Raspberry Pi
## Purpose of this Repo
This repository contains kickstart scripts and commands for producing your own Rocky Linux 8 image for the Raspberry Pi. It's intended mostly for developers or other technical users. If you are simply interested in using Rocky on your Pi, it's much easier to grab the latest image from (currently): https://dl.rockylinux.org/pub/rocky/8/rockyrpi/aarch64/images/
The readme.image.txt file has information and instructions for those interested in downloading and using the ready-made image.
## Requirements:
Producing the Rpi Image requires:
* A Fedora or EL-based distribution (Rocky/CentOS/RHEL/etc.) **running on aarch64 hardware**
* Packages
* git
* EPEL repo enabled (extra packages for enterprise linux)
* The appliance-creator program from appliance-tools package ( ```sudo dnf install appliance-tools``` )
## Making an Image
The included script to create the image is quite simple. Simply run it (with sudo/root), and specify a location you want to write the produced image to. If the location doesn't exist, it will be created as a directory.
For example:
`sudo ./createRocky8_Image.sh /home/myhomefolder/Rocky8_image/`
The kickstart/image build process takes approximately 10 minutes on a Raspberry Pi 4 with a decently fast internet connection. Alternatively, you should be able to use any aarch64 hardware that meets the above requirements(Amazon EC2, etc)
## Customizing the Kickstart
All the setup logic for the image is contained within the kickstart file (Rocky8_Rpi.ks). It is intended to be readable and well documented, and you can of course change it anyway you please to produce custom images yourself.
# Contributing
If you have any suggestions, comments, or problems with the Rocky Rpi images or their creation, feel free to drop us a line! Come by the **~Sig/AltArch** channel on chat.rockylinux.org , or send a message or merge request via Gitlab with your ideas. We'd love to hear from you!

View File

@ -1,182 +0,0 @@
# Kickstart to build Rocky 8 image for Raspberry Pi 4 hardware (aarch64)
#
# (many parts liberally grabbed from pgreco: https://github.com/psgreco/sig-core-AltArch/tree/master/image_build )
#
# Here is how to build this kickstart Raspberry Pi image, inside a clean mock chroot environment with livemedia-creator:
# (it is very similar to how the other kickstarts are built, but aarch64 must be used, and the livemedia appliance option)
#
#
# Set up mock env, and get a shell inside the chroot:
#
# mock -r rocky-8-aarch64 --init
# mock -r rocky-8-aarch64 --install lorax-lmc-novirt vim pykickstart git
# sudo setenforce 0
# mock -r rocky-8-aarch64 --shell --isolation=simple --enable-network
#
# Inside the shell:
# git clone https://github.com/rocky-linux/kickstarts
# git checkout r8
# cd kickstarts/altarch
#
# Finally, run the image creation:
#
# livemedia-creator --ks rockyrpi.ks --image-only --image-name RockyRpi --make-disk --resultdir /rockyrpi_result --no-virt
# 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=RPIROOT
# Repos setup:
url --url http://download.rockylinux.org/pub/rocky/8/BaseOS/aarch64/os/
repo --name="BaseOS" --baseurl=http://download.rockylinux.org/pub/rocky/8/BaseOS/aarch64/os/ --cost=100
repo --name="AppStream" --baseurl=http://download.rockylinux.org/pub/rocky/8/AppStream/aarch64/os/ --cost=200 --install
repo --name="PowerTools" --baseurl=http://download.rockylinux.org/pub/rocky/8/BaseOS/aarch64/os/ --cost=300 --install
# Rocky Rpi kernel repo, we need a more permanent place for this:
repo --name="rockyrpi" --baseurl=https://download.rockylinux.org/pub/sig/8/altarch/aarch64/altarch-rockyrpi/ --cost=20
repo --name="rockyextras" --baseurl=https://download.rockylinux.org/pub/rocky/8/extras/aarch64/os/ --cost=20
# Install proces:
install
keyboard us --xlayouts=us --vckeymap=us
rootpw --lock
# FIXME user creation here does not work ?
# user --name="rocky" --password="rockylinux" --plaintext --gecos="Rocky default user" --groups=wheel --uid=1000
timezone --isUtc --nontp UTC
selinux --enforcing
firewall --enabled --port=22:tcp
network --bootproto=dhcp --device=link --activate --onboot=on
services --enabled=sshd,NetworkManager,chronyd,tuned
shutdown
bootloader --location=none
lang en_US.UTF-8
# Package selection:
%packages
@core
chrony
cloud-utils-growpart
net-tools
NetworkManager-wifi
vim
bash-completion
nano
tuned
rocky-release-rpi
raspberrypi2-firmware
raspberrypi2-kernel4
%end
# Post install scripts:
%post
# Write initial boot line to cmdline.txt (we will update the root partuuid further down)
cat > /boot/cmdline.txt << EOF
console=ttyAMA0,115200 console=tty1 root= rootfstype=ext4 elevator=deadline rootwait
EOF
# 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
# Apparently kickstart user was not working, attempt to do it here?
/sbin/useradd -c "Rocky Linux default user" -G wheel -m -U rocky
echo "rockylinux" | passwd --stdin 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 ==
This is a Rocky 8 install intended for Raspberry Pi 3b and 4 devices (architecture is aarch64).
This image WILL NOT WORK on a Raspberry Pi 1 or 2 (1.1 or earlier), we are 64-bit only, and have no support for 32-bit ARM processors. Sorry :-/.
The newer Pi Zero devices should be supported, as well as the Raspberry Pi 2 v. 1.2 boards, which are 64-bit
IMAGE NOTES / DIFFERENCES FROM STOCK ROCKY 8:
- Based on Rocky Linux 8, 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
GROW YOUR PARTITION:
If you want to automatically resize your root (/ ) partition, just type the following (as root user):
sudo rootfs-expand
It should fill your main rootfs partition to the end of the disk.
Thanks for your interest on Rocky-on-Rpi, feel free to share your experience or contribute in our chat channel at: https://chat.rockylinux.org/rocky-linux/channels/altarch !
-The Rocky Linux Team
EOF
# 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
chmod 755 /home/rocky/fix-wifi-rpi4.sh
chown -R rocky:rocky /home/rocky
# Cleanup before shipping an image
# Remove ifcfg-link on pre generated images
rm -f /etc/sysconfig/network-scripts/ifcfg-link
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
# Ensure no ssh keys are present
rm -f "/etc/ssh/*_key*"
# Setting tuned profile to powersave by default -> sets the CPU governor to "ondemand". This prevents overheating issues
echo "powersave" > /etc/tuned/active_profile
# Clean yum cache
yum clean all
# rebuild rpm database
rpm --rebuilddb
%end
# Add the PARTUUID of the rootfs partition to the kernel command line
%post --nochroot
# Extract the UUID of the rootfs partition from /etc/fstab
UUID_ROOTFS="$(/bin/cat $INSTALL_ROOT/etc/fstab | \
/bin/awk -F'[ =]' '/\/ / {print $2}')"
# Get the PARTUUID of the rootfs partition
PART_UUID_ROOTFS="$(/sbin/blkid "$(/sbin/blkid --uuid $UUID_ROOTFS)" | \
/bin/awk '{print $NF}' | /bin/tr -d '"' )"
# Configure the kernel commandline
/bin/sed -i "s/root= /root=${PART_UUID_ROOTFS} /" $INSTALL_ROOT/boot/cmdline.txt
echo "cmdline.txt looks like this, please review:"
/bin/cat $INSTALL_ROOT/boot/cmdline.txt
# Extract UUID of swap partition:
UUID_SWAP=$(/bin/grep 'swap' $INSTALL_ROOT/etc/fstab | awk '{print $1}' | awk -F '=' '{print $2}')
# Fix swap partition: ensure page size is 4096 (differs on the aarch64 AWS build host)
/usr/sbin/mkswap -L "_swap" -p 4096 -U "${UUID_SWAP}" /dev/disk/by-uuid/${UUID_SWAP}
%end

View File

@ -1,41 +0,0 @@
#!/bin/bash
# Simple script that runs a Rocky Raspberry pi creation (via appliance-creator), then inserts a UUID to the kernel boot line of the image
# after-the-fact
#
# Usage: ./createRocky8_Image.sh /path/to/outputfolder/
#
# Needs to be run in the same directory as the rocky rpi kickstart, as it relies on it!
#
# Exit with error if we don't have an output directory:
OUTDIR=$1
LOGDIR="logs"
LOGFILE="/create_image`date +"%y%m%d"`.log"
LOGFILE2="create_image`date +"%y%m%d"`.log.2"
if [[ -z "${OUTDIR}" ]]; then
echo "Need to run this script with a path to output directory. Like: ${0} /path/to/output/"
exit 1
fi
if [[ -d ${LOGDIR} ]]; then
echo "$LOGDIR exists..."
else
mkdir -p "${LOGDIR}"
touch $LOGDIR/$LOGFILE
fi
if [[ -d ${OUTDIR} ]]; then
echo "$OUTDIR exists..."
else
mkdir -p "${OUTDIR}"
fi
# Actually create the image. Our kickstart data should be in the same git repo as this script:
# (This takes a while, especially building on an rpi. Patience!)
appliance-creator -v -c ./Rocky8_Rpi.ks -n RockyRpi \
--version=`date +"%Y%m%d"` --release=1 \
-d --logfile $LOGDIR/LOGFILE \
--vmem=2048 --vcpu=2 --no-compress -o "${OUTDIR}"
#chown -R $SUDO_USER. "${OUTDIR}"

7
os-request.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": "Rocky Linux",
"description": "Rocky Linux is an open-source enterprise operating system designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux.",
"website": "https://rockylinux.org/",
"icon": "https://raw.githubusercontent.com/rocky-linux/branding/main/logo/out/icon-bg_transparent-primary-1024x.png",
"subitems_url": "https://git.resf.org/sig_altarch/RockyRpi/raw/branch/rpi-installer/rpi-imager.json"
}

View File

@ -1,57 +0,0 @@
(This file comes from the kickstart/appliance-creator repo: https://git.resf.org/sig_altarch/RockyRpi )
Rocky 8 Raspberry Pi Image version 8.8
They have been tested on Raspberry Pi 3 and 4.
Rocky Linux WILL NOT WORK on a Raspberry Pi 1 or 2. They are 32-bit only, and Rocky Linux only supports arm64 (aarch64).
(edit: Raspberry Pi 2 version 1.2 boards are in fact 64-bit. There aren't too many of these, but they might work. Tell us on chat.rockylinux.org if you have one!)
QUICK START:
####################################################
Download the latest image, and write it to your raw microSD memory card (or other boot device).
GUI WAY (Linux/Win/Mac)
Grab a program like Balena Etcher ( https://www.balena.io/etcher/ ) GUI-based disk writer.
Insert your SD card and follow the instructions. It will extract and write your disk image.
COMMAND LINE WAY (assumes Linux system on a root (sudo su) shell):
xzcat Rocky_Image_file.raw.xz > /dev/sdX
(where X is the letter of your usb or memory card device, you can use fdisk -l to find which one)
BE CAREFUL, be sure which device you are writing to before you do it! Don't accidentally blow away your laptop/desktop hard drive!
Once your storage device is written to, you should be able to plug it in to a Raspberry Pi and boot!
Default username: rocky
Default password: rockylinux
Run "sudo rootfs-expand" to grow the partition and use all of your memory card or hard drive.
TECHNICAL DETAILS ABOUT THE IMAGES:
###################################################
- Minimal/base install, with some quality of life packages like vim,nano,bash-completion
- Additional Raspberry Pi repo and release package that has Rpi kernels/firmware from the excellent raspberrypi2 repo from upstream CentOS
- Script/fix for the wifi on rpi4 (linux-firmware bug)
- Default user "rocky" (member of wheel, can use sudo). Root password disabled by default
- Partition layout: 300 MB /boot , 512 MB swap, ~2800 MB rootfs. Able to fit on a 4 GB or larger sd card
- Everything else should be more or less a standard Rocky aarch64 installation
Feel free to share your experience or contribute in our chat channel at: https://chat.rockylinux.org/rocky-linux/channels/altarch !
-The Rocky Linux Team
Thanks for your interest in Rocky Linux on the Raspberry Pi!

28
rpi-imager.json Normal file
View File

@ -0,0 +1,28 @@
{
"os_list": [
{
"name": "Rocky Linux 8 (64-bit)",
"description": "A minimal installation of Rocky Linux 8 with Pi specific packages (no DE)",
"url": "http://dl.rockylinux.org/pub/sig/8/altarch/aarch64/images/RockyLinuxRpi_8-latest.img.xz",
"icon": "https://raw.githubusercontent.com/rocky-linux/branding/main/logo/out/icon-bg_transparent-primary-1024x.png",
"website": "https://rockylinux.org/",
"release_date": "2022-11-18",
"extract_size": 3787456512,
"extract_sha256": "97d62df7e02631f17756e9f3796c249317583bd815fac789a578226ea7a0dc8f",
"image_download_size": 435948776,
"image_download_sha256": "2dd358f56fcaf8d0459d4a9ef584c0b389b6d13bc389d504aa8d963b7624a8dc"
},
{
"name": "Rocky Linux 9 (64-bit)",
"description": "A minimal installation of Rocky Linux 9 with Pi specific packages (no DE)",
"url": "http://dl.rockylinux.org/pub/sig/9/altarch/aarch64/images/RockyLinuxRpi_9-latest.img.xz",
"icon": "https://raw.githubusercontent.com/rocky-linux/branding/main/logo/out/icon-bg_transparent-primary-1024x.png",
"website": "https://rockylinux.org/",
"release_date": "2022-12-23",
"extract_size": 3787456512,
"extract_sha256": "a439b14aa53289b82f3c574b5038b9aa334102898404b40e9c1502d71bd42422",
"image_download_size": 478010984,
"image_download_sha256": "23412ee78165b96a09bd07649fd5ebd12710a09cfc9ecf2cb9988a39dabcfe97"
},
]
}

View File

@ -1,13 +0,0 @@
#- 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(?)