From a6736d0bbf8dcce92455c17dce146a31c0088e46 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 00:52:35 +0000 Subject: [PATCH 1/4] Initial plan From b6b85e445be6c8da22f268e455f52c7d8a4195ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 00:57:57 +0000 Subject: [PATCH 2/4] Add initrd generation and fix duplicate image shipping Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- .github/workflows/build-image.yml | 18 +++++++-------- scripts/docker-image-download-kernel.sh | 30 ++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 5fcc3f2..d91532f 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -141,18 +141,14 @@ jobs: uses: actions/upload-artifact@v4 with: name: sparkos-image-${{ github.sha }} - path: | - release/sparkos-image.zip - release/sparkos.img.gz + path: release/sparkos-image.zip retention-days: 90 - name: Create GitHub Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: - files: | - release/sparkos-image.zip - release/sparkos.img.gz + files: release/sparkos-image.zip body: | # SparkOS UEFI-Bootable Disk Image Release ${{ github.ref_name }} @@ -160,8 +156,7 @@ jobs: ## What's Included - - **sparkos-image.zip**: Complete package with image and README - - **sparkos.img.gz**: Compressed UEFI-bootable disk image (~1GB) + - **sparkos-image.zip**: Complete package with compressed disk image and README ## Features @@ -177,8 +172,11 @@ jobs: ### Write to USB and Boot ```bash - # Download and decompress - wget https://github.com/johndoe6345789/SparkOS/releases/download/${{ github.ref_name }}/sparkos.img.gz + # Download and extract the package + 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 # Write to USB drive (Linux - BE CAREFUL!) diff --git a/scripts/docker-image-download-kernel.sh b/scripts/docker-image-download-kernel.sh index 6dcd6ca..62e207e 100755 --- a/scripts/docker-image-download-kernel.sh +++ b/scripts/docker-image-download-kernel.sh @@ -8,6 +8,10 @@ echo "=== Downloading Linux kernel from Ubuntu repositories ===" mkdir -p /kernel 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) 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}') @@ -20,7 +24,7 @@ fi echo "Downloading kernel package: $KERNEL_PKG" apt-get download "$KERNEL_PKG" -# Extract the kernel package +# Extract the kernel package to /kernel echo "Extracting kernel..." dpkg -x ${KERNEL_PKG}*.deb /kernel @@ -37,6 +41,30 @@ if [ -z "$KERNEL_FILE" ]; then fi 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/ # Clean up From 634d11af0dd1aee0cf1cb55af224b0b597857a68 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 00:59:42 +0000 Subject: [PATCH 3/4] Fix shell variable quoting for security Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- scripts/docker-image-download-kernel.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/docker-image-download-kernel.sh b/scripts/docker-image-download-kernel.sh index 62e207e..4ece0b8 100755 --- a/scripts/docker-image-download-kernel.sh +++ b/scripts/docker-image-download-kernel.sh @@ -43,23 +43,23 @@ fi echo "Kernel extracted successfully: $KERNEL_FILE" # Extract kernel version from the kernel filename -KERNEL_VERSION=$(basename $KERNEL_FILE | sed 's/vmlinuz-//') +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/ +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} +mkinitramfs -o "/kernel/boot/initrd.img-${KERNEL_VERSION}" "${KERNEL_VERSION}" # Verify initrd was created -if [ ! -f /kernel/boot/initrd.img-${KERNEL_VERSION} ]; then +if [ ! -f "/kernel/boot/initrd.img-${KERNEL_VERSION}" ]; then echo "ERROR: Failed to generate initrd" exit 1 fi From 5b6d3749337105815070cc6ae2f14dcb562dec19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 01:01:23 +0000 Subject: [PATCH 4/4] Complete shell variable quoting fixes Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- scripts/docker-image-download-kernel.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/docker-image-download-kernel.sh b/scripts/docker-image-download-kernel.sh index 4ece0b8..de33f0f 100755 --- a/scripts/docker-image-download-kernel.sh +++ b/scripts/docker-image-download-kernel.sh @@ -26,7 +26,7 @@ apt-get download "$KERNEL_PKG" # Extract the kernel package to /kernel echo "Extracting kernel..." -dpkg -x ${KERNEL_PKG}*.deb /kernel +dpkg -x "${KERNEL_PKG}"*.deb /kernel # Verify kernel was extracted if [ ! -d /kernel/boot ]; then @@ -68,4 +68,4 @@ echo "Initrd generated successfully: /kernel/boot/initrd.img-${KERNEL_VERSION}" ls -lh /kernel/boot/ # Clean up -rm -rf /var/lib/apt/lists/* ${KERNEL_PKG}*.deb +rm -rf /var/lib/apt/lists/* "${KERNEL_PKG}"*.deb