Improved comments.
This commit is contained in:
		
							parent
							
								
									ffed43447a
								
							
						
					
					
						commit
						c05e0580cf
					
				| @ -4,9 +4,9 @@ | |||||||
| # | # | ||||||
| KERNEL_SOURCE_URL=https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.1.6.tar.xz | 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 | TOYBOX_SOURCE_URL=http://landley.net/toybox/downloads/toybox-0.6.0.tar.gz | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -3,6 +3,6 @@ | |||||||
| rm -rf work | rm -rf work | ||||||
| mkdir work | mkdir work | ||||||
| 
 | 
 | ||||||
| # -p stops errors if the directory already exists | # -p stops errors if the directory already exists. | ||||||
| mkdir -p source | mkdir -p source | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,23 +1,23 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| 
 | 
 | ||||||
| # Grab everything after the '=' character | # Grab everything after the '=' character. | ||||||
| DOWNLOAD_URL=$(grep -i KERNEL_SOURCE_URL .config | cut -f2 -d'=') | 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##*/} | ARCHIVE_FILE=${DOWNLOAD_URL##*/} | ||||||
| 
 | 
 | ||||||
| cd source | cd source | ||||||
| 
 | 
 | ||||||
| # Downloading kernel file | # Downloading kernel file. | ||||||
| # -c option allows the download to resume | # -c option allows the download to resume. | ||||||
| wget -c $DOWNLOAD_URL | wget -c $DOWNLOAD_URL | ||||||
| 
 | 
 | ||||||
| # Delete folder with previously extracted kernel | # Delete folder with previously extracted kernel. | ||||||
| rm -rf ../work/kernel | rm -rf ../work/kernel | ||||||
| mkdir ../work/kernel | mkdir ../work/kernel | ||||||
| 
 | 
 | ||||||
| # Extract kernel to folder 'work/kernel' | # Extract kernel to folder 'work/kernel'. | ||||||
| # Full path will be something like 'work/kernel/linux-3.16.1' | # Full path will be something like 'work/kernel/linux-4.1.6'. | ||||||
| tar -xvf $ARCHIVE_FILE -C ../work/kernel | tar -xvf $ARCHIVE_FILE -C ../work/kernel | ||||||
| 
 | 
 | ||||||
| cd .. | cd .. | ||||||
|  | |||||||
| @ -2,20 +2,20 @@ | |||||||
| 
 | 
 | ||||||
| cd work/kernel | 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 *) | cd $(ls -d *) | ||||||
| 
 | 
 | ||||||
| # Cleans up the kernel sources, including configuration files | # Cleans up the kernel sources, including configuration files. | ||||||
| make mrproper | make mrproper | ||||||
| 
 | 
 | ||||||
| # Create a default configuration file for the kernel | # Create a default configuration file for the kernel. | ||||||
| make defconfig | 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 | sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal\"/" .config | ||||||
| 
 | 
 | ||||||
| # Compile the kernel with optimization for "parallel jobs" = "number of processors" | # Compile the kernel with optimization for "parallel jobs" = "number of processors". | ||||||
| # Good explanation of the different kernels | # Good explanation of the different kernels: | ||||||
| # http://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vmlinux | # 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) | make bzImage -j $(grep ^processor /proc/cpuinfo | wc -l) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,23 +1,23 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| 
 | 
 | ||||||
| # Grab everything after the '=' character | # Grab everything after the '=' character. | ||||||
| DOWNLOAD_URL=$(grep -i TOYBOX_SOURCE_URL .config | cut -f2 -d'=') | 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##*/} | ARCHIVE_FILE=${DOWNLOAD_URL##*/} | ||||||
| 
 | 
 | ||||||
| cd source | cd source | ||||||
| 
 | 
 | ||||||
| # Downloading toybox source | # Downloading ToyBox source. | ||||||
| # -c option allows the download to resume | # -c option allows the download to resume. | ||||||
| wget -c $DOWNLOAD_URL | wget -c $DOWNLOAD_URL | ||||||
| 
 | 
 | ||||||
| # Delete folder with previously extracted toybox | # Delete folder with previously extracted ToyBox. | ||||||
| rm -rf ../work/toybox | rm -rf ../work/toybox | ||||||
| mkdir ../work/toybox | mkdir ../work/toybox | ||||||
| 
 | 
 | ||||||
| # Extract toybox to folder 'toybox' | # Extract toybox to folder 'toybox'. | ||||||
| # Full path will be something like 'work/toybox/toybox-0.6.0' | # Full path will be something like 'work/toybox/toybox-0.6.0'. | ||||||
| tar -xvf $ARCHIVE_FILE -C ../work/toybox | tar -xvf $ARCHIVE_FILE -C ../work/toybox | ||||||
| 
 | 
 | ||||||
| cd .. | cd .. | ||||||
|  | |||||||
| @ -5,24 +5,31 @@ cd work/toybox | |||||||
| # Change to the first directory ls finds, e.g. 'toybox-0.6.0' | # Change to the first directory ls finds, e.g. 'toybox-0.6.0' | ||||||
| cd $(ls -d *) | cd $(ls -d *) | ||||||
| 
 | 
 | ||||||
| # Remove previously generated artefacts | # Remove previously generated artefacts. | ||||||
| make distclean | make distclean | ||||||
| 
 | 
 | ||||||
| # Create a default configuration file | # Create a configuration file with all possible selections. | ||||||
| make allyesconfig | make allyesconfig | ||||||
| 
 | 
 | ||||||
|  | # Static linking | ||||||
| export LDFLAGS="--static" | 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) | make toybox -j $(grep ^processor /proc/cpuinfo | wc -l) | ||||||
| 
 | 
 | ||||||
|  | # We no longer need flags for static linking. | ||||||
| unset LDFLAGS | unset LDFLAGS | ||||||
| 
 | 
 | ||||||
| rm -rf rootfs | rm -rf rootfs | ||||||
| mkdir rootfs | mkdir rootfs | ||||||
|  | 
 | ||||||
|  | # Directory where ToyBox binary and symlink will be instaled. | ||||||
| export PREFIX=rootfs | export PREFIX=rootfs | ||||||
| # Create the symlinks for toybox | 
 | ||||||
|  | # Create the symlinks for toybox in single folder. | ||||||
| make install_flat | make install_flat | ||||||
|  | 
 | ||||||
|  | # We no longer need this environment variable. | ||||||
| unset PREFIX | unset PREFIX | ||||||
| 
 | 
 | ||||||
| cd ../../.. | cd ../../.. | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ mkdir rootfs | |||||||
| cd toybox | cd toybox | ||||||
| cd $(ls -d *) | 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 | cp -R rootfs ../../rootfs/bin | ||||||
| cd ../../rootfs | cd ../../rootfs | ||||||
| 
 | 
 | ||||||
| @ -26,8 +26,7 @@ chmod 1777 tmp | |||||||
| 
 | 
 | ||||||
| cd etc | cd etc | ||||||
| 
 | 
 | ||||||
| # The file "/etc/welcome.txt" is displayed on every boot of the system in each | # The file "/etc/welcome.txt" is displayed on every boot. | ||||||
| # available terminal. |  | ||||||
| cat > welcome.txt << EOF | cat > welcome.txt << EOF | ||||||
| 
 | 
 | ||||||
|   ##################################### |   ##################################### | ||||||
| @ -40,7 +39,7 @@ EOF | |||||||
| 
 | 
 | ||||||
| cd .. | cd .. | ||||||
| 
 | 
 | ||||||
| # Problem setting default path | # For now we have simple console. | ||||||
| cat > init << EOF | cat > init << EOF | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
| dmesg -n 1 | dmesg -n 1 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user