diff --git a/packages/initrd/build.yaml b/packages/initrd/build.yaml new file mode 100644 index 0000000..56ffae3 --- /dev/null +++ b/packages/initrd/build.yaml @@ -0,0 +1,28 @@ +requires: +- name: "{{.Values.name}}" + category: "distro-kernels" + version: ">=0" + +copy: +# The toolkit is required in module-setup and embedded in the initramfs. +- package: + category: "system" + {{ if eq .Values.name "opensuse" }} + name: "elemental-toolkit" + {{ else }} + name: "elemental-toolkit-{{.Values.name}}" + {{ end }} + version: ">=0" + source: "/framework/." + destination: "/" + +prelude: +# remove if any +- rm -rf /boot/initrd || true + +steps: +# Create initrd +- | + kernel=$(ls /lib/modules | head -n1) && \ + dracut -f "/boot/initrd-${kernel}" "${kernel}" && \ + ln -sf "initrd-${kernel}" /boot/initrd \ No newline at end of file diff --git a/packages/initrd/collection.yaml b/packages/initrd/collection.yaml new file mode 100644 index 0000000..8fcff63 --- /dev/null +++ b/packages/initrd/collection.yaml @@ -0,0 +1,10 @@ +packages: +- name: "opensuse" + category: "distro-initrd" + version: "0.1" +- name: "fedora" + category: "distro-initrd" + version: "0.1" +- name: "ubuntu" + category: "distro-initrd" + version: "0.1" \ No newline at end of file diff --git a/packages/kernels/build.yaml b/packages/kernels/build.yaml new file mode 100644 index 0000000..2771ed6 --- /dev/null +++ b/packages/kernels/build.yaml @@ -0,0 +1,39 @@ +image: "{{.Values.image}}:{{.Values.version}}" +excludes: +- ^/boot/grub2 +- ^/boot/initrd + +unpack: true +includes: +- ^/boot|^/boot/.* +- ^/lib/modules|^/lib/modules.* + +steps: +{{ if .Values.distribution }} +{{if eq .Values.distribution "opensuse" }} +- zypper in -y --no-recommends {{.Values.kernel_package}} +- zypper cc +{{ if .Values.arch }} + {{ if eq .Values.arch "aarch64" }} +# aarch64 has an uncompressed kernel so we need to link it to vmlinuz +- | + kernel=$(ls /boot/Image-* | head -n1) && \ + ln -sf "${kernel#/boot/}" /boot/vmlinuz + {{ end }} +{{ end }} +{{else if eq .Values.distribution "fedora" }} +- dnf install -y {{.Values.kernel_package}} +- dnf clean all +- | + kernel=$(ls /boot/vmlinuz-* | head -n1) && \ + ln -sf "${kernel#/boot/}" /boot/vmlinuz +{{else if eq .Values.distribution "ubuntu" }} +# Note for future issues with grub: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1879558 https://github.com/rancher-sandbox/cOS-toolkit/pull/101#discussion_r621929109 +- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y {{.Values.kernel_package}} +- apt-get clean +- | + kernel=$(ls /boot/vmlinuz-* | head -n1) && \ + ln -sf "${kernel#/boot/}" /boot/vmlinuz +{{end}} +{{end}} +- kernel=$(ls /lib/modules | head -n1) && depmod -a "${kernel}" diff --git a/packages/kernels/collection.yaml b/packages/kernels/collection.yaml new file mode 100644 index 0000000..b29687f --- /dev/null +++ b/packages/kernels/collection.yaml @@ -0,0 +1,19 @@ +packages: +- category: "distro-kernels" + name: "opensuse" + version: "15.4" + image: "opensuse/leap" + distribution: "opensuse" + kernel_package: "kernel-default dracut kernel-firmware-all" +- category: "distro-kernels" + name: "fedora" + version: "36" + image: "fedora" + distribution: "fedora" + kernel_package: "kernel grub2 kernel-core dracut dracut-live" +- category: "distro-kernels" + name: "ubuntu" + version: "20.04" + image: "ubuntu" + distribution: "ubuntu" + kernel_package: "linux-image-generic-hwe-20.04 dracut dracut-network" \ No newline at end of file