diff --git a/src/02_build_kernel.sh b/src/02_build_kernel.sh index 17f4ea6a3..57a4c46f6 100755 --- a/src/02_build_kernel.sh +++ b/src/02_build_kernel.sh @@ -39,7 +39,7 @@ fi if [ "$USE_PREDEFINED_KERNEL_CONFIG" = "true" ] ; then # Use predefined configuration file for the kernel. - echo "Using config file $SRC_DIR/minimal_config/kernel.config" + echo "Using config file $SRC_DIR/minimal_config/kernel.config" cp -f $SRC_DIR/minimal_config/kernel.config .config else # Create default configuration file for the kernel. @@ -51,16 +51,16 @@ else # Enable overlay support, e.g. merge ro and rw directories (3.18+). sed -i "s/.*CONFIG_OVERLAY_FS.*/CONFIG_OVERLAY_FS=y/" .config - + # Enable overlayfs redirection (4.10+). echo "CONFIG_OVERLAY_FS_REDIRECT_DIR=y" >> .config # Turn on inodes index feature by default (4.13+). echo "CONFIG_OVERLAY_FS_INDEX=y" >> .config - + # Step 1 - disable all active kernel compression options (should be only one). - sed -i "s/.*\\(CONFIG_KERNEL_.*\\)=y/\\#\\ \\1 is not set/" .config - + sed -i "s/.*\\(CONFIG_KERNEL_.*\\)=y/\\#\\ \\1 is not set/" .config + # Step 2 - enable the 'xz' compression option. sed -i "s/.*CONFIG_KERNEL_XZ.*/CONFIG_KERNEL_XZ=y/" .config @@ -77,13 +77,13 @@ else sed -i "s/.*CONFIG_LOGO_LINUX_CLUT224.*/\\# CONFIG_LOGO_LINUX_CLUT224 is not set/" .config echo "Boot logo is disabled." fi - + # Disable debug symbols in kernel => smaller kernel binary. sed -i "s/^CONFIG_DEBUG_KERNEL.*/\\# CONFIG_DEBUG_KERNEL is not set/" .config # Enable the EFI stub sed -i "s/.*CONFIG_EFI_STUB.*/CONFIG_EFI_STUB=y/" .config - + # Disable Apple Properties (Useful for Macs but useless in general) echo "CONFIG_APPLE_PROPERTIES=n" >> .config diff --git a/src/07_build_busybox.sh b/src/07_build_busybox.sh index aa9de0197..03b836f07 100755 --- a/src/07_build_busybox.sh +++ b/src/07_build_busybox.sh @@ -38,13 +38,13 @@ fi if [ "$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" ] ; then # Use predefined configuration file for Busybox. - echo "Using config file $SRC_DIR/minimal_config/busybox.config" + echo "Using config file $SRC_DIR/minimal_config/busybox.config" cp -f $SRC_DIR/minimal_config/busybox.config .config else # Create default configuration file. - echo "Generating default BusyBox configuration..." + echo "Generating default BusyBox configuration..." make defconfig -j $NUM_JOBS - + # The 'inetd' applet fails to compile because we use the glibc installation area as # main pointer to the kernel headers (see 05_prepare_glibc.sh) and some headers are # not resolved. The easiest solution is to ignore this particular applet. diff --git a/src/09_generate_rootfs.sh b/src/09_generate_rootfs.sh index bbdab9aa7..a83b5eda8 100755 --- a/src/09_generate_rootfs.sh +++ b/src/09_generate_rootfs.sh @@ -24,7 +24,7 @@ cp -r src/minimal_rootfs/* rootfs cd rootfs -# Remove 'linuxrc' which is used when we boot in 'RAM disk' mode. +# Remove 'linuxrc' which is used when we boot in 'RAM disk' mode. rm -f linuxrc # Read the 'COPY_SOURCE_ROOTFS' property from '.config' diff --git a/src/12_generate_iso.sh b/src/12_generate_iso.sh index 92a2899c0..2883ae184 100755 --- a/src/12_generate_iso.sh +++ b/src/12_generate_iso.sh @@ -2,14 +2,14 @@ # TODO - this shell script file needs serios refactoring since right now it does # too many things: -# +# # 1) Deal with 'src' copy. # 2) Generate the 'overlay' software bundles. # 3) Create proper overlay structure. # 4) Prepare the actual ISO structure. # 5) Generate the actual ISO image. # -# Probably it's best to create separate shell scripts for each functionality. +# Probably it's best to create separate shell scripts for each functionality. echo "*** GENERATE ISO BEGIN ***" @@ -76,51 +76,51 @@ if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then # script is executed with root permissions or otherwise this block is skipped. # All files and folders located in the folder 'minimal_overlay' will be merged # with the root folder on boot. - + echo "Using sparse file for overlay." - + # This is the BusyBox executable that we have already generated. - BUSYBOX=../rootfs/bin/busybox - + BUSYBOX=../rootfs/bin/busybox + # Create sparse image file with 1MB size. Note that this increases the ISO # image size. $BUSYBOX truncate -s 1M minimal.img - + # Find available loop device. LOOP_DEVICE=$($BUSYBOX losetup -f) - + # Associate the available loop device with the sparse image file. $BUSYBOX losetup $LOOP_DEVICE minimal.img - - # Format the sparse image file with Ext2 file system. + + # Format the sparse image file with Ext2 file system. $BUSYBOX mkfs.ext2 $LOOP_DEVICE - + # Mount the sparse file in folder 'sparse". mkdir sparse $BUSYBOX mount minimal.img sparse - + # Create the overlay folders. mkdir -p sparse/rootfs - mkdir -p sparse/work - + mkdir -p sparse/work + # Copy the overlay content. cp -r $SRC_DIR/work/src/minimal_overlay/rootfs/* sparse/rootfs/ - + # Unmount the sparse file and delete the temporary folder. $BUSYBOX umount sparse rm -rf sparse - + # Detach the loop device since we no longer need it. $BUSYBOX losetup -d $LOOP_DEVICE elif [ "$OVERLAY_TYPE" = "folder" ] ; then # Use normal folder structure for overlay. All files and folders located in # the folder 'minimal_overlay' will be merged with the root folder on boot. - + echo "Using folder structure for overlay." - + mkdir -p minimal/rootfs - mkdir -p minimal/work - + mkdir -p minimal/work + cp -rf $SRC_DIR/work/src/minimal_overlay/rootfs/* \ minimal/rootfs/ else diff --git a/src/generate_hdd.sh b/src/generate_hdd.sh index 6be0ad313..e1c36aa4d 100755 --- a/src/generate_hdd.sh +++ b/src/generate_hdd.sh @@ -12,36 +12,36 @@ elif [ "$1" = "-f" -o "$1" = "--folder" ] ; then echo "Using option '-f' (or '--folder') requires root permissions." exit 1 fi - + rm -f hdd.img truncate -s 20M hdd.img echo "Created new hard disk image file 'hdd.img' with 20MB size." - + LOOP_DEVICE=$(losetup -f) losetup $LOOP_DEVICE hdd.img echo "Attached hard disk image file to loop device." - + mkfs.ext2 $LOOP_DEVICE echo "Hard disk image file has been formatted with Ext2 filesystem." - + mkdir folder mount hdd.img folder echo "Mounted hard disk image file to temporary folder." - + mkdir -p folder/minimal/rootfs mkdir -p folder/minimal/work echo "Overlay structure has been created." - - echo "This file is on external hard disk." > folder/minimal/rootfs/overlay.txt + + echo "This file is on external hard disk." > folder/minimal/rootfs/overlay.txt echo "Created sample text file." umount folder rm -rf folder echo "Unmounted hard disk image file." - + losetup -d $LOOP_DEVICE echo "Detached hard disk image file from loop device." - + chown $(logname) hdd.img echo "Applied original ownership to hard disk image file." elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then @@ -49,22 +49,22 @@ elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then echo "Using option '-s' (or '--sparse') requires root permissions." exit 1 fi - + rm -f hdd.img truncate -s 20M hdd.img echo "Created new hard disk image file 'hdd.img' with 20MB size." - + LOOP_DEVICE_HDD=$(losetup -f) losetup $LOOP_DEVICE_HDD hdd.img echo "Attached hard disk image file to loop device." - + mkfs.vfat $LOOP_DEVICE_HDD echo "Hard disk image file has been formatted with FAT filesystem." - + mkdir sparse mount hdd.img sparse echo "Mounted hard disk image file to temporary folder." - + rm -f sparse/minimal.img truncate -s 1M sparse/minimal.img echo "Created new overlay image file with 1MB size." @@ -79,11 +79,11 @@ elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then mkdir ovl mount sparse/minimal.img ovl echo "Mounted overlay image file to temporary folder." - + mkdir -p ovl/rootfs mkdir -p ovl/work echo "Overlay structure has been created." - + echo "Create sample text file." echo "This file is on external hard disk." > ovl/rootfs/overlay.txt @@ -99,15 +99,15 @@ elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then sleep 1 echo "Overlay image file has been detached from loop device." - umount sparse + umount sparse sleep 1 rm -rf sparse echo "Unmounted hard disk image file." - + losetup -d $LOOP_DEVICE_HDD sleep 1 echo "Hard disk image file has been detached from loop device." - + chown $(logname) hdd.img echo "Applied original ownership to hard disk image file." elif [ "$1" = "-h" -o "$1" = "--help" ] ; then @@ -115,7 +115,7 @@ elif [ "$1" = "-h" -o "$1" = "--help" ] ; then Usage: $0 [OPTION] This utility generates 20MB sparse file 'hdd.img' which can be used as QEMU disk image where all filesystem changes from the live session are persisted. - + -e, --empty Create empty sparse image file which is not formatted. -f, --folder Create sparse image file formatted with Ext2 filesystem which contains compatible overlay folder structure. diff --git a/src/minimal_overlay/overlay_clean.sh b/src/minimal_overlay/overlay_clean.sh index 38c557806..458d3ca37 100755 --- a/src/minimal_overlay/overlay_clean.sh +++ b/src/minimal_overlay/overlay_clean.sh @@ -25,7 +25,7 @@ for dir in $(ls -d */ 2>/dev/null) ; do cp -r $dir $SRC_DIR/../work/src/minimal_overlay/rootfs echo "Default overlay folder '$dir' has been prepared." done - + echo "Ready to continue with the overlay software." cd $SRC_DIR