diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6947d98..43c51a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/boot/boot.img + asset_path: ./egos.iso asset_name: egos-v${{ github.run_number }}.img asset_content_type: application/octet-stream diff --git a/build.bash b/build.bash index fac1866..953155c 100755 --- a/build.bash +++ b/build.bash @@ -22,19 +22,22 @@ sudo apt-get install -y\ libtool\ libpng-dev\ libfreetype-dev\ - git + git\ + grub-common -# Create the dist directory -mkdir -p dist/boot +# Create the directory structure +mkdir -p iso/boot/grub +mkdir -p initramfs/{bin,sbin,etc,proc,sys,usr/{bin,sbin}} # Download the kernel source wget https://www.kernel.org/pub/linux/kernel/v${LINUX_MAJOR}.x/linux-${LINUX_MAJOR}.${LINUX_MINOR}.${LINUX_PATCH}.tar.xz tar -xf linux-${LINUX_MAJOR}.${LINUX_MINOR}.${LINUX_PATCH}.tar.xz cd linux-${LINUX_MAJOR}.${LINUX_MINOR}.${LINUX_PATCH} + make -j$(nproc) x86_64_defconfig cp ../config/linux.config .config - make -j$(nproc) + make -j$(nproc) bzImage echo $PWD - cp arch/x86/boot/bzImage ../dist/boot/. + cp arch/x86/boot/bzImage ../iso/boot/. cd .. # Download the busybox source @@ -43,19 +46,22 @@ tar -xf busybox-${BUSYBOX_MAJOR}.${BUSYBOX_MINOR}.${BUSYBOX_PATCH}.tar.bz2 cd busybox-${BUSYBOX_MAJOR}.${BUSYBOX_MINOR}.${BUSYBOX_PATCH} cp ../config/busybox.config .config make -j$(nproc) - make CONFIG_PREFIX=../dist install + make CONFIG_PREFIX=../initramfs install cd .. +# Create the initramfs +sudo mount -t proc /proc initramfs/proc +sudo mount -t sysfs /sys initramfs/sys +sudo mount -o bind /dev initramfs/dev +sudo mount -o bind /dev/pts initramfs/dev/pts +cd initramfs + find . | cpio -H newc -o > ../iso/boot/initramfs.cpio + +# Install GRUB +cp config/grub.cfg iso/boot/grub/grub.cfg + # Create the bootable image -dd if=/dev/zero of=dist/boot/boot.img bs=1M count=256 -mkfs.ext4 dist/boot/boot.img -mkdir -p dist/mnt -sudo mount dist/boot/boot.img dist/mnt - set +e - sudo cp -r dist/* dist/mnt/. - set -e - sudo umount dist/mnt -sudo rmdir dist/mnt +grub-mkrescue -o egos.iso iso # The image is ready to be used echo " ___ ___ ___ "; diff --git a/config/grub.cfg b/config/grub.cfg new file mode 100644 index 0000000..afc6938 --- /dev/null +++ b/config/grub.cfg @@ -0,0 +1,17 @@ +set default=0 +set timeout=10 +insmod efi_gop +insmod font +if loadfont /boot/grub/fonts/unicode.pf2 +then + insmod gfxterm + set gfxmode-auto + set gfxpayload=keep + terminal_output gfxterm +fi +menuentry 'EgOS LINUX' --class os { + insmod gzio + insmod part_msdos + linux /boot/bzImage + initrd /boot/initramfs.cpio +} \ No newline at end of file