Skip to content

Commit

Permalink
Merge pull request #63 from jmarrero/iniramfs
Browse files Browse the repository at this point in the history
initramfs-module: add example adding a module to the initramfs
  • Loading branch information
jmarrero committed Jul 7, 2023
2 parents 66a7d18 + 01c6822 commit c068b65
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/initramfs-module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Build image: initramfs-module"

env:
IMAGE_NAME: "initramfs-module"

on:
pull_request:
branches:
- main
paths:
- initramfs-module/*
- .github/workflows/initramfs-module.yml
push:
branches:
- main
paths:
- initramfs-module/*
- .github/workflows/initramfs-module.yml

jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Build container image
uses: redhat-actions/buildah-build@v2
with:
context: ${{ env.IMAGE_NAME }}
containerfiles: ${{ env.IMAGE_NAME }}/Containerfile
image: ${{ env.IMAGE_NAME }}
layers: false
oci: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ functionality.
- [ansible-firewalld](ansible-firewalld/): Demos using [Ansible](https://github.com/ansible/ansible) to configure [firewalld](https://github.com/firewalld/firewalld)
- [build-zfs-module](build-zfs-module/): Build the ZFS third party module as rpm and install it
- [butane](butane/): Demos using https://github.com/coreos/butane
- [initramfs-module](initramfs-module/): Demos generating a initramfs with specific modules added and omitted.
- [inject-go-binary](inject-go-binary/): Demos adding building and injecting a Go binary + systemd unit
- [podman-next](podman-next): Use COPR to install the podman-next package
- [rsyslog](rsyslog/): Install and configure rsyslog to forward to a remote host
Expand Down
17 changes: 17 additions & 0 deletions initramfs-module/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This examples rebuilds the initramfs adding ostree, iscsi, ifcfg modules
# omiting the network-legacy and nouveau modules. After the initramfs is built it is moved to
# /lib/modules/$KERNEL_VERSION/initramfs.img where it will be used on ostree systems.
FROM quay.io/fedora/fedora-coreos:stable
USER root
RUN KERNEL_VERSION=$(rpm -q kernel | cut -c 8-); \
# In FCOS we add configuration files for dracut to ensure that the "base image" has its
# initramfs arguments embedded. They can be seen on:
# https://github.com/coreos/fedora-coreos-config/tree/testing-devel/overlay.d/05core/usr/lib/dracut
# This makes sure that required arguments are reused when running dracut in a container build like this one.
# Other distributions like RHCOS might not provide/require the same arguments and will need to be added to the
# dracut invocation.
# The RCHOS arguments needed can be seen on:
# https://github.com/openshift/os/blob/1f2c0eb7e370d2412db15fa28556f419ddf73c5d/common.yaml#L37
dracut --reproducible -v --add 'ostree' -f --omit-drivers 'nouveau' \
--add 'iscsi' --add 'ifcfg' --omit 'network-legacy' /lib/modules/$KERNEL_VERSION/initramfs.img $KERNEL_VERSION && \
ostree container commit

0 comments on commit c068b65

Please sign in to comment.