From b35b559cd9d2c659719ae3c657df5db701cf1fd2 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 25 Mar 2026 07:29:37 -0400 Subject: [PATCH] boot: Load M1X kernel through limine Signed-off-by: Ian Moffett --- .gitignore | 1 + src/Makefile | 6 +++++- src/boot/Makefile | 15 +++++++++++++++ src/boot/host/deps.sh | 11 +++++++++++ src/boot/host/iso.sh | 32 ++++++++++++++++++++++++++++++++ src/data/boot/limine.conf | 11 +++++++++++ 6 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/boot/Makefile create mode 100755 src/boot/host/deps.sh create mode 100755 src/boot/host/iso.sh create mode 100644 src/data/boot/limine.conf diff --git a/.gitignore b/.gitignore index aab2932..9bf13f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /var +/src/boot/stand/ *.o *.d *.sys diff --git a/src/Makefile b/src/Makefile index 0fe9182..aa93e77 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,11 @@ include mk/default.mk .PHONY: all -all: sdk m1x +all: sdk m1x boot + +.PHONY: boot +boot: + cd boot/; make .PHONY: sdk sdk: diff --git a/src/boot/Makefile b/src/boot/Makefile new file mode 100644 index 0000000..99286db --- /dev/null +++ b/src/boot/Makefile @@ -0,0 +1,15 @@ +# +# Copyright (c) 2026, Mirocom Laboratories +# Provided under the BSD-3 clause +# + +.PHONY: all +all: deps iso + +.PHONY: deps +deps: + ./host/deps.sh + +.PHONY: iso +iso: + ./host/iso.sh diff --git a/src/boot/host/deps.sh b/src/boot/host/deps.sh new file mode 100755 index 0000000..c804888 --- /dev/null +++ b/src/boot/host/deps.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# +# Copyright (c) 2026, Mirocom Laboratories +# Provided under the BSD-3 clause +# + +if [ ! -d stand/limine ]; then + git clone https://codeberg.org/Limine/Limine.git --branch=v10.x-binary --depth=1 stand/limine + make -C stand/limine +fi diff --git a/src/boot/host/iso.sh b/src/boot/host/iso.sh new file mode 100755 index 0000000..c4f6fb7 --- /dev/null +++ b/src/boot/host/iso.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# +# Copyright (c) 2026, Mirocom Laboratories +# Provided under the BSD-3 clause +# + + +set -e + +ISO=../../m1x.iso +CONFIG=../data/boot/limine.conf +KERNEL=../m1x/m1x.sys + +mkdir -p iso_root/boot/ + +# Copy the kernel to the ISO root +cp $KERNEL iso_root/boot + +# Copy boot files +cp $CONFIG stand/limine/limine-bios.sys \ + stand/limine/limine-bios-cd.bin \ + stand/limine/limine-uefi-cd.bin \ + iso_root/ + +# Generate the ISO +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 $ISO 1>/dev/null + +stand/limine/limine bios-install $ISO 1>/dev/null +rm -rf iso_root diff --git a/src/data/boot/limine.conf b/src/data/boot/limine.conf new file mode 100644 index 0000000..c193618 --- /dev/null +++ b/src/data/boot/limine.conf @@ -0,0 +1,11 @@ +timeout: 10 +interface_branding_color: 4 +interface_help_color: 2 + +editor_enabled: no +interface_help_hidden: no +randomize_hhdm_base: no + +/M1X + protocol: limine + kernel_path: boot():/boot/m1x.sys