Merge pull request #1 from nishad-prime/feature

alpha 0.1
This commit is contained in:
Nasir Hossain Nishad 2024-02-16 21:40:35 +06:00 committed by GitHub
commit ca2e5495ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 100 additions and 34 deletions

View File

@ -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

25
.github/workflows/test.yml vendored Normal file
View File

@ -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

View File

@ -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!";
echo "Is Built Successfully!";

12
config.bash Normal file
View File

@ -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}

View File

@ -1,9 +0,0 @@
#!/bin/bash
LINUX_MAJOR=6
LINUX_MINOR=7
LINUX_PATCH=4
BUSYBOX_MAJOR=1
BUSYBOX_MINOR=36
BUSYBOX_PATCH=1

17
config/grub.cfg Normal file
View File

@ -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
}

15
scripts/init.sh Normal file
View File

@ -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