From dcac27166f6f000565a703b0f8571e989e51908b Mon Sep 17 00:00:00 2001 From: BeresfordHare Date: Thu, 7 Aug 2014 14:28:54 +1200 Subject: [PATCH 1/7] create directory for source files --- src/0_prepare.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/0_prepare.sh b/src/0_prepare.sh index 78520b271..8fda1643f 100644 --- a/src/0_prepare.sh +++ b/src/0_prepare.sh @@ -3,3 +3,5 @@ rm -rf work mkdir work +# -p stops errors if the director already exists +mkdir -p source From c76f64e0b0a5130bc256f630b1c0ba5937645f58 Mon Sep 17 00:00:00 2001 From: BeresfordHare Date: Thu, 7 Aug 2014 14:31:33 +1200 Subject: [PATCH 2/7] The downloads now go into a source folder --- src/1_get_kernel.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/1_get_kernel.sh b/src/1_get_kernel.sh index 4dd79f6b0..2b5c116d9 100644 --- a/src/1_get_kernel.sh +++ b/src/1_get_kernel.sh @@ -1,13 +1,24 @@ #!/bin/sh +# Grab everything after the '=' sign DOWNLOAD_URL=$(grep -i KERNEL_SOURCE_URL .config | cut -f2 -d'=') + +# Grab everything after the last '/' ARCHIVE_FILE=${DOWNLOAD_URL##*/} +cd source + +# Downloading kernel file +# -c option allows the download to resume +wget -c $DOWNLOAD_URL + +# Delete folder with previously extracted kernel +cd .. cd work -rm -f $ARCHIVE_FILE -wget $DOWNLOAD_URL rm -rf kernel mkdir kernel + +# Extract kernel to folder 'kernel' +# Full path will be something like, kernel\linux-3.16 tar -xvf $ARCHIVE_FILE -C kernel cd .. - From d8954a701c36c0c14ea7b31bbbbebde78f066ae0 Mon Sep 17 00:00:00 2001 From: BeresfordHare Date: Thu, 7 Aug 2014 14:36:10 +1200 Subject: [PATCH 3/7] Changed to make bzImage, and make mrproper. --- src/2_build_kernel.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/2_build_kernel.sh b/src/2_build_kernel.sh index c903d6f95..2533dcc50 100644 --- a/src/2_build_kernel.sh +++ b/src/2_build_kernel.sh @@ -1,10 +1,21 @@ -#/bin/sh +#!/bin/sh cd work/kernel -cd $(ls -d *) -make clean -make defconfig -sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal-linux-live\"/" .config -make vmlinux -cd ../../.. +# Change to the first directory ls finds, e.g. linux-3.16 +cd $(ls -d *) + +# Cleans up the kernel sources, including configuration files +make mrproper + +# Create a default configuration file for the kernel +make defconfig + +# Changes the name of the system +sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal-linux-live\"/" .config + +# Compile the kernel +# Good explanation of the different kernels +# http://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vmlinux +make bzImage +cd ../../.. From f902853da38af240d118016bf67803410871ce0e Mon Sep 17 00:00:00 2001 From: BeresfordHare Date: Thu, 7 Aug 2014 14:39:56 +1200 Subject: [PATCH 4/7] Source downloaded to new source folder --- src/3_get_busybox.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/3_get_busybox.sh b/src/3_get_busybox.sh index 2c2dc6125..3abaa7fe7 100644 --- a/src/3_get_busybox.sh +++ b/src/3_get_busybox.sh @@ -1,13 +1,23 @@ -#/bin/sh +#!/bin/sh +# Grab everything after the '=' sign DOWNLOAD_URL=$(grep -i BUSYBOX_SOURCE_URL .config | cut -f2 -d'=') + +# Grab everything after the last '/' ARCHIVE_FILE=${DOWNLOAD_URL##*/} -cd work -rm -f $ARCHIVE_FILE -wget $DOWNLOAD_URL -rm -rf busybox -mkdir busybox -tar -xvf $ARCHIVE_FILE -C busybox +cd source + +# Downloading busybox source +# -c option allows the download to resume +wget -c $DOWNLOAD_URL + +# Delete folder with previously extracted busybox +rm -rf ../work/busybox +mkdir ../work/busybox + +# Extract kernel to folder 'busybox' +# Full path will be something like, busybox\busybox-1.22.1 +tar -xvf $ARCHIVE_FILE -C ../work/busybox cd .. From 09fd6ec0c2be5264d48d568f694ed870726aca52 Mon Sep 17 00:00:00 2001 From: BeresfordHare Date: Thu, 7 Aug 2014 14:40:47 +1200 Subject: [PATCH 5/7] Fixed paths --- src/1_get_kernel.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/1_get_kernel.sh b/src/1_get_kernel.sh index 2b5c116d9..928ac69c2 100644 --- a/src/1_get_kernel.sh +++ b/src/1_get_kernel.sh @@ -13,12 +13,10 @@ cd source wget -c $DOWNLOAD_URL # Delete folder with previously extracted kernel -cd .. -cd work -rm -rf kernel -mkdir kernel +rm -rf ../work/kernel +mkdir ../work/kernel # Extract kernel to folder 'kernel' # Full path will be something like, kernel\linux-3.16 -tar -xvf $ARCHIVE_FILE -C kernel +tar -xvf $ARCHIVE_FILE -C ../work/kernel cd .. From 0f7779da580b5ace7a61b7e887cb8f986904a483 Mon Sep 17 00:00:00 2001 From: BeresfordHare Date: Thu, 7 Aug 2014 14:42:28 +1200 Subject: [PATCH 6/7] Added comments --- src/4_build_busybox.sh | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/4_build_busybox.sh b/src/4_build_busybox.sh index 277d733ad..55cff6571 100644 --- a/src/4_build_busybox.sh +++ b/src/4_build_busybox.sh @@ -1,11 +1,25 @@ -#/bin/sh +#!/bin/sh cd work/busybox -cd $(ls -d *) -make clean -make defconfig -sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config -make busybox -make install -cd ../../.. +# Change to the first directory ls finds, e.g/ busybox-1.22.1 +cd $(ls -d *) + +# Clean's the source? +make clean + +# Create a default configuration file +make defconfig + +# Change the configuration, so that busybox is statically compiled +# You could do this manually with 'make menuconfig' +sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config + +# Compile busybox +make busybox + +# Create the symlinks for busybox +# It uses the file busybox.links for this +make install + +cd ../../.. From 1a18cd7a100794d15fcadc2d669eaaef0df1c0d2 Mon Sep 17 00:00:00 2001 From: BeresfordHare Date: Thu, 7 Aug 2014 14:43:12 +1200 Subject: [PATCH 7/7] Fixed spelling mistake --- src/0_prepare.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/0_prepare.sh b/src/0_prepare.sh index 8fda1643f..7f153ed22 100644 --- a/src/0_prepare.sh +++ b/src/0_prepare.sh @@ -3,5 +3,5 @@ rm -rf work mkdir work -# -p stops errors if the director already exists +# -p stops errors if the directory already exists mkdir -p source