Skip to content

Commit

Permalink
feat: build initramfs for surface, asus and nvidia (ublue-os#258)
Browse files Browse the repository at this point in the history
* feat: build initramfs for surface, asus and nvidia

* fix: add cliwrap for initramfs gereration

* fix: missing && and don't cliwrap twice

---------

Co-authored-by: Mark Mihalik <[email protected]>
  • Loading branch information
m2Giles and Mark Mihalik authored Jun 28, 2024
1 parent 7b601f1 commit 1b2c042
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ COPY ${KERNEL_FLAVOR}/ /tmp/
RUN mkdir -p /var/lib/alternatives && \
IMAGE_FLAVOR=main /tmp/image-info.sh && \
/tmp/install.sh && \
if [ "${KERNEL_FLAVOR}" != "main" ]; then \
/tmp/build-initramfs.sh \
; fi && \
mv /var/lib/alternatives /staged-alternatives && \
rm -rf /tmp/* /var/* && \
ostree container commit && \
Expand All @@ -41,6 +44,7 @@ COPY *.sh /tmp/
RUN mkdir -p /var/lib/alternatives && \
IMAGE_FLAVOR=nvidia /tmp/image-info.sh && \
/tmp/nvidia-install.sh && \
/tmp/build-initramfs.sh && \
mv /var/lib/alternatives /staged-alternatives && \
rm -rf /tmp/* /var/* && \
ostree container commit && \
Expand Down
20 changes: 20 additions & 0 deletions build-initramfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/bash

set -oue pipefail


if [[ "${KERNEL_FLAVOR}" == "surface" ]]; then
KERNEL_SUFFIX="surface"
else
KERNEL_SUFFIX=""
fi

if [ ! -f /usr/libexec/rpm-ostree/wrapped/dracut ]; then
rpm-ostree cliwrap install-to-root /
fi

QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(|'"$KERNEL_SUFFIX"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$KERNEL_SUFFIX"'-)//')"

/usr/libexec/rpm-ostree/wrapped/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible -v --add ostree -f "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"

chmod 0600 "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"

0 comments on commit 1b2c042

Please sign in to comment.