From 5ef45137cba1d5633aaab205b5e036a410b595a3 Mon Sep 17 00:00:00 2001 From: Sherif Nagy Date: Sat, 17 Dec 2022 23:25:05 +0000 Subject: [PATCH] Init R9 --- Rocky-8-aarch64-generic-Minimal.ks | 3 -- Rocky-9-aarch64-generic-Minimal.ks | 3 ++ createimage.sh | 2 +- includes/basecommon9.ksi | 9 +++++ includes/gen-packages9.ksi | 16 +++++++++ includes/gen-partitions9.ksi | 6 ++++ includes/gen-postcommon9.ksi | 55 ++++++++++++++++++++++++++++++ includes/gen-reposcommon9.ksi | 1 + includes/gen-rockycommon9.ksi | 9 +++++ includes/packages9.ksi | 18 ++++++++++ includes/postcommon9.ksi | 10 ++++++ includes/precommon9.ksi | 4 +++ includes/rockyreadme9.ksi | 11 ++++++ includes/rockyrepos9.ksi | 6 ++++ 14 files changed, 149 insertions(+), 4 deletions(-) delete mode 100644 Rocky-8-aarch64-generic-Minimal.ks create mode 100644 Rocky-9-aarch64-generic-Minimal.ks create mode 100644 includes/basecommon9.ksi create mode 100644 includes/gen-packages9.ksi create mode 100644 includes/gen-partitions9.ksi create mode 100644 includes/gen-postcommon9.ksi create mode 100644 includes/gen-reposcommon9.ksi create mode 100644 includes/gen-rockycommon9.ksi create mode 100644 includes/packages9.ksi create mode 100644 includes/postcommon9.ksi create mode 100644 includes/precommon9.ksi create mode 100644 includes/rockyreadme9.ksi create mode 100644 includes/rockyrepos9.ksi diff --git a/Rocky-8-aarch64-generic-Minimal.ks b/Rocky-8-aarch64-generic-Minimal.ks deleted file mode 100644 index 1cf6cf8..0000000 --- a/Rocky-8-aarch64-generic-Minimal.ks +++ /dev/null @@ -1,3 +0,0 @@ -%include includes/rockyrepos8.ksi -%include includes/gen-reposcommon8.ksi -%include includes/gen-rockycommon8.ksi diff --git a/Rocky-9-aarch64-generic-Minimal.ks b/Rocky-9-aarch64-generic-Minimal.ks new file mode 100644 index 0000000..ddec97f --- /dev/null +++ b/Rocky-9-aarch64-generic-Minimal.ks @@ -0,0 +1,3 @@ +%include includes/rockyrepos9.ksi +%include includes/gen-reposcommon9.ksi +%include includes/gen-rockycommon9.ksi diff --git a/createimage.sh b/createimage.sh index b0be047..ba77af7 100644 --- a/createimage.sh +++ b/createimage.sh @@ -8,7 +8,7 @@ if [ ! -f "${KSFILE}" ]; then echo " $0 " echo echo "EXAMPLE" - echo " $0 Rocky-Userland-8-aarch64-Generic-Minimal-4.ks" + echo " $0 Rocky-Userland-9-aarch64-Generic-Minimal-4.ks" echo exit 1 fi diff --git a/includes/basecommon9.ksi b/includes/basecommon9.ksi new file mode 100644 index 0000000..4f523a1 --- /dev/null +++ b/includes/basecommon9.ksi @@ -0,0 +1,9 @@ +keyboard us --xlayouts=us --vckeymap=us +timezone --isUtc --nontp UTC +selinux --enforcing +firewall --enabled --port=22:tcp +network --bootproto=dhcp --device=link --activate --onboot=on +services --enabled=sshd,NetworkManager,chronyd +shutdown +bootloader --location=mbr --driveorder=sda +lang en_US.UTF-8 diff --git a/includes/gen-packages9.ksi b/includes/gen-packages9.ksi new file mode 100644 index 0000000..544ee80 --- /dev/null +++ b/includes/gen-packages9.ksi @@ -0,0 +1,16 @@ +# Package setup +%packages +dracut-config-generic +kernel +kernel-core +grub2-common +grub2-efi-aa64 +grub2-efi-aa64-modules +grubby +efibootmgr +shim-aa64 +systemd-udev +uboot-tools +-dracut-config-rescue + +%end diff --git a/includes/gen-partitions9.ksi b/includes/gen-partitions9.ksi new file mode 100644 index 0000000..e7507fc --- /dev/null +++ b/includes/gen-partitions9.ksi @@ -0,0 +1,6 @@ +# Disk setup +clearpart --initlabel --all +part /boot/efi --asprimary --fstype=efi --size=512 +part /boot --asprimary --fstype=ext4 --size=1024 --label=boot +part swap --asprimary --fstype=swap --size=512 --label=swap +part / --asprimary --fstype=ext4 --size=3072 --label=rootfs diff --git a/includes/gen-postcommon9.ksi b/includes/gen-postcommon9.ksi new file mode 100644 index 0000000..f7affec --- /dev/null +++ b/includes/gen-postcommon9.ksi @@ -0,0 +1,55 @@ +%post +# Setting correct yum variable to use raspberrypi kernel repo +#echo "generic" > /etc/dnf/vars/kvariant +# +# Creating rocky user +/usr/sbin/useradd -m -p '$6$2cuo4i8NE.Gbde2m$jQ3tX0SeDp0ZSvGZUUKAWg774vPeWhcYYpBaJkMNjULBm.Q41NwwWt6kCoWjF07dEQGCn7U/Ei.wQHyhACqk9.' rocky +# Generic efi filename for VMs +mkdir -p /boot/efi/EFI/BOOT +if [ -d /boot/efi/EFI/rocky/ ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ];then + for j in grub.cfg grubenv;do + mv -f /boot/grub2/${j} /boot/efi/EFI/rocky/ + ln -s ../efi/EFI/rocky/${j} /boot/grub2/${j} + done + cp -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI +fi + +cp -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin +cp -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin + +rpm -e dracut-config-generic + +#setup dtb link by running "creating 10-devicetree.install" +if [ -x /lib/kernel/install.d/10-devicetree.install ];then + /lib/kernel/install.d/10-devicetree.install remove +fi + +### Write /etc/sysconfig/kernel +cat << EOF > /etc/sysconfig/kernel +# Written by image installer +# UPDATEDEFAULT specifies if new-kernel-pkg should make new kernels the default +UPDATEDEFAULT=yes + +# DEFAULTKERNEL specifies the default kernel package type +DEFAULTKERNEL=kernel-core +EOF +chmod 644 /etc/sysconfig/kernel + +### Write grub defaults, turn off OS probing as it is always wrong for image creation +cat << EOF > /etc/default/grub +GRUB_TIMEOUT=5 +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +GRUB_DEFAULT=saved +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="" +GRUB_DISABLE_RECOVERY="true" +GRUB_DISABLE_OS_PROBER="true" +GRUB_ENABLE_BLSCFG="false" +EOF +chmod 644 /etc/default/grub +# fixing the rpmdb +rpm --rebuilddb +# remove /boot/dtb for some rpi to boot +rm -f /boot/dtb +%end diff --git a/includes/gen-reposcommon9.ksi b/includes/gen-reposcommon9.ksi new file mode 100644 index 0000000..feceed5 --- /dev/null +++ b/includes/gen-reposcommon9.ksi @@ -0,0 +1 @@ +repo --name="instKern" --baseurl=https://rockyrepos.gnulab.org/gen_aarch64_el9/ --cost=100 --install diff --git a/includes/gen-rockycommon9.ksi b/includes/gen-rockycommon9.ksi new file mode 100644 index 0000000..7f4969d --- /dev/null +++ b/includes/gen-rockycommon9.ksi @@ -0,0 +1,9 @@ +rootpw --iscrypted $6$2cuo4i8NE.Gbde2m$jQ3tX0SeDp0ZSvGZUUKAWg774vPeWhcYYpBaJkMNjULBm.Q41NwwWt6kCoWjF07dEQGCn7U/Ei.wQHyhACqk9. +%include includes/basecommon9.ksi +%include includes/gen-partitions9.ksi +%include includes/packages9.ksi +%include includes/gen-packages9.ksi +%include includes/precommon9.ksi +%include includes/rockyreadme9.ksi +%include includes/gen-postcommon9.ksi +%include includes/postcommon9.ksi diff --git a/includes/packages9.ksi b/includes/packages9.ksi new file mode 100644 index 0000000..11316ae --- /dev/null +++ b/includes/packages9.ksi @@ -0,0 +1,18 @@ +# Package setup +%packages +@core +chrony +glibc-langpack-en +cloud-utils-growpart +net-tools +NetworkManager-wifi +nano +bash-completion +uboot-images-armv8 +bcm2711-firmware +bcm2835-firmware +bcm283x-firmware +bcm283x-overlays +-java-11-* + +%end diff --git a/includes/postcommon9.ksi b/includes/postcommon9.ksi new file mode 100644 index 0000000..a700e20 --- /dev/null +++ b/includes/postcommon9.ksi @@ -0,0 +1,10 @@ +%post +# 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 + +%end +%include includes/rootfs-expand.ksi diff --git a/includes/precommon9.ksi b/includes/precommon9.ksi new file mode 100644 index 0000000..1dc6221 --- /dev/null +++ b/includes/precommon9.ksi @@ -0,0 +1,4 @@ +%pre + +#End of Pre script for partitions +%end diff --git a/includes/rockyreadme9.ksi b/includes/rockyreadme9.ksi new file mode 100644 index 0000000..4add096 --- /dev/null +++ b/includes/rockyreadme9.ksi @@ -0,0 +1,11 @@ +%post +# Mandatory README file +cat >/root/README << EOF +== Rocky Linux 9 == + +If you want to automatically resize your / partition, just type the following (as root user): +rootfs-expand + +EOF + +%end diff --git a/includes/rockyrepos9.ksi b/includes/rockyrepos9.ksi new file mode 100644 index 0000000..224e52d --- /dev/null +++ b/includes/rockyrepos9.ksi @@ -0,0 +1,6 @@ +# Basic setup information +url --url="https://download.rockylinux.org/pub/rocky/9/BaseOS/aarch64/os/" +# Repositories to use +repo --name="rocky9-baseos" --baseurl=https://download.rockylinux.org/pub/rocky/9/BaseOS/aarch64/os/ +repo --name="rocky9-appstream" --baseurl=https://download.rockylinux.org/pub/rocky/9/AppStream/aarch64/os/ +repo --name="rocky9-powertools" --baseurl=https://download.rockylinux.org/pub/rocky/9/CRB/aarch64/os/