From 2c5281472216910314ccd72ee4b53005a1732573 Mon Sep 17 00:00:00 2001
From: AwlsomeAlex <AwlsomeAlex@users.noreply.github.com>
Date: Fri, 30 Sep 2016 23:38:19 -0400
Subject: [PATCH] Fixes ldlinux.c32 Bug and Compiling Errors

The old way of creating the image used to require the user to manually add Syslinux Features like isolinux.bin and ldlinux.c32, which without them, the system wouldn't boot. Now the small instruction guide will move the required files with the Kernel and Rootfs. Also fixed a small user error when generating the Rootfs by changing "find . | cpio -R +0:+0 -H newc -o | gzip > ../../rootfs.cpio.gz" to "find . | cpio -R root:root -H newc -o | gzip > ../../rootfs.cpio.gz"
---
 README.md | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 855d2ad7d..5a653b003 100644
--- a/README.md
+++ b/README.md
@@ -7,10 +7,13 @@ The script below uses **Linux kernel 4.7.2** and **BusyBox 1.24.2**. The source
 
 After that simply run the below script. It doesn't require root privileges. In the end you should have a bootable ISO image named `minimal_linux_live.iso` in the same directory where you executed the script.
 
-    wget http://kernel.org/pub/linux/kernel/v4.x/linux-4.7.2.tar.xz
+    wget http://kernel.org/pub/linux/kernel/v4.x/linux-4.7.6.tar.xz
     wget http://busybox.net/downloads/busybox-1.24.2.tar.bz2
-    tar -xvf linux-4.7.2.tar.xz
+    wget http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz
+    mkdir isoimage
+    tar -xvf linux-4.7.6.tar.xz
     tar -xvf busybox-1.24.2.tar.bz2
+    tar -xvf syslinux-6.03.tar.xz
     cd busybox-1.24.2
     make distclean defconfig
     sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config
@@ -26,10 +29,28 @@ After that simply run the below script. It doesn't require root privileges. In t
     echo 'setsid cttyhack /bin/sh' >> init
     chmod +x init
     find . | cpio -R root:root -H newc -o | gzip > ../../rootfs.cpio.gz
-    cd ../../linux-4.7.2
+    cd ../../linux-4.7.6
     make mrproper defconfig bzImage
-    make isoimage FDINITRD=../rootfs.cpio.gz
-    cp arch/x86/boot/image.iso ../minimal_linux_live.iso
+    cp arch/x86/boot/bzImage \
+    	../isoimage/kernel
     cd ..
+    cd isoimage
+    cp ../syslinux-6.03/bios/core/isolinux.bin .
+    cp ../syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 .
+    cp kernel ./kernel.xz
+    cp ../rootfs.cpio.xz ./rootfs.xz
+    echo 'default kernel.xz  initrd=rootfs.xz vga=ask' > ./isolinux.cfg
+    genisoimage \
+    	-J \
+    	-r \
+    	-o ../minimal_linux_live.iso \
+    	-b isolinux.bin \
+    	-c boot.cat \
+    	-input-charset UTF-8 \
+    	-no-emul-boot \
+    	-boot-load-size 4 \
+    	-boot-info-table \
+    	./
+    isohybrid -u ../minimal_linux_live.iso 2>/dev/null || true
 
 Note that this produces very small live Linux OS with working shell only. The network support has been implemented properly in the [Minimal Linux Live](http://github.com/ivandavidov/minimal) project which is extensively documented and more feature rich, yet still produces very small live Linux ISO image.