Skip to content

Commit

Permalink
Include arm-firwmare feature
Browse files Browse the repository at this point in the history
This commit introduces an arm-firmware feature adding
the required after-* hooks to ensure the RPi firmware is
copied to the EFI partition.

It could be, eventually, extended to support other boards
and it does not harm systems which are not including RPi
firmware.

Signed-off-by: David Cassany <dcassany@suse.com>
  • Loading branch information
davidcassany committed Sep 24, 2024
1 parent fa0ff06 commit d1e51eb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
7 changes: 0 additions & 7 deletions examples/green-rpi/01_rpi-firmware.yaml

This file was deleted.

7 changes: 1 addition & 6 deletions examples/green-rpi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ COPY --from=TOOLKIT /usr/bin/elemental /usr/bin/elemental
RUN systemctl enable NetworkManager.service

# Generate initrd with required elemental services
RUN elemental init -f && \
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi && \
rm -rf /var/log/update* && \
>/var/log/lastlog && \
rm -rf /boot/vmlinux*
RUN elemental --debug init --force

# Update os-release file with some metadata
RUN echo IMAGE_REPO=\"${REPO}\" >> /etc/os-release && \
Expand Down
20 changes: 20 additions & 0 deletions pkg/features/embedded/arm-firmware/system/oem/00_armfirmware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Set ARM Firmware"
stages:
after-install-chroot:
- &pifirmware
name: Raspberry PI post hook
if: '[ -d "/boot/vc" ]'
commands:
- cp -rf /boot/vc/* /run/elemental/efi/

after-upgrade-chroot:
- <<: *pifirmware

after-reset-chroot:
- <<: *pifirmware

after-disk:
- name: Raspberry PI post hook
if: '[ -d "/run/elemental-build/workingtree/boot/vc" ]'
commands:
- cp -rf /run/elemental-build/workingtree/boot/vc/* /run/elemental-build/efi/
5 changes: 5 additions & 0 deletions pkg/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const (
FeatureCloudConfigEssentials = "cloud-config-essentials"
FeatureBootAssessment = "boot-assessment"
FeatureAutologin = "autologin"
FeatureArmFirmware = "arm-firmware"
)

var (
Expand All @@ -67,6 +68,7 @@ var (
FeatureCloudConfigDefaults,
FeatureCloudConfigEssentials,
FeatureBootAssessment,
FeatureArmFirmware,
}

Default = []string{
Expand All @@ -79,6 +81,7 @@ var (
FeatureCloudConfigDefaults,
FeatureCloudConfigEssentials,
FeatureBootAssessment,
FeatureArmFirmware,
}
)

Expand Down Expand Up @@ -171,6 +174,8 @@ func Get(names []string) ([]*Feature, error) {
features = append(features, New(name, units))
case FeatureAutologin:
features = append(features, New(name, nil))
case FeatureArmFirmware:
features = append(features, New(name, nil))
default:
notFound = append(notFound, name)
}
Expand Down

0 comments on commit d1e51eb

Please sign in to comment.