From e11ed733292fff03f4ab4383ba3cff93979183d1 Mon Sep 17 00:00:00 2001 From: Ivan Davidov Date: Wed, 4 May 2016 18:44:39 +0300 Subject: [PATCH] Major reorganization (might break the build, not tested). Externalized the "copy source" process. Added properties to fin-tune the "copy source" process. Changed how Linux loader visibility is handled on 64-bit machines. Comments and log messages have been improved. --- src/.config | 67 ++++++++++++------- src/{00_prepare.sh => 00_clean.sh} | 0 src/01_prepare_src.sh | 26 +++++++ src/{01_get_kernel.sh => 02_get_kernel.sh} | 0 ...{02_build_kernel.sh => 03_build_kernel.sh} | 0 src/{03_get_glibc.sh => 04_get_glibc.sh} | 0 src/{04_build_glibc.sh => 05_build_glibc.sh} | 10 +-- ...5_prepare_glibc.sh => 06_prepare_glibc.sh} | 0 src/{06_get_busybox.sh => 07_get_busybox.sh} | 0 ...7_build_busybox.sh => 08_build_busybox.sh} | 0 src/08_generate_rootfs.sh | 61 ----------------- src/08_generate_rootfs/tmp/.gitignore | 0 src/09_generate_rootfs.sh | 62 +++++++++++++++++ .../dev/.gitignore | 0 .../etc/01_prepare.sh | 0 .../etc/02_overlay.sh | 2 +- .../etc/03_init.sh | 0 .../etc/04_bootscript.sh | 0 .../etc/05_rc.dhcp | 0 .../etc/inittab | 0 .../etc/resolv.conf | 0 .../etc/welcome.txt | 0 .../init | 0 .../lib/.gitignore | 0 .../mnt/.gitignore | 0 .../proc/.gitignore | 0 .../root/.gitignore | 0 .../src => 09_generate_rootfs/sys}/.gitignore | 0 .../sys => 09_generate_rootfs/tmp}/.gitignore | 0 src/{09_pack_rootfs.sh => 10_pack_rootfs.sh} | 0 ...{10_get_syslinux.sh => 11_get_syslinux.sh} | 0 ...{11_generate_iso.sh => 12_generate_iso.sh} | 39 +++++------ .../README.txt | 0 src/Makefile | 6 +- src/build_minimal_linux_live.sh | 25 +++---- 35 files changed, 170 insertions(+), 128 deletions(-) rename src/{00_prepare.sh => 00_clean.sh} (100%) create mode 100755 src/01_prepare_src.sh rename src/{01_get_kernel.sh => 02_get_kernel.sh} (100%) rename src/{02_build_kernel.sh => 03_build_kernel.sh} (100%) rename src/{03_get_glibc.sh => 04_get_glibc.sh} (100%) rename src/{04_build_glibc.sh => 05_build_glibc.sh} (77%) rename src/{05_prepare_glibc.sh => 06_prepare_glibc.sh} (100%) rename src/{06_get_busybox.sh => 07_get_busybox.sh} (100%) rename src/{07_build_busybox.sh => 08_build_busybox.sh} (100%) delete mode 100755 src/08_generate_rootfs.sh delete mode 100644 src/08_generate_rootfs/tmp/.gitignore create mode 100755 src/09_generate_rootfs.sh rename src/{08_generate_rootfs => 09_generate_rootfs}/dev/.gitignore (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/01_prepare.sh (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/02_overlay.sh (98%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/03_init.sh (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/04_bootscript.sh (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/05_rc.dhcp (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/inittab (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/resolv.conf (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/etc/welcome.txt (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/init (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/lib/.gitignore (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/mnt/.gitignore (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/proc/.gitignore (100%) rename src/{08_generate_rootfs => 09_generate_rootfs}/root/.gitignore (100%) rename src/{08_generate_rootfs/src => 09_generate_rootfs/sys}/.gitignore (100%) rename src/{08_generate_rootfs/sys => 09_generate_rootfs/tmp}/.gitignore (100%) rename src/{09_pack_rootfs.sh => 10_pack_rootfs.sh} (100%) rename src/{10_get_syslinux.sh => 11_get_syslinux.sh} (100%) rename src/{11_generate_iso.sh => 12_generate_iso.sh} (80%) rename src/{11_generate_iso => 12_generate_iso}/README.txt (100%) diff --git a/src/.config b/src/.config index 82ab8214e..053fa7dab 100644 --- a/src/.config +++ b/src/.config @@ -28,40 +28,59 @@ SYSLINUX_SOURCE_URL=http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.0 ### ### ### ### ### ### ### ### -# Use predefined '.config' file when building the kernel. This overrides the config generation -# in '02_build_kernel.sh' and the build process uses the config file provided in this parameter. -# Place the configuration file here: config_predefined/kernel.config +# Use predefined '.config' file when building the kernel. This overrides the +# config generation in '03_build_kernel.sh' and the build process uses the +# config file provided in this parameter. Place the configuration file here: +# +# config_predefined/kernel.config # USE_PREDEFINED_KERNEL_CONFIG=false -# Use predefined '.config' file when building BusyBox. This overrides the config generation in -# '07_build_busybox.sh' and the build process uses the config file provided in this parameter. -# # Place the configuration file here: config_predefined/busybox.config +# Use predefined '.config' file when building BusyBox. This overrides the config +# generation in '08_build_busybox.sh' and the build process uses the config file +# provided in this parameter. Place the configuration file here: +# +# config_predefined/busybox.config # USE_PREDEFINED_BUSYBOX_CONFIG=false -# Define the overlay type to use. Possible values are 'sparse' and 'folder'. You can use any other -# value, no value, or comment the property in order to disable it. Put your overlay content in the -# folder '11_generate_iso' and it will be automatically merged with the root file system on boot. -# The build process creates either '/minimal.img/rootfs' or '/minimal/rootfs' (read below) and this -# folder contains all overlay content in it. The build process also creates '/minimal.img/work' -# or '/minimal/work'. This folder is used by the overlay driver to store modifications related -# to the read only storage. If the overlay media is writeable, then all changes on -# the root filesystem are automatically persisted and preserved on reboot. +# Define the overlay type to use. Possible values are 'sparse' and 'folder'. You +# can use any other value, no value, or comment the property in order to disable +# it. Put your overlay content in the folder '11_generate_iso' and it will be +# automatically merged with the root file system on boot. The build process +# creates either '/minimal.img/rootfs' or '/minimal/rootfs' (read below) and +# this folder contains all overlay content in it. The build process also creates +# '/minimal.img/work' or '/minimal/work'. This folder is used by the overlay +# driver to store modifications related to the read only storage. If the overlay +# media is writeable, then all changes on the root filesystem are automatically +#persisted and preserved on reboot. # -# sparse - use sparse file 'minimal.img' with hardcoded maximal size of 1MB (see 11_generate_iso.sh). -# The generated ISO image is larger because the sparse file is treated as regular file. This -# option requires root permissions or otherwise sparse file generation is silently skipped. -# Sparse file is treated as separate disk image and works fine on 'vfat'. +# sparse - use sparse file 'minimal.img' with hardcoded maximal size of 1MB (see +# 11_generate_iso.sh). The generated ISO image is larger because the +# sparse file is treated as regular file. This option requires root +# permissions or otherwise sparse file generation is silently skipped. +# Sparse file is treated as separate disk image and works fine on FAT. # -# folder - use normal folder structure (/minimal/). Note that this doesn't work if the file system is -# 'vfat' because FAT requires special handling, e.g. POSIX overlay (http://sf.net/p/posixovl). -# This is the default option because it doesn't require root permissions. +# folder - use normal folder structure (/minimal/). Note that this doesn't work +# if the file system is FAT because FAT requires special handling, e.g. +# POSIX overlay (http://sf.net/p/posixovl). This is the default option +# because it doesn't require root permissions. # OVERLAY_TYPE=folder -# Use already downloaded source bundles instead of downloading them from internet. This is useful -# when you have already downloaded the sources and have no internet connection. Or if you want to -# share your version of "Minimal Linux Live" with predefined sources. +# Use already downloaded source bundles instead of downloading them from +# internet. This is useful when you have already downloaded the sources and have +# no internet connection. Or if you want to share your version of "Minimal Linux +# Live" with predefined sources. USE_LOCAL_SOURCE=false +# Copy "Minimal Linux Live" source files and folders in '/src' inside initramfs. +# The default value is 'true'. You can use any other value, no value, or comment +# the property in order to disable it. +COPY_SOURCE_ROOTFS=true + +# Copy "Minimal Linux Live" source files and folders in '/src' on the ISO image. +# The default value is 'true'. You can use any other value, no value, or comment +# the property in order to disable it. +COPY_SOURCE_ISO=true + diff --git a/src/00_prepare.sh b/src/00_clean.sh similarity index 100% rename from src/00_prepare.sh rename to src/00_clean.sh diff --git a/src/01_prepare_src.sh b/src/01_prepare_src.sh new file mode 100755 index 000000000..ec937b387 --- /dev/null +++ b/src/01_prepare_src.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +cd work + +rm -rf src +mkdir src + +# Copy all source files and folders to 'work/src'. +cp ../*.sh src +cp ../.config src +cp ../README src +cp ../*.txt src +cp -r ../09_generate_rootfs src +cp -r ../12_generate_iso src +cp -r ../config_predefined src + +# Delete the '.gitignore' files which we use in order to keep track of otherwise +# empty folders. +find * -type f -name '.gitignore' -exec rm {} + + +echo "Source files and folders have been prepared." + +cd $SRC_DIR + diff --git a/src/01_get_kernel.sh b/src/02_get_kernel.sh similarity index 100% rename from src/01_get_kernel.sh rename to src/02_get_kernel.sh diff --git a/src/02_build_kernel.sh b/src/03_build_kernel.sh similarity index 100% rename from src/02_build_kernel.sh rename to src/03_build_kernel.sh diff --git a/src/03_get_glibc.sh b/src/04_get_glibc.sh similarity index 100% rename from src/03_get_glibc.sh rename to src/04_get_glibc.sh diff --git a/src/04_build_glibc.sh b/src/05_build_glibc.sh similarity index 77% rename from src/04_build_glibc.sh rename to src/05_build_glibc.sh index f5152ad60..0e21fdd7f 100755 --- a/src/04_build_glibc.sh +++ b/src/05_build_glibc.sh @@ -2,7 +2,7 @@ # Find the kernel build directory. cd work/kernel -cd $(ls -d kernel-*) +cd $(ls -d linux-*) WORK_KERNEL_DIR=$(pwd) cd ../../.. @@ -28,9 +28,11 @@ GLIBC_INSTALLED=$(pwd)/glibc_installed cd glibc_objects # glibc is configured to use the root folder (--prefix=) and as result all -# libraries will be installed in '/lib'. Kernel headers are taken from our -# already prepared kernel header area (see 02_build_kernel.sh). Packages 'gd' -# and 'selinux' are disabled. +# libraries will be installed in '/lib'. Note that on 64-bit machines BusyBox +# will be linked with the libraries in '/lib' while the Linux loader is expected +# to be in '/lib64'. Kernel headers are taken from our already prepared kernel +# header area (see 03_build_kernel.sh). Packages 'gd' and 'selinux' are disabled +# for better build compatibility with the host system. echo "Configuring glibc..." $GLIBC_SRC/configure \ --prefix= \ diff --git a/src/05_prepare_glibc.sh b/src/06_prepare_glibc.sh similarity index 100% rename from src/05_prepare_glibc.sh rename to src/06_prepare_glibc.sh diff --git a/src/06_get_busybox.sh b/src/07_get_busybox.sh similarity index 100% rename from src/06_get_busybox.sh rename to src/07_get_busybox.sh diff --git a/src/07_build_busybox.sh b/src/08_build_busybox.sh similarity index 100% rename from src/07_build_busybox.sh rename to src/08_build_busybox.sh diff --git a/src/08_generate_rootfs.sh b/src/08_generate_rootfs.sh deleted file mode 100755 index 8e680d32f..000000000 --- a/src/08_generate_rootfs.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# Remember the prepared glibc folder. -GLIBC_PREPARED=$(pwd)/work/glibc/glibc_prepared - -cd work - -echo "Preparing initramfs work area..." -rm -rf rootfs - -# Copy all BusyBox generated stuff to the location of our 'initramfs' folder. -cp -r busybox/busybox_installed rootfs - -# Copy all rootfs resources to the location of our 'initramfs' folder. -cp -r ../08_generate_rootfs/* rootfs - -cd rootfs - -# Remove 'linuxrc' which is used when we boot in 'RAM disk' mode. -rm -f linuxrc - -# Copy all source files to '/src'. Note that the scripts won't work there. -cp ../../*.sh src -cp ../../.config src -cp ../../README src -cp ../../*.txt src -cp -r ../../08_generate_rootfs src -cp -r ../../11_generate_iso src - -# Make all files readable and all scripts executable. -chmod -R +rx **/*.sh -chmod -R +r **/.config -chmod -R +r **/README -chmod -R +r **/*.txt - -# Copy all necessary 'glibc' libraries to '/lib' BEGIN. - -# This is the dynamic loader. The file name is different for 32-bit and 64-bit machines. -cp $GLIBC_PREPARED/lib/ld-linux* ./lib - -# BusyBox has direct dependencies on these libraries. -cp $GLIBC_PREPARED/lib/libm.so.6 ./lib -cp $GLIBC_PREPARED/lib/libc.so.6 ./lib - -# These libraries are necessary for the DNS resolving. -cp $GLIBC_PREPARED/lib/libresolv.so.2 ./lib -cp $GLIBC_PREPARED/lib/libnss_dns.so.2 ./lib - -# Make sure the dynamic loader is visible on 64-bit machines. -ln -s lib lib64 - -# Copy all necessary 'glibc' libraries to '/lib' END. - -# Delete the '.gitignore' files which we use in order to keep track of otherwise -# empty folders. -find * -type f -name '.gitignore' -exec rm {} + - -echo "The initramfs area has been generated." - -cd ../.. - diff --git a/src/08_generate_rootfs/tmp/.gitignore b/src/08_generate_rootfs/tmp/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/09_generate_rootfs.sh b/src/09_generate_rootfs.sh new file mode 100755 index 000000000..323489604 --- /dev/null +++ b/src/09_generate_rootfs.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# Remember the prepared glibc folder. +GLIBC_PREPARED=$(pwd)/work/glibc/glibc_prepared + +cd work + +echo "Preparing initramfs work area..." +rm -rf rootfs + +# Copy all BusyBox generated stuff to the location of our 'initramfs' folder. +cp -r busybox/busybox_installed rootfs + +# Copy all rootfs resources to the location of our 'initramfs' folder. +cp -r ../09_generate_rootfs/* rootfs + +cd rootfs + +# Remove 'linuxrc' which is used when we boot in 'RAM disk' mode. +rm -f linuxrc + +# Read the 'COPY_SOURCE_ROOTFS' property from '.config' +COPY_SOURCE_ROOTFS="$(grep -i COPY_SOURCE_ROOTFS ../../.config | cut -f2 -d'=')" + +if [ "$COPY_SOURCE_ROOTFS" = "true" ] ; then + # Copy all prepared source files and folders to '/src'. Note that the scripts + # will not work there because you also need proper toolchain. + cp -r ../src src + echo "Original source files and folders have been copied." +else + echo "Original source files and folders have been skipped." +fi + +# Copy all necessary 'glibc' libraries to '/lib' BEGIN. + +# This is the dynamic loader. Note that the file name is different for 32-bit +# and 64-bit machines. +cp $GLIBC_PREPARED/lib/ld-linux* ./lib + +# BusyBox has direct dependencies on these libraries. +cp $GLIBC_PREPARED/lib/libm.so.6 ./lib +cp $GLIBC_PREPARED/lib/libc.so.6 ./lib + +# These libraries are necessary for the DNS resolving. +cp $GLIBC_PREPARED/lib/libresolv.so.2 ./lib +cp $GLIBC_PREPARED/lib/libnss_dns.so.2 ./lib + +# Make sure the Linux loader is visible on 64-bit machines. We can't rename the +# folder to '/lib64' because the glibc root location is set to '/lib' in the +# '05_build_glibc.sh' source script and therefore all 64-bit executables will +# be looking for shared libraries directly in '/lib'. +BUSYBOX_ARCH=$(file busybox | cut -d\ -f3) +if [ "$BUSYBOX_ARCH" = "64-bit" ] ; then + ln -s lib lib64 +fi + +# Copy all necessary 'glibc' libraries to '/lib' END. + +echo "The initramfs area has been generated." + +cd ../.. + diff --git a/src/08_generate_rootfs/dev/.gitignore b/src/09_generate_rootfs/dev/.gitignore similarity index 100% rename from src/08_generate_rootfs/dev/.gitignore rename to src/09_generate_rootfs/dev/.gitignore diff --git a/src/08_generate_rootfs/etc/01_prepare.sh b/src/09_generate_rootfs/etc/01_prepare.sh similarity index 100% rename from src/08_generate_rootfs/etc/01_prepare.sh rename to src/09_generate_rootfs/etc/01_prepare.sh diff --git a/src/08_generate_rootfs/etc/02_overlay.sh b/src/09_generate_rootfs/etc/02_overlay.sh similarity index 98% rename from src/08_generate_rootfs/etc/02_overlay.sh rename to src/09_generate_rootfs/etc/02_overlay.sh index 581d09e6b..8247fbe3c 100755 --- a/src/08_generate_rootfs/etc/02_overlay.sh +++ b/src/09_generate_rootfs/etc/02_overlay.sh @@ -38,7 +38,7 @@ echo "Created folders for all critical file systems." # Copy root folders in the new mountpoint. echo "Copying the root file system to /mnt..." -cp -a bin etc lib lib64 root sbin src usr /mnt +cp -a bin etc lib lib64 root sbin src usr /mnt 2>/dev/null DEFAULT_OVERLAY_DIR="/tmp/minimal/overlay" DEFAULT_UPPER_DIR="/tmp/minimal/rootfs" diff --git a/src/08_generate_rootfs/etc/03_init.sh b/src/09_generate_rootfs/etc/03_init.sh similarity index 100% rename from src/08_generate_rootfs/etc/03_init.sh rename to src/09_generate_rootfs/etc/03_init.sh diff --git a/src/08_generate_rootfs/etc/04_bootscript.sh b/src/09_generate_rootfs/etc/04_bootscript.sh similarity index 100% rename from src/08_generate_rootfs/etc/04_bootscript.sh rename to src/09_generate_rootfs/etc/04_bootscript.sh diff --git a/src/08_generate_rootfs/etc/05_rc.dhcp b/src/09_generate_rootfs/etc/05_rc.dhcp similarity index 100% rename from src/08_generate_rootfs/etc/05_rc.dhcp rename to src/09_generate_rootfs/etc/05_rc.dhcp diff --git a/src/08_generate_rootfs/etc/inittab b/src/09_generate_rootfs/etc/inittab similarity index 100% rename from src/08_generate_rootfs/etc/inittab rename to src/09_generate_rootfs/etc/inittab diff --git a/src/08_generate_rootfs/etc/resolv.conf b/src/09_generate_rootfs/etc/resolv.conf similarity index 100% rename from src/08_generate_rootfs/etc/resolv.conf rename to src/09_generate_rootfs/etc/resolv.conf diff --git a/src/08_generate_rootfs/etc/welcome.txt b/src/09_generate_rootfs/etc/welcome.txt similarity index 100% rename from src/08_generate_rootfs/etc/welcome.txt rename to src/09_generate_rootfs/etc/welcome.txt diff --git a/src/08_generate_rootfs/init b/src/09_generate_rootfs/init similarity index 100% rename from src/08_generate_rootfs/init rename to src/09_generate_rootfs/init diff --git a/src/08_generate_rootfs/lib/.gitignore b/src/09_generate_rootfs/lib/.gitignore similarity index 100% rename from src/08_generate_rootfs/lib/.gitignore rename to src/09_generate_rootfs/lib/.gitignore diff --git a/src/08_generate_rootfs/mnt/.gitignore b/src/09_generate_rootfs/mnt/.gitignore similarity index 100% rename from src/08_generate_rootfs/mnt/.gitignore rename to src/09_generate_rootfs/mnt/.gitignore diff --git a/src/08_generate_rootfs/proc/.gitignore b/src/09_generate_rootfs/proc/.gitignore similarity index 100% rename from src/08_generate_rootfs/proc/.gitignore rename to src/09_generate_rootfs/proc/.gitignore diff --git a/src/08_generate_rootfs/root/.gitignore b/src/09_generate_rootfs/root/.gitignore similarity index 100% rename from src/08_generate_rootfs/root/.gitignore rename to src/09_generate_rootfs/root/.gitignore diff --git a/src/08_generate_rootfs/src/.gitignore b/src/09_generate_rootfs/sys/.gitignore similarity index 100% rename from src/08_generate_rootfs/src/.gitignore rename to src/09_generate_rootfs/sys/.gitignore diff --git a/src/08_generate_rootfs/sys/.gitignore b/src/09_generate_rootfs/tmp/.gitignore similarity index 100% rename from src/08_generate_rootfs/sys/.gitignore rename to src/09_generate_rootfs/tmp/.gitignore diff --git a/src/09_pack_rootfs.sh b/src/10_pack_rootfs.sh similarity index 100% rename from src/09_pack_rootfs.sh rename to src/10_pack_rootfs.sh diff --git a/src/10_get_syslinux.sh b/src/11_get_syslinux.sh similarity index 100% rename from src/10_get_syslinux.sh rename to src/11_get_syslinux.sh diff --git a/src/11_generate_iso.sh b/src/12_generate_iso.sh similarity index 80% rename from src/11_generate_iso.sh rename to src/12_generate_iso.sh index 77d374e2d..646dcd23c 100755 --- a/src/11_generate_iso.sh +++ b/src/12_generate_iso.sh @@ -19,7 +19,7 @@ rm -f minimal_linux_live.iso echo "Old ISO image files has been removed." # Remove the old ISO generation area if it exists. -echo "Removing old ISO image work area..." +echo "Removing old ISO image work area. This may take a while..." rm -rf work/isoimage # This is the root folder of the ISO image. @@ -37,20 +37,17 @@ cp $WORK_KERNEL_DIR/arch/x86/boot/bzImage ./kernel.xz # Now we copy the root file system. cp ../rootfs.cpio.xz ./rootfs.xz -# Copy all source files to '/src'. Note that the scripts won't work there. -mkdir src -cp ../../*.sh src -cp ../../.config src -cp ../../README src -cp ../../*.txt src -cp -r ../../08_generate_rootfs src -cp -r ../../11_generate_iso src +# Read the 'COPY_SOURCE_ISO' property from '.config' +COPY_SOURCE_ISO="$(grep -i COPY_SOURCE_ISO ../../.config | cut -f2 -d'=')" -# Make all files readable and all scripts executable. -chmod -R +rx **/*.sh -chmod -R +r **/.config -chmod -R +r **/README -chmod -R +r **/*.txt +if [ "$COPY_SOURCE_ISO" = "true" ] ; then + # Copy all prepared source files and folders to '/src'. Note that the scripts + # will not work there because you also need proper toolchain. + cp -r ../src src + echo "Original source files and folders have been copied." +else + echo "Original source files and folders have been skipped." +fi # Read the 'OVERLAY_TYPE' property from '.config' OVERLAY_TYPE="$(grep -i OVERLAY_TYPE $SRC_DIR/.config | cut -f2 -d'=')" @@ -58,7 +55,7 @@ OVERLAY_TYPE="$(grep -i OVERLAY_TYPE $SRC_DIR/.config | cut -f2 -d'=')" if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then # Use sparse file as storage place. The above check guarantees that the whole # script is executed with root permissions or otherwise this block is skipped. - # All files and folders located in the folder '11_generate_iso' will be merged + # All files and folders located in the folder '12_generate_iso' will be merged # with the root folder on boot. echo "Using sparse file for overlay." @@ -87,7 +84,7 @@ if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then mkdir -p sparse/work # Copy the overlay content. - cp -r $SRC_DIR/11_generate_iso/* sparse/rootfs/ + cp -r $SRC_DIR/12_generate_iso/* sparse/rootfs/ # Unmount the sparse file and delete the temporary folder. $BUSYBOX umount sparse @@ -97,14 +94,14 @@ if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then $BUSYBOX losetup -d $LOOP_DEVICE elif [ "$OVERLAY_TYPE" = "folder" ] ; then # Use normal folder structure for overlay. All files and folders located in - # the folder '11_generate_iso' will be merged with the root folder on boot. + # the folder '12_generate_iso' will be merged with the root folder on boot. echo "Using folder structure for overlay." mkdir -p minimal/rootfs mkdir -p minimal/work - cp -rf $SRC_DIR/11_generate_iso/* minimal/rootfs/ + cp -rf $SRC_DIR/12_generate_iso/* minimal/rootfs/ else echo "Generating ISO image with no overlay structure..." fi @@ -112,10 +109,6 @@ fi # Create ISOLINUX configuration file. echo 'default kernel.xz initrd=rootfs.xz' > ./isolinux.cfg -# Delete the '.gitignore' files which we use in order to keep track of otherwise -# empty folders. -find * -type f -name '.gitignore' -exec rm {} + - # Now we generate the ISO image file. 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 ./ @@ -133,5 +126,5 @@ if [ "$(id -u)" = "0" ] ; then echo "Applied original ownership to all affected files and folders." fi -cd ../.. +cd $SRC_DIR diff --git a/src/11_generate_iso/README.txt b/src/12_generate_iso/README.txt similarity index 100% rename from src/11_generate_iso/README.txt rename to src/12_generate_iso/README.txt diff --git a/src/Makefile b/src/Makefile index 4f56a0748..f7bd1fabe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,9 +22,9 @@ clean: @echo "Removing build log file..." @rm -f minimal_linux_live.log -emulator: +qemu: @if [ ! -f ./minimal_linux_live.iso ]; then echo "ISO image \"minimal_linux_live.iso\" not found."; exit 1; fi - @echo "Launching emulator..." + @echo "Launching QEMU..." @if [ "$(shell uname -m)" = "x86_64" ]; then sh qemu64.sh; else sh qemu32.sh; fi help: @@ -33,7 +33,7 @@ help: @echo "" @echo " make clean remove all generated files" @echo "" - @echo " make emulator run \"Minimal Linux Live\" in qemu" + @echo " make qemu run \"Minimal Linux Live\" in qemu" @echo "" @echo " make help this is the default target" @echo "" diff --git a/src/build_minimal_linux_live.sh b/src/build_minimal_linux_live.sh index 547b95e90..567c9275e 100755 --- a/src/build_minimal_linux_live.sh +++ b/src/build_minimal_linux_live.sh @@ -1,15 +1,16 @@ #!/bin/sh -sh 00_prepare.sh -sh 01_get_kernel.sh -sh 02_build_kernel.sh -sh 03_get_glibc.sh -sh 04_build_glibc.sh -sh 05_prepare_glibc.sh -sh 06_get_busybox.sh -sh 07_build_busybox.sh -sh 08_generate_rootfs.sh -sh 09_pack_rootfs.sh -sh 10_get_syslinux.sh -sh 11_generate_iso.sh +sh 00_clean.sh +sh 01_prepare_src.sh +sh 02_get_kernel.sh +sh 03_build_kernel.sh +sh 04_get_glibc.sh +sh 05_build_glibc.sh +sh 06_prepare_glibc.sh +sh 07_get_busybox.sh +sh 08_build_busybox.sh +sh 09_generate_rootfs.sh +sh 10_pack_rootfs.sh +sh 11_get_syslinux.sh +sh 12_generate_iso.sh