From a500288079e03fcd88317161e908bd8de98c2c02 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 19 Sep 2014 16:38:40 +0200 Subject: [PATCH] Add sortix.bin makefile target. --- Makefile | 9 +++++++++ doc/cross-development | 30 ++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b0b0b545..41d422db 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,7 @@ clean-ports: .PHONY: clean-builds clean-builds: rm -rf "$(SORTIX_BUILDS_DIR)" + rm -f sortix.bin rm -f sortix.initrd rm -f sortix.iso rm -f sortix.iso.xz @@ -215,6 +216,14 @@ release-all-archs: $(MAKE) clean $(MAKE) release HOST=x86_64-sortix +# Kernel + +.PHONY: kernel +kernel: sysroot + +sortix.bin: kernel + cp "$(SYSROOT)/boot/$(HOST)/sortix.bin" sortix.bin + # Initial ramdisk $(INITRD): sysroot diff --git a/doc/cross-development b/doc/cross-development index aaf19ce5..f051529c 100644 --- a/doc/cross-development +++ b/doc/cross-development @@ -97,7 +97,8 @@ commands: cd ~/sortix && make PREFIX="$CROSS_PREFIX" build-tools && - make PREFIX="$CROSS_PREFIX" install-build-tools + make PREFIX="$CROSS_PREFIX" install-build-tools && + make distclean These tools produce platform independent output so you may wish to install them into $HOME/bin or /usr/local/bin or where it suits you in your $PATH. @@ -188,16 +189,33 @@ completed the above steps correctly, then you can simply do: This will compile a basic Sortix system into ~/sortix/sysroot with a kernel, headers, libraries, programs, everything you need. This isn't a bootable system -yet. If you have xorriso and grub-mkrescue from GRUB 2 installed, then you can +yet. You need the combination of a kernel and an initrd to boot Sortix. The +initrd is a root filesystem entirely in memory that is loaded by the bootloader +in addition to the kernel. You can generate the initrd in builds/ by running: + + cd ~/sortix && + make HOST=$SORTIX_PLATFORM initrd + +If you want a copy of the kernel and initrd in the current directory (rather +than normally finding them in builds/ and sysroot/), you can run: + + cd ~/sortix && + make HOST=$SORTIX_PLATFORM sortix.bin sortix.initrd + +You now have a sortix.bin and sortix.initrd pair. You can boot Sortix using a +multiboot bootloader by passing them as a multiboot kernel and multiboot +module/initrd. + +If you have xorriso and grub-mkrescue from GRUB 2 installed, then you can can build a bootable .iso by typing: cd ~/sortix && make HOST=$SORTIX_PLATFORM sortix.iso -This will produce a ~/sortix/sortix.iso file that is bootable on real hardware -and virtual machines. Alternatively, you can take the sortix.bin file and boot -that with GRUB as a multiboot kernel and sortix.initrd (snapshot of the sysroot) -as a multiboot module/initrd. +This will produce a sortix.iso file that is bootable on real hardware and +virtual machines. This works by first building Sortix system and packaging up an +initrd, then it create a cdrom image with a bootloader configured to load the +kernel and initrd stored on the cdrom. You can clean the source directory fully: