Skip to content

Commit 3c04f0a

Browse files
authored
Merge pull request #71 from metalefty/10-kitten-work
Add AlmaLinux Kitten 10
2 parents d90ccaf + 30f22c5 commit 3c04f0a

8 files changed

+395
-12
lines changed

.github/workflows/build-rpi-github-hosted.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ on:
3434
default: '9'
3535
type: choice
3636
options:
37+
- 10k
3738
- 9
3839
- 8
3940

@@ -72,6 +73,9 @@ jobs:
7273
# 8 has no GPT image
7374
- version_major: '8'
7475
partitioning: 'gpt'
76+
# 10-kitten has no MBR image
77+
- version_major: '10k'
78+
partitioning: 'mbr'
7579

7680
steps:
7781
- uses: actions/checkout@v4
@@ -83,21 +87,40 @@ jobs:
8387
8488
- name: Prepare AlmaLinux Minor version number
8589
run: |
86-
release=$(rpm -q --qf="%{VERSION}\n" https://repo.almalinux.org/almalinux/almalinux-release-latest-${{ inputs.version_major }}.aarch64.rpm 2>/dev/null)
90+
version_major=${{ inputs.version_major }}
91+
version_major=${version_major%k}
92+
case ${{ inputs.version_major }} in
93+
*k) ## Kitten
94+
release_url="https://repo.almalinux.org/almalinux-kitten/almalinux-kitten-release-latest-${version_major}.aarch64.rpm"
95+
container_version="${version_major}-kitten"
96+
kitten="Kitten"
97+
;;
98+
*)
99+
release_url="https://repo.almalinux.org/almalinux/almalinux-release-latest-${version_major}.aarch64.rpm"
100+
container_version="${version_major}"
101+
;;
102+
esac
103+
release=$(rpm -q --qf="%{VERSION}\n" ${release_url} 2>/dev/null)
87104
version_minor=$(cut -d '.' -f 2 <<< "$release")
105+
[ "x${kitten}" != "x" ] && echo "kitten=${kitten} " >> $GITHUB_ENV
106+
[ "x${release}" != "x" ] && echo "full_release_version=${release}" >> $GITHUB_ENV
107+
[ "x${version_major}" != "x" ] && echo "version_major=${version_major}" >> $GITHUB_ENV
88108
[ "x${version_minor}" != "x" ] && echo "version_minor=${version_minor}" >> $GITHUB_ENV
109+
# Use AlmaLinux 9 to build images since appliance-tools not available in 10 yet
110+
container_version=9
111+
[ "x${container_version}" != "x" ] && echo "container_version=${container_version}" >> $GITHUB_ENV
89112
90113
- name: Prepare some environment stuff
91114
run: |
92115
# Path to the python3-imgcreate fs.py
93-
case ${{ inputs.version_major }} in
116+
case ${{ env.container_version }} in
94117
8)
95118
python3_imgcreate=/usr/lib/python3.6/site-packages/imgcreate/
96119
;;
97120
9)
98121
python3_imgcreate=/usr/lib/python3.9/site-packages/imgcreate/
99122
;;
100-
10)
123+
10|10k)
101124
python3_imgcreate=/usr/lib/python3.12/site-packages/imgcreate/
102125
;;
103126
*)
@@ -131,8 +154,8 @@ jobs:
131154
echo "rpi_image_resultdir=${rpi_image_resultdir}" >> $GITHUB_ENV
132155
133156
# Image file base name
134-
image_name="AlmaLinux-${{ inputs.version_major }}-RaspberryPi-${{ matrix.partitioning }}-${{ inputs.version_major }}.${{ env.version_minor }}-${date_stamp}.aarch64"
135-
[ "${{ matrix.image_types }}" = "gnome" ] && image_name="AlmaLinux-${{ inputs.version_major }}-RaspberryPi-GNOME-${{ matrix.partitioning }}-${{ inputs.version_major }}.${{ env.version_minor }}-${date_stamp}.aarch64"
157+
image_name="AlmaLinux-${{ inputs.version_major }}-RaspberryPi-${{ matrix.partitioning }}-${{ env.full_release_version }}-${date_stamp}.aarch64"
158+
[ "${{ matrix.image_types }}" = "gnome" ] && image_name="AlmaLinux-${{ inputs.version_major }}-RaspberryPi-GNOME-${{ matrix.partitioning }}-${{ env.full_release_version }}-${date_stamp}.aarch64"
136159
echo "image_name=${image_name}" >> $GITHUB_ENV
137160
138161
- name: Install KVM and libvirt packages
@@ -193,7 +216,7 @@ jobs:
193216
194217
# Docerfile to build image for RPi creation
195218
cat << 'EOF' > Dockerfile
196-
FROM almalinux:${{ inputs.version_major }}
219+
FROM almalinux:${{ env.container_version }}
197220
198221
# Set the working directory in the container
199222
WORKDIR /
@@ -442,7 +465,7 @@ jobs:
442465
MATTERMOST_CHANNEL: ${{ vars.MATTERMOST_CHANNEL }}
443466
MATTERMOST_USERNAME: ${{ github.triggering_actor }}
444467
TEXT: |
445-
**AlmaLinux OS ${{ inputs.version_major }}.${{ env.version_minor }} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
468+
**AlmaLinux OS ${{ env.kitten }}${{ env.full_release_version }} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
446469
447470
:almalinux: **${{ matrix.image_types }} ${{ matrix.partitioning }}**
448471
@@ -458,7 +481,7 @@ jobs:
458481
MATTERMOST_CHANNEL: ${{ vars.MATTERMOST_CHANNEL }}
459482
MATTERMOST_USERNAME: ${{ github.triggering_actor }}
460483
TEXT: |
461-
**AlmaLinux OS ${{ inputs.version_major }}.${{ env.version_minor }} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
484+
**AlmaLinux OS ${{ env.kitten }}${{ env.full_release_version}} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
462485
463486
:almalinux: **${{ matrix.image_types }} ${{ matrix.partitioning }}**
464487

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
cache8/*
22
cache9/*
3+
cache10/*
4+
cache10k/*
35
AlmaLinux-*-RaspberryPi-*.aarch64/*

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ then
2525
fi
2626

2727
VARIANT=${1}
28-
VER=$(echo $VARIANT | sed -e 's|[^0-9]||g')
28+
VER=$(echo $VARIANT | sed -e 's|[^0-9k?]||g')
2929

3030
if [ ! -f ${SCRIPT_DIR}/kickstart/${VARIANT}.aarch64.ks ]
3131
then
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Basic setup information
2+
url --mirrorlist="https://kitten.mirrors.almalinux.org/mirrorlist/10-kitten/baseos"
3+
# root password is locked but can be reset by cloud-init later
4+
rootpw --plaintext --lock almalinux
5+
6+
# Repositories to use
7+
repo --name="baseos" --mirrorlist="https://kitten.mirrors.almalinux.org/mirrorlist/10-kitten/baseos"
8+
repo --name="appstream" --mirrorlist="https://kitten.mirrors.almalinux.org/mirrorlist/10-kitten/appstream"
9+
repo --name="raspberrypi" --mirrorlist="https://kitten.mirrors.almalinux.org/mirrorlist/10-kitten/raspberrypi"
10+
11+
# install
12+
keyboard us --xlayouts=us --vckeymap=us
13+
timezone --isUtc --nontp UTC
14+
selinux --enforcing
15+
firewall --enabled --port=22:tcp
16+
network --bootproto=dhcp --device=link --activate --onboot=on
17+
services --enabled=sshd,NetworkManager,chronyd,bluetooth,cpupower
18+
shutdown
19+
bootloader --location=none
20+
lang en_US.UTF-8
21+
22+
# Disk setup
23+
clearpart --initlabel --all --disklabel=gpt
24+
part /boot --fstype=vfat --size=500 --label=cidata --ondisk=sda
25+
part / --fstype=ext4 --size=2400 --label=rootfs --ondisk=sda
26+
27+
# Package setup
28+
%packages
29+
@core
30+
-caribou*
31+
-gnome-shell-browser-plugin
32+
-java-1.6.0-*
33+
-java-1.7.0-*
34+
-java-11-*
35+
-kernel-*
36+
-python*-caribou*
37+
NetworkManager-wifi
38+
almalinux-release-raspberrypi
39+
bluez
40+
chrony
41+
cloud-init
42+
cloud-utils-growpart
43+
e2fsprogs
44+
net-tools
45+
linux-firmware-raspberrypi
46+
raspberrypi-sys-mods
47+
raspberrypi-userland
48+
raspberrypi2-firmware
49+
raspberrypi2-kernel4
50+
raspberrypi2-kernel4-tools
51+
raspberrypi2-kernel4-modules
52+
raspberrypi2-kernel4-modules-core
53+
raspberrypi2-kernel4-modules-extra
54+
nano
55+
libgpiod-utils
56+
%end
57+
58+
%post
59+
# Mandatory README file
60+
cat >/boot/README.txt << EOF
61+
== AlmaLinux Kitten 10 ==
62+
63+
To login to Raspberry Pi via SSH, you need to register SSH public key *before*
64+
inserting SD card to Raspberry Pi. Edit user-data file and put SSH public key
65+
in the place.
66+
67+
Default SSH username is almalinux.
68+
69+
EOF
70+
71+
# Data sources for cloud-init
72+
touch /boot/meta-data /boot/user-data
73+
74+
cat >/boot/user-data << "EOF"
75+
#cloud-config
76+
#
77+
# This is default cloud-init config file for AlmaLinux Raspberry Pi image.
78+
#
79+
# If you want additional customization, refer to cloud-init documentation and
80+
# examples. Please note configurations written in this file will be usually
81+
# applied only once at very first boot.
82+
#
83+
# https://cloudinit.readthedocs.io/en/latest/reference/examples.html
84+
85+
hostname: almalinux.local
86+
ssh_pwauth: false
87+
88+
users:
89+
- name: almalinux
90+
groups: [ adm, systemd-journal ]
91+
sudo: [ "ALL=(ALL) NOPASSWD:ALL" ]
92+
lock_passwd: false
93+
passwd: $6$EJCqLU5JAiiP5iSS$wRmPHYdotZEXa8OjfcSsJ/f1pAYTk0/OFHV1CGvcszwmk6YwwlZ/Lwg8nqjRT0SSKJIMh/3VuW5ZBz2DqYZ4c1
94+
# Uncomment below to add your SSH public keys as YAML array
95+
#ssh_authorized_keys:
96+
#- ssh-ed25519 AAAAC3Nz...
97+
98+
EOF
99+
100+
cat > /boot/config.txt << EOF
101+
# This file is provided as a placeholder for user options
102+
# AlmaLinux - few default config options
103+
104+
[pi4]
105+
arm_boost=1
106+
107+
[all]
108+
# enable serial console
109+
enable_uart=1
110+
EOF
111+
112+
# Kernel command line string
113+
cat > /boot/cmdline.txt << EOF
114+
console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
115+
EOF
116+
117+
# Create and initialize swapfile
118+
(umask 077; dd if=/dev/zero of=/swapfile bs=1M count=100)
119+
/usr/sbin/mkswap -p 4096 -L "_swap" /swapfile
120+
cat >> /etc/fstab << EOF
121+
/swapfile none swap defaults 0 0
122+
EOF
123+
124+
# Remove ifcfg-link on pre generated images
125+
rm -f /etc/sysconfig/network-scripts/ifcfg-link
126+
127+
# rebuild dnf cache
128+
dnf clean all
129+
/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME
130+
echo '%_install_langs C.utf8' > /etc/rpm/macros.image-language-conf
131+
echo 'LANG="C.utf8"' > /etc/locale.conf
132+
rpm --rebuilddb
133+
134+
# Remove machine-id on pre generated images
135+
rm -f /etc/machine-id
136+
touch /etc/machine-id
137+
%end
138+
139+
%post --nochroot --erroronfail
140+
141+
LOOPPART=$(cat /proc/self/mounts |/usr/bin/grep '^\/dev\/mapper\/loop[0-9]p[0-9] '"$INSTALL_ROOT " | /usr/bin/sed 's/ .*//g')
142+
VFATPART=$(cat /proc/self/mounts |/usr/bin/grep '^\/dev\/mapper\/loop[0-9]p[0-9] '"$INSTALL_ROOT"/boot | /usr/bin/sed 's/ .*//g')
143+
echo "Found loop part for PARTUUID $LOOPPART"
144+
BOOTDEV=$(/usr/sbin/blkid $LOOPPART | egrep 'PARTUUID="([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})"' | sed 's/.*PARTUUID/PARTUUID/g;s/ .*//g;s/"//g')
145+
echo "no chroot selected bootdev=$BOOTDEV"
146+
if [ -n "$BOOTDEV" ];then
147+
cat $INSTALL_ROOT/boot/cmdline.txt
148+
echo sed -i "s|root=/dev/mmcblk0p2|root=${BOOTDEV}|g" $INSTALL_ROOT/boot/cmdline.txt
149+
sed -i "s|root=/dev/mmcblk0p2|root=${BOOTDEV}|g" $INSTALL_ROOT/boot/cmdline.txt
150+
fi
151+
152+
# cloud-init: NoCloud data source must have volume label "CIDATA"
153+
#
154+
# This didn't work for some reasons so using fatlabel instead.
155+
# part /boot --asprimary --fstype=vfat --mkfsoptions="-n CIDATA"
156+
/usr/sbin/fatlabel $VFATPART "CIDATA"
157+
# Kickstart sets the type of a VFAT partition with mountpoint /boot to EF00
158+
# if a GUID partition table is used, so reset the partition type to 0700.
159+
VFATPARTNUM=$(echo ${VFATPART} | sed -n 's/.*p\([0-9]\+\)$/\1/p')
160+
VFATPARTDEV=$(echo ${VFATPART//\/mapper/} | sed 's/p[0-9]*$//')
161+
if [ -b "${VFATPARTDEV}p${VFATPARTNUM}" -o -b "${VFATPARTDEV}${VFATPARTNUM}" ]; then
162+
echo /usr/sbin/sgdisk --typecode="${VFATPARTNUM}:0700" ${VFATPARTDEV}
163+
/usr/sbin/sgdisk --typecode="${VFATPARTNUM}:0700" ${VFATPARTDEV}
164+
fi
165+
166+
/usr/sbin/sgdisk -p ${VFATPARTDEV}
167+
168+
cat $INSTALL_ROOT/boot/cmdline.txt
169+
170+
%end

0 commit comments

Comments
 (0)