mirror of
https://github.com/johndoe6345789/SparkOS.git
synced 2026-04-24 13:34:56 +00:00
Add initrd generation and fix duplicate image shipping
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
18
.github/workflows/build-image.yml
vendored
18
.github/workflows/build-image.yml
vendored
@@ -141,18 +141,14 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: sparkos-image-${{ github.sha }}
|
name: sparkos-image-${{ github.sha }}
|
||||||
path: |
|
path: release/sparkos-image.zip
|
||||||
release/sparkos-image.zip
|
|
||||||
release/sparkos.img.gz
|
|
||||||
retention-days: 90
|
retention-days: 90
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
files: |
|
files: release/sparkos-image.zip
|
||||||
release/sparkos-image.zip
|
|
||||||
release/sparkos.img.gz
|
|
||||||
body: |
|
body: |
|
||||||
# SparkOS UEFI-Bootable Disk Image Release ${{ github.ref_name }}
|
# SparkOS UEFI-Bootable Disk Image Release ${{ github.ref_name }}
|
||||||
|
|
||||||
@@ -160,8 +156,7 @@ jobs:
|
|||||||
|
|
||||||
## What's Included
|
## What's Included
|
||||||
|
|
||||||
- **sparkos-image.zip**: Complete package with image and README
|
- **sparkos-image.zip**: Complete package with compressed disk image and README
|
||||||
- **sparkos.img.gz**: Compressed UEFI-bootable disk image (~1GB)
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -177,8 +172,11 @@ jobs:
|
|||||||
### Write to USB and Boot
|
### Write to USB and Boot
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download and decompress
|
# Download and extract the package
|
||||||
wget https://github.com/johndoe6345789/SparkOS/releases/download/${{ github.ref_name }}/sparkos.img.gz
|
wget https://github.com/johndoe6345789/SparkOS/releases/download/${{ github.ref_name }}/sparkos-image.zip
|
||||||
|
unzip sparkos-image.zip
|
||||||
|
|
||||||
|
# Decompress the image
|
||||||
gunzip sparkos.img.gz
|
gunzip sparkos.img.gz
|
||||||
|
|
||||||
# Write to USB drive (Linux - BE CAREFUL!)
|
# Write to USB drive (Linux - BE CAREFUL!)
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ echo "=== Downloading Linux kernel from Ubuntu repositories ==="
|
|||||||
mkdir -p /kernel
|
mkdir -p /kernel
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
|
# Install initramfs-tools for generating initrd
|
||||||
|
echo "Installing initramfs-tools..."
|
||||||
|
apt-get install -y initramfs-tools
|
||||||
|
|
||||||
# Get the actual kernel package name (not the metapackage)
|
# Get the actual kernel package name (not the metapackage)
|
||||||
echo "Finding latest kernel package..."
|
echo "Finding latest kernel package..."
|
||||||
KERNEL_PKG=$(apt-cache depends linux-image-generic | grep -E 'Depends.*linux-image-[0-9]' | head -1 | awk '{print $2}')
|
KERNEL_PKG=$(apt-cache depends linux-image-generic | grep -E 'Depends.*linux-image-[0-9]' | head -1 | awk '{print $2}')
|
||||||
@@ -20,7 +24,7 @@ fi
|
|||||||
echo "Downloading kernel package: $KERNEL_PKG"
|
echo "Downloading kernel package: $KERNEL_PKG"
|
||||||
apt-get download "$KERNEL_PKG"
|
apt-get download "$KERNEL_PKG"
|
||||||
|
|
||||||
# Extract the kernel package
|
# Extract the kernel package to /kernel
|
||||||
echo "Extracting kernel..."
|
echo "Extracting kernel..."
|
||||||
dpkg -x ${KERNEL_PKG}*.deb /kernel
|
dpkg -x ${KERNEL_PKG}*.deb /kernel
|
||||||
|
|
||||||
@@ -37,6 +41,30 @@ if [ -z "$KERNEL_FILE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Kernel extracted successfully: $KERNEL_FILE"
|
echo "Kernel extracted successfully: $KERNEL_FILE"
|
||||||
|
|
||||||
|
# Extract kernel version from the kernel filename
|
||||||
|
KERNEL_VERSION=$(basename $KERNEL_FILE | sed 's/vmlinuz-//')
|
||||||
|
echo "Kernel version: $KERNEL_VERSION"
|
||||||
|
|
||||||
|
# Copy kernel modules to system location so mkinitramfs can find them
|
||||||
|
echo "Copying kernel modules to system location..."
|
||||||
|
if [ -d /kernel/lib/modules/${KERNEL_VERSION} ]; then
|
||||||
|
cp -r /kernel/lib/modules/${KERNEL_VERSION} /lib/modules/
|
||||||
|
else
|
||||||
|
echo "WARNING: No modules found for kernel ${KERNEL_VERSION}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate initrd using mkinitramfs
|
||||||
|
echo "Generating initrd for kernel version $KERNEL_VERSION..."
|
||||||
|
mkinitramfs -o /kernel/boot/initrd.img-${KERNEL_VERSION} ${KERNEL_VERSION}
|
||||||
|
|
||||||
|
# Verify initrd was created
|
||||||
|
if [ ! -f /kernel/boot/initrd.img-${KERNEL_VERSION} ]; then
|
||||||
|
echo "ERROR: Failed to generate initrd"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Initrd generated successfully: /kernel/boot/initrd.img-${KERNEL_VERSION}"
|
||||||
ls -lh /kernel/boot/
|
ls -lh /kernel/boot/
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
|
|||||||
Reference in New Issue
Block a user