From f60010f706fff4f926fcee275d3c03fb64b765d4 Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Thu, 26 Oct 2023 19:13:38 +0700 Subject: [PATCH] cleanup files, more --- .github/workflows/build-katsu.yml | 12 +-- README.md | 18 ++++- katsu/modules/base/base-disk-aarch64.yaml | 94 +++++++++++++++++++++++ katsu/modules/base/base-disk-x86_64.yaml | 93 ++++++++++++++++++++++ katsu/modules/base/grub-setup.sh | 53 +++++++++++++ 5 files changed, 263 insertions(+), 7 deletions(-) create mode 100644 katsu/modules/base/base-disk-aarch64.yaml create mode 100644 katsu/modules/base/base-disk-x86_64.yaml create mode 100644 katsu/modules/base/grub-setup.sh diff --git a/.github/workflows/build-katsu.yml b/.github/workflows/build-katsu.yml index 96d609c..0d3c7d1 100644 --- a/.github/workflows/build-katsu.yml +++ b/.github/workflows/build-katsu.yml @@ -44,10 +44,12 @@ jobs: fail-fast: false matrix: variant: - - flagship - - gnome - - kde - - pantheon + - flagship/flagship-live + - gnome/gnome-live + - kde/kde-live + - pantheon/pantheon-live + - base/base-disk-x86_64 + - base/base-disk-aarch64 runs-on: ubuntu-latest container: image: ghcr.io/terrapkg/builder:f38 @@ -79,7 +81,7 @@ jobs: - name: Build ISO run: | pushd katsu - katsu --output=iso modules/${{ matrix.variant }}/${{ matrix.variant }}-live.yaml + katsu --output=iso modules/${{ matrix.variant }}.yaml popd - name: Upload ISO diff --git a/README.md b/README.md index ccc73be..c714849 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,19 @@ This repository contains various scripts and configuration files for building an Ultramarine Linux image. -It mainly contains Kickstart scripts, scripts which are used by the Anaconda installer to automatically install the initial Ultramarine Linux image, which are then built into the final bootable image using weldr's [Lorax](https://github.com/weldr/lorax) tool. +## Building an image + +Install Katsu + +```bash +dnf install katsu +``` + +Run Katsu on manifest + +```bash +katsu -o iso katsu/modules/flagship/flagship-live.yaml +``` ## Ultramarine Linux Docker/OCI image @@ -13,11 +25,13 @@ The image itself is similar to the vanilla Fedora image, but includes the Ultram ## Building locally To build the image locally, you need to have the following installed: + - Lorax - Anaconda - pykickstart You can then run the following command to build the image: + ``` ./build.sh -``` \ No newline at end of file +``` diff --git a/katsu/modules/base/base-disk-aarch64.yaml b/katsu/modules/base/base-disk-aarch64.yaml new file mode 100644 index 0000000..3ec7fca --- /dev/null +++ b/katsu/modules/base/base-disk-aarch64.yaml @@ -0,0 +1,94 @@ +builder: dnf +distro: Ultramarine Linux 39 + +users: + - username: ultramarine + # plaintext password: ultramarine + password: "$y$j9T$6/DebcxXazPrtBYnNXtEM.$yaUJHww5Mo1L8xNJ9IDJ.bvKOrIJxAG9PGQKWioBMx3" + groups: + - wheel + + +import: + - base.yaml + +scripts: + post: + - id: grub + name: Set up GRUB + file: grub-setup.sh + +disk: + size: 8GiB + partitions: + - label: EFI + size: 512MiB + filesystem: efi + mountpoint: /boot/efi + + - label: boot + size: 1GiB + filesystem: ext4 + mountpoint: /boot + + - label: root + # size: 2.5MiB + filesystem: ext4 + mountpoint: / + + +dnf: + releasever: 39 + arch: aarch64 + options: + - --setopt=cachedir=/var/cache/dnf + - --nogpgcheck + - --setopt=keepcache=True + exclude: + - fedora-release* + - generic-release* + packages: + - filesystem + - setup + - lvm2 + - btrfs-progs + - dmraid + - nvme-cli + - kernel + - glibc + - glibc-common + - dracut-config-generic + - dracut-tools + - dnf + - dracut + # - mkpasswd # maybe not needed soon + - "@core" + - "@standard" + - grub2-tools + - "@hardware-support" + - NetworkManager + - rpm + - libgomp + - ultramarine-release-identity-basic + - ultramarine-release-basic + - fedora-repos + - efibootmgr + + arch_packages: + aarch64: + - grub2-efi-aa64 + - grub2-efi-aa64-modules + - grub2-efi-aa64-cdboot + - shim-aa64 + - shim-unsigned-aarch64 + - bcm283x-firmware + - bcm283x-overlays + - "@arm-tools" + x86_64: + - grub2-efi-x64 + - grub2-efi-x64-modules + - grub2-efi-x64-cdboot + - grub2-pc + - grub2-pc-modules + - shim-x64 + - shim-unsigned-x64 diff --git a/katsu/modules/base/base-disk-x86_64.yaml b/katsu/modules/base/base-disk-x86_64.yaml new file mode 100644 index 0000000..f86cb16 --- /dev/null +++ b/katsu/modules/base/base-disk-x86_64.yaml @@ -0,0 +1,93 @@ +builder: dnf +distro: Ultramarine Linux 39 + +users: + - username: ultramarine + # plaintext password: ultramarine + password: "$y$j9T$6/DebcxXazPrtBYnNXtEM.$yaUJHww5Mo1L8xNJ9IDJ.bvKOrIJxAG9PGQKWioBMx3" + groups: + - wheel + + +import: + - base.yaml + +scripts: + post: + - id: grub + name: Set up GRUB + file: grub-setup.sh + +disk: + size: 8GiB + partitions: + - label: EFI + size: 512MiB + filesystem: efi + mountpoint: /boot/efi + + - label: boot + size: 1GiB + filesystem: ext4 + mountpoint: /boot + + - label: root + # size: 2.5MiB + filesystem: ext4 + mountpoint: / + + +dnf: + releasever: 39 + options: + - --setopt=cachedir=/var/cache/dnf + - --nogpgcheck + - --setopt=keepcache=True + exclude: + - fedora-release* + - generic-release* + packages: + - filesystem + - setup + - lvm2 + - btrfs-progs + - dmraid + - nvme-cli + - kernel + - glibc + - glibc-common + - dracut-config-generic + - dracut-tools + - dnf + - dracut + # - mkpasswd # maybe not needed soon + - "@core" + - "@standard" + - grub2-tools + - "@hardware-support" + - NetworkManager + - rpm + - libgomp + - ultramarine-release-identity-basic + - ultramarine-release-basic + - fedora-repos + - efibootmgr + + arch_packages: + aarch64: + - grub2-efi-aa64 + - grub2-efi-aa64-modules + - grub2-efi-aa64-cdboot + - shim-aa64 + - shim-unsigned-aarch64 + - bcm283x-firmware + - bcm283x-overlays + - "@arm-tools" + x86_64: + - grub2-efi-x64 + - grub2-efi-x64-modules + - grub2-efi-x64-cdboot + - grub2-pc + - grub2-pc-modules + - shim-x64 + - shim-unsigned-x64 diff --git a/katsu/modules/base/grub-setup.sh b/katsu/modules/base/grub-setup.sh new file mode 100644 index 0000000..65cc49b --- /dev/null +++ b/katsu/modules/base/grub-setup.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -x +# Disable os-prober for now + +echo "Disabling os-prober..." + +echo "GRUB_DISABLE_OS_PROBER=true" > /etc/default/grub +grub2-mkconfig > /boot/grub2/grub.cfg +rm /etc/default/grub + + +# get /dev/ of /boot, or / if /boot is not a separate partition +function find_bootdev { + # try findmnt /boot + if findmnt -n -o SOURCE /boot; then + bootdev=$(findmnt -n -o SOURCE /boot) + else + bootdev=$(findmnt -n -o SOURCE /) + fi +} + + +find_bootdev +# get blkid of /boot +bootid=$(blkid -s UUID -o value $bootdev) + +cat << EOF > /boot/efi/EFI/fedora/grub.cfg +search --no-floppy --fs-uuid --set=dev $bootid +set prefix=(\$dev)/grub2 + +export \$prefix +configfile \$prefix/grub.cfg +EOF + +# edit ro to rw in all entries + +sed -i 's/ ro / rw /g' /boot/loader/entries/*.conf + +dracut -vfN --add-drivers "virtio virtio_blk virtio_scsi xchi_pci mmc" --regenerate-all + +arch=$(uname -m) +if [[ $arch == "aarch64" ]]; then +cp -P /usr/share/uboot/rpi_arm64/u-boot.bin /boot/efi/rpi-u-boot.bin +cp -P /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin +cp -P /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin +fi +rm -f /var/lib/systemd/random-seed +rm -f /etc/NetworkManager/system-connections/*.nmconnection + +rm -f /etc/machine-id +touch /etc/machine-id + +rm -f /var/lib/rpm/__db* \ No newline at end of file