Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Build alpine initrd during image building #1924

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,17 @@ base-image:
END


IF [ -e "/usr/bin/dracut" ]
RUN --no-cache kernel=$(ls /lib/modules | head -n1) && depmod -a "${kernel}"

IF [ -f "/usr/bin/dracut" ]
# Regenerate initrd if necessary
RUN --no-cache kernel=$(ls /lib/modules | head -n1) && depmod -a "${kernel}"
RUN --no-cache kernel=$(ls /lib/modules | head -n1) && dracut -f "/boot/initrd-${kernel}" "${kernel}" && ln -sf "initrd-${kernel}" /boot/initrd
END

IF [ -f "/sbin/mkinitfs" ]
# Proper config files with immucore and custom initrd should already be in there installled by framework
RUN --no-cache kernel=$(ls /lib/modules | head -n1) && mkinitfs -o /boot/initrd $kernel
END
END

# Set /boot/vmlinuz pointing to our kernel so kairos-agent can use it
Expand All @@ -444,12 +450,6 @@ base-image:
RUN rm -rf /boot/initramfs-*
END

# Cleanup for alpine as this gets installed as a side-effect
# we already provide a /boot/initrd with the luet package
IF [ -e "/boot/initramfs-lts" ]
RUN rm /boot/initramfs-lts
END

IF [ ! -e "/boot/vmlinuz" ]
IF [ -e "/boot/vmlinuz-lts" ]
# Alpine provides the kernel under this name
Expand Down
14 changes: 3 additions & 11 deletions framework-profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,14 @@ flavors:
- common-packages
- kairos-toolchain
- openrc
- alpine-init
alpine-arm-rpi:
- common-packages
- kairos-toolchain
- openrc
- alpine-init-rpi
# See https://github.com/kairos-io/packages/pull/67 for rationale
alpine-init:
packages:
- distro-kernel/alpine
alpine-init-rpi:
packages:
- distro-kernel/alpine-rpi
openrc:
packages:
- init-svc/openrc
- initrd/alpine
systemd-base:
packages:
- init-svc/systemd
Expand Down Expand Up @@ -147,9 +139,9 @@ repositories:
priority: 2
urls:
- "quay.io/kairos/packages"
reference: 20231018075943-repository.yaml
reference: 20231019093159-repository.yaml
- !!merge <<: *kairos
arch: arm64
urls:
- "quay.io/kairos/packages-arm64"
reference: 20231018075844-repository.yaml
reference: 20231019092540-repository.yaml
8 changes: 8 additions & 0 deletions images/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ RUN apk --no-cache add \
coreutils \
cryptsetup \
curl \
device-mapper-udev \
dbus \
dmidecode \
dosfstools \
e2fsprogs \
e2fsprogs-extra \
efibootmgr \
eudev \
eudev-hwids \
fail2ban \
findutils \
findmnt \
gawk \
gcompat \
gettext \
Expand Down Expand Up @@ -76,6 +79,7 @@ RUN apk --no-cache add \
rbd-nbd \
rng-tools \
rsync \
sgdisk \
smartmontools \
squashfs-tools \
strace \
Expand All @@ -88,6 +92,7 @@ RUN apk --no-cache add \
wireguard-tools \
wpa_supplicant \
xfsprogs \
xfsprogs-extra \
xz

###############################################################
Expand All @@ -100,12 +105,15 @@ RUN apk --no-cache add \
bonding \
bridge \
rbd-nbd
RUN apk --no-cache add linux-lts --no-scripts

FROM common as rpicommon
COPY rpi/config.txt /boot/config.txt

FROM rpicommon AS rpi3
RUN apk --no-cache add linux-rpi --no-scripts # use --no-scripts to avoid building initramfs
FROM rpicommon AS rpi4
RUN apk --no-cache add linux-rpi4 --no-scripts # use --no-scripts to avoid building initramfs


###############################################################
Expand Down
Loading