diff --git a/src/experimental/.config b/src/experimental/.config index a082ead59..3cca38cac 100644 --- a/src/experimental/.config +++ b/src/experimental/.config @@ -4,9 +4,9 @@ # KERNEL_SOURCE_URL=https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.1.6.tar.xz -# You can find the latest BusyBox source bundles here: +# You can find the latest ToyBox source bundles here: # -# http://busybox.net +# http://landley.net/toybox # TOYBOX_SOURCE_URL=http://landley.net/toybox/downloads/toybox-0.6.0.tar.gz diff --git a/src/experimental/0_prepare.sh b/src/experimental/0_prepare.sh index b1f8e4ed3..e539d7f3a 100755 --- a/src/experimental/0_prepare.sh +++ b/src/experimental/0_prepare.sh @@ -3,6 +3,6 @@ rm -rf work mkdir work -# -p stops errors if the directory already exists +# -p stops errors if the directory already exists. mkdir -p source diff --git a/src/experimental/1_get_kernel.sh b/src/experimental/1_get_kernel.sh index 0d79b79a1..0754f9f75 100755 --- a/src/experimental/1_get_kernel.sh +++ b/src/experimental/1_get_kernel.sh @@ -1,23 +1,23 @@ #!/bin/sh -# Grab everything after the '=' character +# Grab everything after the '=' character. DOWNLOAD_URL=$(grep -i KERNEL_SOURCE_URL .config | cut -f2 -d'=') -# Grab everything after the last '/' character +# Grab everything after the last '/' character. ARCHIVE_FILE=${DOWNLOAD_URL##*/} cd source -# Downloading kernel file -# -c option allows the download to resume +# Downloading kernel file. +# -c option allows the download to resume. wget -c $DOWNLOAD_URL -# Delete folder with previously extracted kernel +# Delete folder with previously extracted kernel. rm -rf ../work/kernel mkdir ../work/kernel -# Extract kernel to folder 'work/kernel' -# Full path will be something like 'work/kernel/linux-3.16.1' +# Extract kernel to folder 'work/kernel'. +# Full path will be something like 'work/kernel/linux-4.1.6'. tar -xvf $ARCHIVE_FILE -C ../work/kernel cd .. diff --git a/src/experimental/2_build_kernel.sh b/src/experimental/2_build_kernel.sh index 1734a0270..6651fbf19 100755 --- a/src/experimental/2_build_kernel.sh +++ b/src/experimental/2_build_kernel.sh @@ -2,20 +2,20 @@ cd work/kernel -# Change to the first directory ls finds, e.g. 'linux-3.18.6' +# Change to the first directory ls finds, e.g. 'linux-3.18.6'. cd $(ls -d *) -# Cleans up the kernel sources, including configuration files +# Cleans up the kernel sources, including configuration files. make mrproper -# Create a default configuration file for the kernel +# Create a default configuration file for the kernel. make defconfig -# Changes the name of the system +# Changes the name of the system. sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal\"/" .config -# Compile the kernel with optimization for "parallel jobs" = "number of processors" -# Good explanation of the different kernels +# Compile the kernel with optimization for "parallel jobs" = "number of processors". +# 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 -j $(grep ^processor /proc/cpuinfo | wc -l) diff --git a/src/experimental/3_get_toybox.sh b/src/experimental/3_get_toybox.sh index 26eda6591..0c2d1254e 100755 --- a/src/experimental/3_get_toybox.sh +++ b/src/experimental/3_get_toybox.sh @@ -1,23 +1,23 @@ #!/bin/sh -# Grab everything after the '=' character +# Grab everything after the '=' character. DOWNLOAD_URL=$(grep -i TOYBOX_SOURCE_URL .config | cut -f2 -d'=') -# Grab everything after the last '/' character +# Grab everything after the last '/' character. ARCHIVE_FILE=${DOWNLOAD_URL##*/} cd source -# Downloading toybox source -# -c option allows the download to resume +# Downloading ToyBox source. +# -c option allows the download to resume. wget -c $DOWNLOAD_URL -# Delete folder with previously extracted toybox +# Delete folder with previously extracted ToyBox. rm -rf ../work/toybox mkdir ../work/toybox -# Extract toybox to folder 'toybox' -# Full path will be something like 'work/toybox/toybox-0.6.0' +# Extract toybox to folder 'toybox'. +# Full path will be something like 'work/toybox/toybox-0.6.0'. tar -xvf $ARCHIVE_FILE -C ../work/toybox cd .. diff --git a/src/experimental/4_build_toybox.sh b/src/experimental/4_build_toybox.sh index 2367057ea..f12323eef 100755 --- a/src/experimental/4_build_toybox.sh +++ b/src/experimental/4_build_toybox.sh @@ -5,24 +5,31 @@ cd work/toybox # Change to the first directory ls finds, e.g. 'toybox-0.6.0' cd $(ls -d *) -# Remove previously generated artefacts +# Remove previously generated artefacts. make distclean -# Create a default configuration file +# Create a configuration file with all possible selections. make allyesconfig +# Static linking export LDFLAGS="--static" -# Compile toybox with optimization for "parallel jobs" = "number of processors" +# Compile ToyBox with optimization for "parallel jobs" = "number of processors". make toybox -j $(grep ^processor /proc/cpuinfo | wc -l) +# We no longer need flags for static linking. unset LDFLAGS rm -rf rootfs mkdir rootfs + +# Directory where ToyBox binary and symlink will be instaled. export PREFIX=rootfs -# Create the symlinks for toybox + +# Create the symlinks for toybox in single folder. make install_flat + +# We no longer need this environment variable. unset PREFIX cd ../../.. diff --git a/src/experimental/5_generate_rootfs.sh b/src/experimental/5_generate_rootfs.sh index 70a80781e..1a4df1b37 100755 --- a/src/experimental/5_generate_rootfs.sh +++ b/src/experimental/5_generate_rootfs.sh @@ -8,7 +8,7 @@ mkdir rootfs cd toybox cd $(ls -d *) -# Copy all toybox generated stuff to the location of our "initramfs" folder. +# Copy all toybox generated stuff to the location of our "initramfs/bin" folder. cp -R rootfs ../../rootfs/bin cd ../../rootfs @@ -26,8 +26,7 @@ chmod 1777 tmp cd etc -# The file "/etc/welcome.txt" is displayed on every boot of the system in each -# available terminal. +# The file "/etc/welcome.txt" is displayed on every boot. cat > welcome.txt << EOF ##################################### @@ -40,7 +39,7 @@ EOF cd .. -# Problem setting default path +# For now we have simple console. cat > init << EOF #!/bin/sh dmesg -n 1