From bcd06ac1366af21f5ec481a70facffcc378182bf Mon Sep 17 00:00:00 2001 From: Kevin Lange Date: Tue, 22 Mar 2011 01:14:54 -0400 Subject: [PATCH] [boot/initrd] Add stage2 to initial ramdisk, move kernel. --- .gitignore | 2 +- Makefile | 15 +++++++++++---- util/mrboots-installer.c | 9 +++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index b263d5d4..f88e2a3f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ toaruos-initrd *.swp bootloader/stage1.bin bootloader/stage2.bin -initrd/kernel +initrd/boot .gdb_history bootdisk.img *.log diff --git a/Makefile b/Makefile index 1ac946ff..aecd7468 100644 --- a/Makefile +++ b/Makefile @@ -65,8 +65,9 @@ kernel/start.o: kernel/start.s ################ # Ram disk # ################ -toaruos-initrd: initrd/kernel +toaruos-initrd: initrd/boot/kernel bootloader/stage2.bin @${ECHO} -n "\033[32m initrd Generating initial RAM disk\033[0m" + @# Get rid of the old one @-rm -f toaruos-initrd @${GENEXT} -d initrd -q -b 249 toaruos-initrd @${ECHO} "\r\033[32;1m initrd Generated initial RAM disk image\033[0m" @@ -74,9 +75,15 @@ toaruos-initrd: initrd/kernel ### Ram Disk installers... +# Second stage bootloader +initrd/boot/stage2: bootloader/stage2.bin + @mkdir -p initrd/boot + @cp bootloader/stager2.bin initrd/boot/stage2 + # Kernel -initrd/kernel: toaruos-kernel - @cp toaruos-kernel initrd/kernel +initrd/boot/kernel: toaruos-kernel + @mkdir -p initrd/boot + @cp toaruos-kernel initrd/boot/kernel ################ # Utilities # @@ -145,7 +152,7 @@ clean: @-rm -f bootloader/stage1/*.o @-rm -f bootloader/stage2.bin @-rm -f bootloader/stage2/*.o - @-rm -f initrd/kernel + @-rm -f initrd/boot @-rm -f bootdisk.img @-rm -f docs/*.pdf docs/*.aux docs/*.log docs/*.out @-rm -f docs/*.idx docs/*.ind docs/*.toc docs/*.ilg diff --git a/util/mrboots-installer.c b/util/mrboots-installer.c index 2d81205b..873ebd51 100644 --- a/util/mrboots-installer.c +++ b/util/mrboots-installer.c @@ -6,10 +6,15 @@ * architecture you feel like running me on, though I much * prefer something simple and 32-bit. */ +#include #include +/* The EXT2 header is smart enough to know to grab us stdint.h rather than types.h... */ #include "../kernel/include/ext2.h" int main(int argc, char ** argv) { - printf("Mr. Boots Installer\n"); - + if (argc < 3) { + fprintf(stderr, "Expected two additional arguments: a ramdisk, and a file path to second stage to find in it.\n"); + return -1; + } + fprintf(stderr, "I will look for %s in %s and generate appropriate output.\n", argv[2], argv[1]); }