From 7a232105b8489afd22afe928c81c42ddf6dcc3f1 Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Sat, 30 Sep 2023 22:19:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 21 +++++++ .gitignore | 7 ++- build.py | 2 +- build.sh | 106 ------------------------------------ configs/limine.cfg | 2 +- 5 files changed, 28 insertions(+), 110 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 build.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c13b086 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,21 @@ +name: CI BUILD + +on: + push: + branches-ignore: [ "pages" ] + pull_request: + branches-ignore: [ "pages" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: install Python3 + run: sudo apt install python3 + - name: build + run: python3 build.py + - name: check + run: ls -la diff --git a/.gitignore b/.gitignore index 8fff370..9968f4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ -kernel.elf -mseos.hdd +*.elf +*.hdd +*.iso +*.0 + bin/ limine/ ovmf/ diff --git a/build.py b/build.py index ea188b9..b6f1065 100644 --- a/build.py +++ b/build.py @@ -118,4 +118,4 @@ if __name__ == "__main__": compile_all() create_hdd("mseos") - os.system("qemu-system-x86_64 -M q35 -m 8G -smp 8 -bios ovmf/OVMF.fd -hda mseos.hdd") \ No newline at end of file + print("qemu-system-x86_64 -M q35 -m 8G -smp 8 -bios ovmf/OVMF.fd -hda mseos.hdd") \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100644 index 478a8a2..0000000 --- a/build.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -CC="g++" -ARCH_FLAGS="-m64 -march=x86-64 -mabi=sysv -mno-80387 -mno-red-zone -mcmodel=kernel -MMD -MP" -WARN_FLAGS="-Wall -Wextra" -STANDART_FLAGS="-std=gnu11" -PROTECT_FLAGS="-O0 -pipe -ffreestanding -fno-stack-protector -fno-lto -fno-stack-check -fno-PIC -fno-PIE" -CHARSET_FLAGS="-finput-charset=UTF-8 -fexec-charset=cp1251" -LIBS_FLAGS="-Ilimine" - -find_files() { - file_list=() - directory=$1 - extensions=$2 - while IFS= read -r -d '' file; do - file_list+=("$file") - done < <(find "$directory" -type f \( -name "*.c" -o -name "*.cpp" -o -name "*.s" \) -print0) - printf '%s\n' "${file_list[@]}" -} - -compile() { - file=$1 - output_file="${file/\//-}" - obj_file="bin/${output_file}.o" - cmd="$CC $WARN_FLAGS $PROTECT_FLAGS $ARCH_FLAGS $CHARSET_FLAGS $LIBS_FLAGS -c $file -o $obj_file" - echo "$cmd" - eval "$cmd" - echo "$obj_file" -} - -compile_all() { - file_list=$(find_files "kernel/" ".c .cpp .s") - IFS=$'\n' read -rd '' -a file_array <<<"$file_list" - - for file in "${file_array[@]}"; do - compile "$file" - done - - while [[ $(grep -o "bin/.*\.o" <<<"${results[*]}") ]]; do - sleep 1 - done - - cmd="ld -nostdlib -static -m elf_x86_64 -z max-page-size=0x1000 -T configs/linker.ld -o kernel.elf ${results[*]}" - echo "$cmd" - eval "$cmd" -} - -check_limine() { - if [ ! -d "limine" ]; then - git clone "https://github.com/limine-bootloader/limine.git" --branch=v5.x-branch-binary --depth=1 - else - pushd "limine" - git pull - popd - fi - pushd "limine" - make - popd -} - -check_tools() { - required_tools=("g++" "xorriso" "make" "mtools") - missing_tools=() - - for tool in "${required_tools[@]}"; do - if ! command -v "$tool" >/dev/null 2>&1; then - missing_tools+=("$tool") - fi - done - - if (( ${#missing_tools[@]} > 0 )); then - sudo apt install "${missing_tools[@]}" - fi -} - -create_iso() { - IMAGE_NAME=$1 - rm -rf "iso_root" - mkdir -p "iso_root" - cp -v "boot/CYRILL2.F16" "iso_root/" - cp -v "kernel.elf" "configs/limine.cfg" "limine/limine-bios.sys" "limine/limine-bios-cd.bin" "limine/limine-uefi-cd.bin" "iso_root/" - mkdir -p "iso_root/EFI/BOOT" - cp -v "limine/BOOTX64.EFI" "iso_root/EFI/BOOT/" - cp -v "limine/BOOTIA32.EFI" "iso_root/EFI/BOOT/" - xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label iso_root -o "${IMAGE_NAME}.iso" - ./limine/limine bios-install "${IMAGE_NAME}.iso" - rm -rf "iso_root" -} - -create_hdd() { - IMAGE_NAME=$1 - rm -f "${IMAGE_NAME}.hdd" - dd if=/dev/zero bs=1M count=0 seek=64 of="${IMAGE_NAME}.hdd" - sgdisk "${IMAGE_NAME}.hdd" -n 1:2048 -t 1:ef00 - ./limine/limine bios-install "${IMAGE_NAME}.hdd" - mformat -i "${IMAGE_NAME}.hdd@@1M" - mmd -i "${IMAGE_NAME}.hdd@@1M" "::/EFI" "::/EFI/BOOT" - mcopy -i "${IMAGE_NAME}.hdd@@1M" "kernel.elf" "configs/limine.cfg" "boot/CYRILL2.F16" "limine/limine-bios.sys" "::/" - mcopy -i "${IMAGE_NAME}.hdd@@1M" "limine/BOOTX64.EFI" "limine/BOOTIA32.EFI" "::/EFI/BOOT" -} - -check_limine -check_tools -compile_all -create_iso "MSEOS" -create_hdd "MSEOS" \ No newline at end of file diff --git a/configs/limine.cfg b/configs/limine.cfg index 65713aa..e15fb8b 100644 --- a/configs/limine.cfg +++ b/configs/limine.cfg @@ -1,6 +1,6 @@ TIMEOUT=5 DEFAULT_ENTRY=0 -INTERFACE_BRANDING=By Aren Elchinyan [Арен Елчинян]1234 +INTERFACE_BRANDING=By Aren Elchinyan TERM_FONT=boot:///CYRILL2.F16 TERM_FONT_SIZE=8x16