diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c818fc..43c51a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v${{ github.run_number }} - release_name: Build Number\:\ ${{ github.run_number }} + release_name: "Build Number: ${{ github.run_number }}" draft: false prerelease: false - name: Upload release asset @@ -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/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d21d793 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: Test + +on: + push: + branches: + - feature + pull_request: + types: + - opened + - reopened + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Run build + run: ./build.bash \ No newline at end of file diff --git a/build.bash b/build.bash index fac1866..d019b39 100755 --- a/build.bash +++ b/build.bash @@ -1,6 +1,6 @@ #!/bin/bash -. config/config.bash +. config.bash set -e @@ -22,40 +22,46 @@ sudo apt-get install -y\ libtool\ libpng-dev\ libfreetype-dev\ - git + git\ + grub-common\ + mtools -# Create the dist directory -mkdir -p dist/boot +# Create the directory structure +mkdir -p iso/boot/grub +mkdir -p initramfs/{bin,sbin,etc,dev,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} +wget https://www.kernel.org/pub/linux/kernel/v${LINUX_MAJOR}.x/linux-${LINUX_VERSION}.tar.xz +tar -xf linux-${LINUX_VERSION}.tar.xz +cd linux-${LINUX_VERSION} + 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 -wget https://busybox.net/downloads/busybox-${BUSYBOX_MAJOR}.${BUSYBOX_MINOR}.${BUSYBOX_PATCH}.tar.bz2 -tar -xf busybox-${BUSYBOX_MAJOR}.${BUSYBOX_MINOR}.${BUSYBOX_PATCH}.tar.bz2 -cd busybox-${BUSYBOX_MAJOR}.${BUSYBOX_MINOR}.${BUSYBOX_PATCH} +wget https://busybox.net/downloads/busybox-${BUSYBOX_VERSION}.tar.bz2 +tar -xf busybox-${BUSYBOX_VERSION}.tar.bz2 +cd busybox-${BUSYBOX_VERSION} cp ../config/busybox.config .config make -j$(nproc) - make CONFIG_PREFIX=../dist install + make CONFIG_PREFIX=../initramfs install cd .. +# Create the initramfs +cd initramfs + rm linuxrc # We'll be using a init sciprt instead + cp ../scripts/init.sh init + find . | cpio -H newc -o > ../iso/boot/initramfs.cpio +cd .. + +# 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 " ___ ___ ___ "; @@ -63,4 +69,4 @@ echo " | __|__ _ / _ \/ __|"; echo " | _|/ _\` | (_) \__ \\"; echo " |___\__, |\___/|___/"; echo " |___/ "; -echo "Is Built Successfully!"; \ No newline at end of file +echo "Is Built Successfully!"; diff --git a/config.bash b/config.bash new file mode 100644 index 0000000..d2eca06 --- /dev/null +++ b/config.bash @@ -0,0 +1,12 @@ +#!/bin/bash + +LINUX_MAJOR=6 +LINUX_MINOR=7 +LINUX_PATCH=4 + +BUSYBOX_MAJOR=1 +BUSYBOX_MINOR=36 +BUSYBOX_PATCH=1 + +LINUX_VERSION=${LINUX_MAJOR}.${LINUX_MINOR}.${LINUX_PATCH} +BUSYBOX_VERSION=${BUSYBOX_MAJOR}.${BUSYBOX_MINOR}.${BUSYBOX_PATCH} \ No newline at end of file diff --git a/config/config.bash b/config/config.bash deleted file mode 100755 index 2006492..0000000 --- a/config/config.bash +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -LINUX_MAJOR=6 -LINUX_MINOR=7 -LINUX_PATCH=4 - -BUSYBOX_MAJOR=1 -BUSYBOX_MINOR=36 -BUSYBOX_PATCH=1 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 diff --git a/scripts/init.sh b/scripts/init.sh new file mode 100644 index 0000000..6fbe832 --- /dev/null +++ b/scripts/init.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Disable Kernel Messages +dmesg -n 1 + +# Mount the file system +mount -t devtmpfs none /dev +mount -t proc none /dev +mount -t sysfs none /sys + +# Start shell +/bin/sh + +# Shutdown the machine when shell is exited +poweroff -f \ No newline at end of file