From 8420232e44e916672778f2c7e08d1eb30a02a8ff Mon Sep 17 00:00:00 2001 From: Ivan Davidov Date: Sat, 23 Apr 2016 01:52:33 +0300 Subject: [PATCH] Forgot to perform 'git add' on most of the files from the previous commit. --- src/.config | 31 +++++++++++++++++------------- src/00_prepare.sh | 2 +- src/01_get_kernel.sh | 21 +++++++++++++++++--- src/02_build_kernel.sh | 18 +++++++++++++---- src/03_get_glibc.sh | 21 +++++++++++++++++--- src/04_build_glibc.sh | 7 ++++++- src/05_prepare_glibc.sh | 4 ++-- src/06_get_busybox.sh | 21 +++++++++++++++++--- src/07_build_busybox.sh | 18 +++++++++++++---- src/08_generate_rootfs.sh | 1 + src/08_generate_rootfs/etc/inittab | 6 +++--- src/08_generate_rootfs/init | 12 +++++++++--- src/09_pack_rootfs.sh | 1 + src/10_get_syslinux.sh | 21 +++++++++++++++++--- src/11_generate_iso.sh | 9 +++++++-- src/Makefile | 2 ++ src/generate_hdd.sh | 7 +++++++ src/qemu32.sh | 18 ++++++++++++----- src/qemu64.sh | 19 +++++++++++++----- 19 files changed, 184 insertions(+), 55 deletions(-) create mode 100755 src/generate_hdd.sh diff --git a/src/.config b/src/.config index 764519c13..93495ea8a 100644 --- a/src/.config +++ b/src/.config @@ -2,7 +2,7 @@ # # http://kernel.org # -KERNEL_SOURCE_URL=https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.6.tar.xz +KERNEL_SOURCE_URL=http://kernel.org/pub/linux/kernel/v4.x/linux-4.4.6.tar.xz # You can find the latest GNU libc source bundles here: # @@ -22,32 +22,32 @@ BUSYBOX_SOURCE_URL=http://busybox.net/downloads/busybox-1.24.2.tar.bz2 # # http://kernel.org/pub/linux/utils/boot/syslinux # -SYSLINUX_SOURCE_URL=https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz +SYSLINUX_SOURCE_URL=http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz -### ### ### -### ### ### -### ### ### +### ### ### ### +### ### ### ### +### ### ### ### # 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. -# You can comment, leave undefined or use nonexisting file in order to disable the property and -# rely on automatic config generation. The file location is relative from the source folder. +# Place the configuration file here: config_predefined/kernel.config # -# KERNEL_CONFIG_FILE=path/to/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. -# You can comment, leave undefined or use nonexisting file in order to disable the property and -# rely on automatic config generation. The file location is relative from the source folder. +# # Place the configuration file here: config_predefined/busybox.config # -# BUSYBOX_CONFIG_FILE=path/to/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. If the boot media is writeable, then all changes on -# the root filesystem are automatically persisted. +# 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 @@ -60,3 +60,8 @@ SYSLINUX_SOURCE_URL=https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinu # 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_LOCAL_SOURCE=false + diff --git a/src/00_prepare.sh b/src/00_prepare.sh index de8c34e68..6664d1e1c 100755 --- a/src/00_prepare.sh +++ b/src/00_prepare.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo "Cleaning up the work area..." +echo "Cleaning up the work area. This may take a while..." rm -rf work mkdir work diff --git a/src/01_get_kernel.sh b/src/01_get_kernel.sh index 266664da9..986f2b4de 100755 --- a/src/01_get_kernel.sh +++ b/src/01_get_kernel.sh @@ -1,18 +1,33 @@ #!/bin/sh +SRC_DIR=$(pwd) + # Grab everything after the '=' character. DOWNLOAD_URL=$(grep -i KERNEL_SOURCE_URL .config | cut -f2 -d'=') # Grab everything after the last '/' character. ARCHIVE_FILE=${DOWNLOAD_URL##*/} +# Read the 'USE_LOCAL_SOURCE' property from '.config' +USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE .config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE ] ; then + echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + cd source -# Downloading kernel file. -# -c option allows the download to resume. -wget -c $DOWNLOAD_URL +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading kernel source bundle file. The '-c' option allows the download to resume. + echo "Downloading kernel source bundle from '$DOWNLOAD_URL'." + wget -c $DOWNLOAD_URL +else + echo "Using local kernel source bundle $SRC_DIR/source/$ARCHIVE_FILE" +fi # Delete folder with previously extracted kernel. +echo "Removing kernel work area..." rm -rf ../work/kernel mkdir ../work/kernel diff --git a/src/02_build_kernel.sh b/src/02_build_kernel.sh index 777a56c66..deccb6581 100755 --- a/src/02_build_kernel.sh +++ b/src/02_build_kernel.sh @@ -8,16 +8,24 @@ cd work/kernel cd $(ls -d *) # Cleans up the kernel sources, including configuration files. +echo "Preparing kernel work area..." make mrproper -# Read the 'KERNEL_CONFIG_FILE' property from '.config' -KERNEL_CONFIG_FILE="$SRC_DIR/$(grep -i KERNEL_CONFIG_FILE $SRC_DIR/.config | cut -f2 -d'=')" +# Read the 'USE_PREDEFINED_KERNEL_CONFIG' property from '.config' +USE_PREDEFINED_KERNEL_CONFIG="$(grep -i USE_PREDEFINED_KERNEL_CONFIG $SRC_DIR/.config | cut -f2 -d'=')" -if [ -f $KERNEL_CONFIG_FILE ] ; then +if [ "$USE_PREDEFINED_KERNEL_CONFIG" = "true" -a ! -f $SRC_DIR/config_predefined/kernel.config ] ; then + echo "Config file $SRC_DIR/config_predefined/kernel.config does not exist." + USE_PREDEFINED_KERNEL_CONFIG="false" +fi + +if [ "$USE_PREDEFINED_KERNEL_CONFIG" = "true" ] ; then # Use predefined configuration file for the kernel. - cp $KERNEL_CONFIG_FILE .config + echo "Using config file $SRC_DIR/config_predefined/kernel.config" + cp -f $SRC_DIR/config_predefined/kernel.config .config else # Create default configuration file for the kernel. + echo "Generating default kernel configuration..." make defconfig # Changes the name of the system to 'minimal'. @@ -30,10 +38,12 @@ fi # 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 +echo "Building kernel..." make bzImage -j $(grep ^processor /proc/cpuinfo | wc -l) # Install kernel headers in './usr' (this is not '/usr') which are used later # when we build and configure the GNU C library (glibc). +echo "Generating kernel headers..." make headers_install cd ../../.. diff --git a/src/03_get_glibc.sh b/src/03_get_glibc.sh index 06bebf2a7..c5ef24594 100755 --- a/src/03_get_glibc.sh +++ b/src/03_get_glibc.sh @@ -1,18 +1,33 @@ #!/bin/sh +SRC_DIR=$(pwd) + # Grab everything after the '=' character. DOWNLOAD_URL=$(grep -i GLIBC_SOURCE_URL .config | cut -f2 -d'=') # Grab everything after the last '/' character. ARCHIVE_FILE=${DOWNLOAD_URL##*/} +# Read the 'USE_LOCAL_SOURCE' property from '.config' +USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE .config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE ] ; then + echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + cd source -# Downloading glibc file. -# -c option allows the download to resume. -wget -c $DOWNLOAD_URL +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading glibc source bundle file. The '-c' option allows the download to resume. + echo "Downloading glibc source bundle from '$DOWNLOAD_URL'." + wget -c $DOWNLOAD_URL +else + echo "Using local glibc source bundle $SRC_DIR/source/$ARCHIVE_FILE" +fi # Delete folder with previously extracted glibc. +echo "Removing glibc work area..." rm -rf ../work/glibc mkdir ../work/glibc diff --git a/src/04_build_glibc.sh b/src/04_build_glibc.sh index 74390faa5..f525d6a39 100755 --- a/src/04_build_glibc.sh +++ b/src/04_build_glibc.sh @@ -12,10 +12,12 @@ cd work/glibc cd $(ls -d *) # Prepare working area, e.g. 'work/glibc/glibc-2.23/glibc_objects'. +echo "Preparing glibc object area..." rm -rf ./glibc_objects mkdir glibc_objects -# Prepare installation area, e.g. 'work/glibc/glibc-2.23/glibc_installed'. +# Prepare install area, e.g. 'work/glibc/glibc-2.23/glibc_installed'. +echo "Preparing glibc install area..." rm -rf ./glibc_installed mkdir glibc_installed cd glibc_installed @@ -27,12 +29,15 @@ 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. +echo "Configuring glibc..." ../configure --prefix= --with-headers=$WORK_KERNEL_DIR/usr/include --without-gd --without-selinux --disable-werror # Compile glibc with optimization for "parallel jobs" = "number of processors". +echo "Building glibc..." make -j $(grep ^processor /proc/cpuinfo | wc -l) # Install glibc in the installation area, e.g. 'work/glibc/glibc-2.23/glibc_installed'. +echo "Installing glibc..." make install DESTDIR=$GLIBC_INSTALLED -j $(grep ^processor /proc/cpuinfo | wc -l) cd ../../.. diff --git a/src/05_prepare_glibc.sh b/src/05_prepare_glibc.sh index 9b18f0ec9..1e90f6f89 100755 --- a/src/05_prepare_glibc.sh +++ b/src/05_prepare_glibc.sh @@ -25,14 +25,14 @@ cd glibc_installed # | | # | +--asm-generic (kernel) # | | -# | +--asm-generic (kernel) -# | | # | +--linux (kernel) # | | # | +--mtd (kernel) # | # +--lib (glibc) +echo "Preparing glibc..." + mkdir -p usr cd usr diff --git a/src/06_get_busybox.sh b/src/06_get_busybox.sh index ef7cd387c..067d19fc7 100755 --- a/src/06_get_busybox.sh +++ b/src/06_get_busybox.sh @@ -1,18 +1,33 @@ #!/bin/sh +SRC_DIR=$(pwd) + # Grab everything after the '=' character. DOWNLOAD_URL=$(grep -i BUSYBOX_SOURCE_URL .config | cut -f2 -d'=') # Grab everything after the last '/' character. ARCHIVE_FILE=${DOWNLOAD_URL##*/} +# Read the 'USE_LOCAL_SOURCE' property from '.config' +USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE .config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE ] ; then + echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + cd source -# Downloading busybox source. -# -c option allows the download to resume. -wget -c $DOWNLOAD_URL +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading BusyBox source bundle file. The '-c' option allows the download to resume. + echo "Downloading BusyBox source bundle from '$DOWNLOAD_URL'." + wget -c $DOWNLOAD_URL +else + echo "Using local BusyBox source bundle $SRC_DIR/source/$ARCHIVE_FILE" +fi # Delete folder with previously extracted busybox. +echo "Removing BusyBox work area..." rm -rf ../work/busybox mkdir ../work/busybox diff --git a/src/07_build_busybox.sh b/src/07_build_busybox.sh index 4b4a55fbd..93cba11b6 100755 --- a/src/07_build_busybox.sh +++ b/src/07_build_busybox.sh @@ -15,16 +15,24 @@ cd work/busybox cd $(ls -d *) # Remove previously generated artifacts. +echo "Preparing BusyBox work area..." make distclean -# Read the 'BUSYBOX_CONFIG_FILE' property from '.config' -BUSYBOX_CONFIG_FILE="$SRC_DIR/$(grep -iBUSYBOX_CONFIG_FILE $SRC_DIR/.config | cut -f2 -d'=')" +# Read the 'USE_PREDEFINED_BUSYBOX_CONFIG' property from '.config' +USE_PREDEFINED_BUSYBOX_CONFIG="$(grep -i USE_PREDEFINED_BUSYBOX_CONFIG $SRC_DIR/.config | cut -f2 -d'=')" -if [ -f $BUSYBOX_CONFIG_FILE ] ; then +if [ "$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" -a ! -f $SRC_DIR/config_predefined/busybox.config ] ; then + echo "Config file $SRC_DIR/config_predefined/busybox.config does not exist." + USE_PREDEFINED_BUSYBOX_CONFIG="false" +fi + +if [ "$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" ] ; then # Use predefined configuration file for Busybox. - cp $BUSYBOX_CONFIG_FILE .config + echo "Using config file $SRC_DIR/config_predefined/busybox.config" + cp -f $SRC_DIR/config_predefined/busybox.config .config else # Create default configuration file. + echo "Generating default BusyBox configuration..." make defconfig # The 'inetd' applet fails to compile because we use the glibc installation area as @@ -41,9 +49,11 @@ GLIBC_INSTALLED_ESCAPED=$(echo \"$GLIBC_INSTALLED\" | sed 's/\//\\\//g') sed -i "s/.*CONFIG_SYSROOT.*/CONFIG_SYSROOT=$GLIBC_INSTALLED_ESCAPED/" .config # Compile busybox with optimization for "parallel jobs" = "number of processors". +echo "Building BusyBox..." make busybox -j $(grep ^processor /proc/cpuinfo | wc -l) # Create the symlinks for busybox. The file 'busybox.links' is used for this. +echo "Generating BusyBox based initramfs area..." make install cd ../../.. diff --git a/src/08_generate_rootfs.sh b/src/08_generate_rootfs.sh index 278a258f5..28314d5de 100755 --- a/src/08_generate_rootfs.sh +++ b/src/08_generate_rootfs.sh @@ -10,6 +10,7 @@ cd ../../../.. cd work +echo "Preparing initramfs work area..." rm -rf rootfs cd busybox diff --git a/src/08_generate_rootfs/etc/inittab b/src/08_generate_rootfs/etc/inittab index 4ede63d7e..463866def 100644 --- a/src/08_generate_rootfs/etc/inittab +++ b/src/08_generate_rootfs/etc/inittab @@ -1,8 +1,8 @@ ::sysinit:/etc/bootscript.sh ::restart:/sbin/init -::shutdown:echo "Syncing file buffers..." -::shutdown:/bin/sync -::shutdown:echo "Unmounting all filesystems..." +::shutdown:echo "Sync file buffers..." +::shutdown:sync +::shutdown:echo "Unmount all filesystems..." ::shutdown:umount -a -r ::ctrlaltdel:/sbin/reboot ::once:cat /etc/welcome.txt diff --git a/src/08_generate_rootfs/init b/src/08_generate_rootfs/init index 6dcaf2a62..4e8ca293e 100755 --- a/src/08_generate_rootfs/init +++ b/src/08_generate_rootfs/init @@ -3,8 +3,14 @@ echo "Welcome to \"Minimal Linux Live\" (/init)" # Let's mount all core file systems. -/etc/prepare.sh +/etc/01_prepare.sh -# Now let's create new mountpoint in RAM and make it our new root location. -exec /etc/switch.sh +# Create new mountpoint in RAM, make it our new root location and overlay it +# with our storage area (if overlay area exists at all). This operation invokes +# the script '/etc/03_switch.sh' as the new init process. +exec /etc/02_overlay.sh +echo "(/init) - you can never see this unless there is a serious bug..." + +# Wait until any key has been pressed. +read -n1 -s diff --git a/src/09_pack_rootfs.sh b/src/09_pack_rootfs.sh index 020d0fc42..8b4094d65 100755 --- a/src/09_pack_rootfs.sh +++ b/src/09_pack_rootfs.sh @@ -8,6 +8,7 @@ rm -f rootfs.cpio.gz cd rootfs # Packs the current 'initramfs' folder structure in 'cpio.gz' archive. +echo "Packing initramfs..." find . | cpio -R root:root -H newc -o | gzip > ../rootfs.cpio.gz cd ../.. diff --git a/src/10_get_syslinux.sh b/src/10_get_syslinux.sh index 1d22c5dec..54ccbf232 100755 --- a/src/10_get_syslinux.sh +++ b/src/10_get_syslinux.sh @@ -1,18 +1,33 @@ #!/bin/sh +SRC_DIR=$(pwd) + # Grab everything after the '=' character. DOWNLOAD_URL=$(grep -i SYSLINUX_SOURCE_URL .config | cut -f2 -d'=') # Grab everything after the last '/' character. ARCHIVE_FILE=${DOWNLOAD_URL##*/} +# Read the 'USE_LOCAL_SOURCE' property from '.config' +USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE .config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE ] ; then + echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + cd source -# Downloading Syslinux file. -# -c option allows the download to resume. -wget -c $DOWNLOAD_URL +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading SYSLINUX source bundle file. The '-c' option allows the download to resume. + echo "Downloading SYSLINUX source bundle from '$DOWNLOAD_URL'." + wget -c $DOWNLOAD_URL +else + echo "Using local SYSLINUX source bundle $SRC_DIR/source/$ARCHIVE_FILE" +fi # Delete folder with previously extracted Syslinux. +echo "Removing SYSLINUX work area..." rm -rf ../work/syslinux mkdir ../work/syslinux diff --git a/src/11_generate_iso.sh b/src/11_generate_iso.sh index 17837cf08..8ab54158d 100755 --- a/src/11_generate_iso.sh +++ b/src/11_generate_iso.sh @@ -15,12 +15,15 @@ WORK_SYSLINUX_DIR=$(pwd) cd ../../.. # Remove the old ISO file if it exists. +echo "Removing old ISO image..." rm -f minimal_linux_live.iso # Remove the old ISO generation area if it exists. +echo "Removing old ISO image work area..." rm -rf work/isoimage # This is the root folder of the ISO image. +echo "Preparing ISO image work area..." mkdir work/isoimage cd work/isoimage @@ -80,7 +83,7 @@ if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then # Copy the overlay content. cp -r $SRC_DIR/11_generate_iso/* sparse/rootfs/ - # Unmount the sparse file and thelete the temporary folder. + # Unmount the sparse file and delete the temporary folder. $BUSYBOX umount sparse rm -rf sparse @@ -95,7 +98,9 @@ elif [ "$OVERLAY_TYPE" = "folder" ] ; then mkdir -p minimal/rootfs mkdir -p minimal/work - cp -r $SRC_DIR/11_generate_iso/* minimal/rootfs/ + cp -rf $SRC_DIR/11_generate_iso/* minimal/rootfs/ +else + echo "Generated ISO image will have no overlay structure." fi # Create ISOLINUX configuration file. diff --git a/src/Makefile b/src/Makefile index 6fa8c80a1..4f56a0748 100644 --- a/src/Makefile +++ b/src/Makefile @@ -17,6 +17,8 @@ clean: @rm -rf work @echo "Removing generated ISO image..." @rm -f minimal_linux_live.iso + @echo "Removing predefined configuration files..." + @rm -f config_predefined/*.config @echo "Removing build log file..." @rm -f minimal_linux_live.log diff --git a/src/generate_hdd.sh b/src/generate_hdd.sh new file mode 100755 index 000000000..eb4f44041 --- /dev/null +++ b/src/generate_hdd.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Create sparse file of 20MB which can be used by QEMU. + +rm -f hdd.img +truncate -s 20M hdd.img + diff --git a/src/qemu32.sh b/src/qemu32.sh index d0bc39d82..67d3e6f2d 100755 --- a/src/qemu32.sh +++ b/src/qemu32.sh @@ -1,9 +1,17 @@ #!/bin/sh -qemu-system-i386 -m 64M -cdrom minimal_linux_live.iso -boot d +# Use this script without arguments to run the generated ISO image with QEMU. +# If you pass '-hdd' or '-h' the virtual hard disk 'hdd.img' will be attached. +# Note that this virtual hard disk has to be created in advance. You can use +# the script 'generate_hdd.sh' to generate the hard disk image file. Once you +# have hard disk image, you can use it as overlay device and persist all your +# changes. See the '.config' file for more information on the overlay support. -# Use this when you want to play with hard disk content. You can manually create -# sparse file (/minimal.img) and put overlay content (/minimal.img/rootfs) in it. -# -# qemu-system-i386 -m 64M -hda hdd.img -cdrom minimal_linux_live.iso -boot d +if [ "$1" = "-hdd" -o "$1" = "-h" ] ; then + echo "Starting QEMU with attached ISO image and hard disk." + qemu-system-i386 -m 64M -hda hdd.img -cdrom minimal_linux_live.iso -boot d +else + echo "Starting QEMU with attached ISO image." + qemu-system-i386 -m 64M -cdrom minimal_linux_live.iso -boot d +fi diff --git a/src/qemu64.sh b/src/qemu64.sh index cf9a0b94e..e5134b53f 100755 --- a/src/qemu64.sh +++ b/src/qemu64.sh @@ -1,8 +1,17 @@ #!/bin/sh -qemu-system-x86_64 -m 64M -cdrom minimal_linux_live.iso -boot d +# Use this script without arguments to run the generated ISO image with QEMU. +# If you pass '-hdd' or '-h' the virtual hard disk 'hdd.img' will be attached. +# Note that this virtual hard disk has to be created in advance. You can use +# the script 'generate_hdd.sh' to generate the hard disk image file. Once you +# have hard disk image, you can use it as overlay device and persist all your +# changes. See the '.config' file for more information on the overlay support. + +if [ "$1" = "-hdd" -o "$1" = "-h" ] ; then + echo "Starting QEMU with attached ISO image and hard disk." + qemu-system-x86_64 -m 64M -hda hdd.img -cdrom minimal_linux_live.iso -boot d +else + echo "Starting QEMU with attached ISO image." + qemu-system-x86_64 -m 64M -cdrom minimal_linux_live.iso -boot d +fi -# Use this when you want to play with hard disk content. You can manually create -# sparse file (/minimal.img) and put overlay content (/minimal.img/rootfs) in it. -# -# qemu-system-x86_64 -m 64M -hda hdd.img -cdrom minimal_linux_live.iso -boot d