diff options
| -rw-r--r-- | Makefile | 18 | ||||
| -rwxr-xr-x | install-deps-alpine.sh | 3 | ||||
| -rw-r--r-- | linker.ld | 2 | ||||
| -rwxr-xr-x | run-docker.sh | 8 | ||||
| -rw-r--r-- | src/boot.s | 2 |
5 files changed, 25 insertions, 8 deletions
@@ -1,11 +1,11 @@ -CC = i686-elf-gcc -AS = i686-elf-as +CC = i386-elf-gcc +AS = i386-elf-as CFLAGS = -std=gnu99 -ffreestanding -O2 -Wall -Wextra SRCS = src/kernel.c OBJS = src/boot.o src/kernel.o -all: FrenchToastOS.iso +all: FrenchToastOS-bios.iso FrenchToastOS-efi.iso src/boot.o: src/boot.s $(AS) src/boot.s -o src/boot.o @@ -16,12 +16,18 @@ src/kernel.o: src/kernel.c FrenchToastOS.bin: $(OBJS) $(CC) -T linker.ld -o FrenchToastOS.bin -ffreestanding -O2 -nostdlib $(OBJS) -lgcc -FrenchToastOS.iso: FrenchToastOS.bin +iso-files: FrenchToastOS.bin mkdir -p isodir/boot/grub cp FrenchToastOS.bin isodir/boot/ cp boot/grub.cfg isodir/boot/grub/ - grub-mkrescue -o FrenchToastOS.iso isodir + + +FrenchToastOS-bios.iso: iso-files + grub-mkrescue /usr/lib/grub/i386-pc -o FrenchToastOS-bios.iso isodir + +FrenchToastOS-efi.iso: iso-files + grub-mkrescue -o FrenchToastOS-efi.iso isodir clean: - rm -f $(OBJS) FrenchToastOS.bin FrenchToastOS.iso + rm -f $(OBJS) FrenchToastOS.bin FrenchToastOS-bios.iso FrenchToastOS-efi.iso rm -rf isodir diff --git a/install-deps-alpine.sh b/install-deps-alpine.sh new file mode 100755 index 0000000..1a91ed1 --- /dev/null +++ b/install-deps-alpine.sh @@ -0,0 +1,3 @@ +#!/bin/ash + +apk add grub grub-bios gcc-i386-elf binutils-i386-elf make xorriso @@ -2,7 +2,7 @@ ENTRY(_start) SECTIONS { - . = 1M; + . = 2M; .text BLOCK(4K) : ALIGN(4K) { diff --git a/run-docker.sh b/run-docker.sh new file mode 100755 index 0000000..f4093d2 --- /dev/null +++ b/run-docker.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +echo "installing binfmt hooks because alarm is bad and it keeps breaking on reboot" +echo -1 | sudo tee /proc/sys/fs/binfmt_misc/qemu-x86_64 +docker run --privileged --rm tonistiigi/binfmt --install amd64 + +echo "actually running alpine" +docker run -it --mount type=bind,src=$(dirname "$0"),target=/workspace --platform linux/amd64 --rm alpine:latest @@ -21,7 +21,7 @@ stack_bottom: stack_top: /* _start is the entrypoint */ -.section text +.section .text .global _start .type _start, @function _start: |
