Add essential initramfs integration for composefs support
- Add initramfs integration files based on debian-bootc project - Include bootc-initramfs-setup.service for systemd integration - Add dracut module-setup.sh for initramfs generation - Include prepare-root.conf for OSTree composefs configuration - Update Containerfile examples to include initramfs files - Fix systemctl calls to use symlinks instead of systemctl commands - Add comprehensive initramfs-integration.md documentation - Update README to reference new initramfs documentation Based on files from https://github.com/bootcrew/debian-bootc: - bootc-initramfs-setup.service - module-setup.sh - prepare-root.conf These files are essential for proper composefs support and boot functionality in Debian bootc images.
This commit is contained in:
parent
bd4c3e746f
commit
d204c35734
4 changed files with 333 additions and 4 deletions
|
|
@ -36,6 +36,67 @@ make
|
|||
sudo make install
|
||||
```
|
||||
|
||||
## Essential Initramfs Integration
|
||||
|
||||
**⚠️ CRITICAL**: For proper composefs support and boot functionality, you must include initramfs integration files in your base image. These files are essential for Debian bootc images and are based on the [debian-bootc project](https://github.com/bootcrew/debian-bootc).
|
||||
|
||||
### Required Files
|
||||
|
||||
Create these files in your build context:
|
||||
|
||||
**1. `files/37composefs/bootc-initramfs-setup.service`**:
|
||||
```ini
|
||||
[Unit]
|
||||
DefaultDependencies=no
|
||||
ConditionKernelCommandLine=composefs
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
After=sysroot.mount
|
||||
Requires=sysroot.mount
|
||||
Before=initrd-root-fs.target
|
||||
Before=initrd-switch-root.target
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=isolate
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/bootc-initramfs-setup
|
||||
StandardInput=null
|
||||
StandardOutput=journal
|
||||
StandardError=journal+console
|
||||
RemainAfterExit=yes
|
||||
```
|
||||
|
||||
**2. `files/37composefs/module-setup.sh`**:
|
||||
```bash
|
||||
#!/usr/bin/bash
|
||||
check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst \
|
||||
"${moddir}/bootc-initramfs-setup" /bin/bootc-initramfs-setup
|
||||
inst \
|
||||
"${moddir}/bootc-initramfs-setup.service" \
|
||||
"${systemdsystemunitdir}/bootc-initramfs-setup.service"
|
||||
$SYSTEMCTL -q --root "${initdir}" add-wants \
|
||||
'initrd-root-fs.target' 'bootc-initramfs-setup.service'
|
||||
}
|
||||
```
|
||||
|
||||
**3. `files/ostree/prepare-root.conf`**:
|
||||
```ini
|
||||
[composefs]
|
||||
enabled = yes
|
||||
|
||||
[sysroot]
|
||||
readonly = true
|
||||
```
|
||||
|
||||
### Step 1: Create Containerfile
|
||||
|
||||
Create a `Containerfile.base`:
|
||||
|
|
@ -51,12 +112,18 @@ RUN apt update && apt install -y \
|
|||
systemd-tmpfiles \
|
||||
kernel \
|
||||
initramfs-tools \
|
||||
dracut \
|
||||
grub2 \
|
||||
grub2-common \
|
||||
efibootmgr \
|
||||
ostree \
|
||||
&& apt clean
|
||||
|
||||
# Copy initramfs integration files
|
||||
COPY files/37composefs/bootc-initramfs-setup.service /usr/lib/systemd/system/
|
||||
COPY files/37composefs/module-setup.sh /usr/lib/dracut/modules.d/37composefs/
|
||||
COPY files/ostree/prepare-root.conf /usr/lib/ostree-boot/prepare-root.conf
|
||||
|
||||
# Create essential directories
|
||||
RUN mkdir -p /usr/lib/systemd/system \
|
||||
/usr/lib/systemd/user \
|
||||
|
|
@ -69,12 +136,15 @@ RUN mkdir -p /usr/lib/systemd/system \
|
|||
RUN ln -sf /lib/systemd/systemd /sbin/init
|
||||
|
||||
# Set up basic systemd configuration
|
||||
RUN systemctl set-default multi-user.target
|
||||
RUN ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
|
||||
|
||||
# Create essential systemd services
|
||||
RUN systemctl enable systemd-resolved.service \
|
||||
systemd-networkd.service \
|
||||
systemd-timesyncd.service
|
||||
RUN ln -sf /usr/lib/systemd/system/systemd-resolved.service \
|
||||
/etc/systemd/system/multi-user.target.wants/systemd-resolved.service
|
||||
RUN ln -sf /usr/lib/systemd/system/systemd-networkd.service \
|
||||
/etc/systemd/system/multi-user.target.wants/systemd-networkd.service
|
||||
RUN ln -sf /usr/lib/systemd/system/systemd-timesyncd.service \
|
||||
/etc/systemd/system/multi-user.target.wants/systemd-timesyncd.service
|
||||
|
||||
# Configure basic networking
|
||||
RUN echo -e "[Match]\nName=*\n\n[Network]\nDHCP=yes" > /etc/systemd/network/80-dhcp.network
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue