]> git.mdlowis.com Git - proto/albase.git/commitdiff
Added scripts and tweaked build to build a bootable iso with a kernel and initramfs...
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 9 Mar 2017 15:56:34 +0000 (10:56 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 9 Mar 2017 15:56:34 +0000 (10:56 -0500)
Makefile
README.md
bootstrap.sh
buildiso.sh
config.mk [new file with mode: 0644]
etc/rc.init
iso9660/isolinux/isolinux.cfg

index c5f506a3021830cc473474d31bb70ff6314c263e..73c5f1ef76e205cd4ddd5bb95c16944743d6bbb3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ LIBS     =
 INCS     = -Iinclude
 DEFS     = -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L
 CPPFLAGS = $(INCS) $(DEFS)
-CFLAGS   = -O2 --std=gnu99
-LDFLAGS  = $(LIBS)
+CFLAGS   = --static -O2 --std=gnu99
+LDFLAGS  = --static $(LIBS)
 ARFLAGS  = rcs
 
 # commands
@@ -61,7 +61,7 @@ include source/sh/Rules.mk
 include source/shadow/Rules.mk
 include source/smdev/Rules.mk
 include source/sdhcp/Rules.mk
-include source/iproute2/Rules.mk
+#include source/iproute2/Rules.mk
 include source/kernel/Rules.mk
 include etc/Rules.mk
 
@@ -77,6 +77,10 @@ clean: kernel-clean
        @$(RM) $(BUILDDIR)/dummy $(ECLEAN)
        @$(RM) -r $(BUILDDIR)/include
        @$(RM) albase.iso stage1.tar.xz iso9660/isolinux/vmlinuz iso9660/isolinux/initrd.img
+       @$(RM) $(BUILDDIR)/boot/* $(BUILDDIR)/bin/* $(BUILDDIR)/init
+
+dist-clean:
+       @$(RM) -r $(BUILDDIR) musl-cross-make/stage1 musl-cross-make/stage2 config.mk
 
 # load dependency files if they exist
 -include $(DEPS)
index 3417f3d3a8bdd95b7c1cac2f87aec13602fd733e..a5a5097fe612d232805835be89356d44eb0406d7 100644 (file)
--- a/README.md
+++ b/README.md
@@ -11,6 +11,6 @@ The goals of the project are as follows:
 
 ## Building
 
-    # Optional: build the musl-based cross compiler and use that for the build
     ./bootstrap.sh
-    make stage1
+    make all
+    ./buildiso.sh
\ No newline at end of file
index 138bd9fb512d869ee77f7866fc0784c7064e166b..13df71557d2ba5a507c1f70e3cf7472060ae44af 100755 (executable)
@@ -11,10 +11,12 @@ if [ ! -d musl-cross-make/stage2 ]; then
     export PATH="$PWD/stage1/bin:$PATH"
     make all install
     make clean
+    #rm musl-cross-make/stage2
+    #rm musl-cross-make/stage2/x86_64-linux-musl/lib/*.so.*
 fi
-if [ ! -f config.mk ]; then
-    echo 'export PATH := $(PWD)/musl-corss-make/stage2/bin:$(PATH)' >> config.mk
-    echo 'CC = x86_64-linux-musl-gcc' >> config.mk
-    echo 'LD = $(CC)' >> config.mk
-    echo 'AR = x86_64-linux-musl-ar' >> config.mk
-fi
+#if [ ! -f config.mk ]; then
+#    echo 'export PATH := $(PWD)/musl-cross-make/stage2/bin:$(PATH)' >> config.mk
+#    echo 'CC = x86_64-linux-musl-gcc' >> config.mk
+#    echo 'LD = $(CC)' >> config.mk
+#    echo 'AR = x86_64-linux-musl-ar' >> config.mk
+#fi
index d32035beabb84cd8d85bf9b24b726308d181650a..4134239bb658a132f026de1aaabe7400ca5e198f 100755 (executable)
@@ -2,12 +2,20 @@
 export ROOT=$PWD/build/
 export ISO_FS=$PWD/iso9660/
 export ISO_IMAGE=$PWD/albase.iso
+export INITRD=$ISO_FS/isolinux/initrd.img
+
+# Move the init daemon to root so kernel can find it
+mv "$ROOT/bin/init" "$ROOT"
+
+echo "Generating $INITRD..."
+(
+    cd $ROOT && find . -print0 |  
+    cpio --null -ov --format=newc | 
+    gzip -9 > $INITRD
+)
 
 # Copy the kernel to the ISO folder
-cp $ROOT/boot/vmlinuz $ISO_FS/isolinux/vmlinuz
-# Copy the base files into an initrd.img
-find $ROOT | grep -v '^build/obj' | cpio --owner root:root --quiet -o -H newc | gzip -9 > $ISO_FS/isolinux/initrd.img
-# Delete the old image if it exists
-rm -f $ISO_IMAGE
+cp -v $ROOT/boot/vmlinuz $ISO_FS/isolinux/vmlinuz
 # Build the new image
 mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l -input-charset default -V albase -A "albase" -o $ISO_IMAGE $ISO_FS
+
diff --git a/config.mk b/config.mk
new file mode 100644 (file)
index 0000000..e4ea6d1
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,4 @@
+export PATH := $(PWD)/musl-cross-make/stage2/bin:$(PATH)
+CC = x86_64-linux-musl-gcc
+LD = $(CC)
+AR = x86_64-linux-musl-ar
index 484f3570fc883f009a00880c1a27439cd3ac0761..0626fd36b41a6acaa061c3257c4da77bec675b51 100755 (executable)
@@ -7,7 +7,7 @@ mkdir /dev/pts
 mkdir /dev/shm
 dmesg -n 1
 clear
-getty /dev/tty1 &
-getty /dev/tty2 &
-getty /dev/tty3 &
-#exec /bin/sh
+#getty /dev/tty1 &
+#getty /dev/tty2 &
+#getty /dev/tty3 &
+exec /bin/sh
index 9a2ab364bdd790796206595a331ce054d1bd47ac..f3d67e538dc41ac7c0614a95172ed126fa930485 100644 (file)
@@ -1,4 +1,5 @@
-default stali
-label stali
-       kernel vmlinuz
-       append initrd=initrd.img quiet
+default albase
+label albase
+    kernel vmlinuz
+    initrd initrd.img
+    append ro console=ttyS0 console=tty0 ignore_loglevel