New feature - overlay bundles can be merged in the rootfs. The default merge location is the ISO image. Also added few fixes and enhancements to some other scripts.

This commit is contained in:
Ivan Davidov 2017-11-29 14:03:55 +02:00
parent 77f04c6c8a
commit bafad2d9e1
7 changed files with 82 additions and 33 deletions

View File

@ -194,8 +194,8 @@ 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 'minimal_overlay' and it will be
# automatically merged with the root file system on boot. The build process
# it. Put your overlay content in the folder 'minimal_overlay/rootfs' 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
@ -216,12 +216,6 @@ USE_PREDEFINED_BUSYBOX_CONFIG=false
#
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
# This property defines one or more additional overlay software pieces which
# will be generated and placed in the 'work/src/minimal_overlay/rootfs' folder.
# These software pieces will be visible and fully usable after boot. By default
@ -272,8 +266,27 @@ USE_LOCAL_SOURCE=false
# The only default overlay bundle is 'mll_source'. It provides all MLL sources
# in the directory '/usr/src'. Note that these sources will not work there
# since MLL does not provide build tool chain.
#
OVERLAY_BUNDLES=mll_source
# The location where the overlay bundle software will be stored.
#
# rootfs - all overlay bundles will be embedded in the initramfs. In this way
# the software will be available on boot but the initramfs size will
# grow significantly and MLL will require more RAM in order to boot.
#
# iso - all overlay bundles will be packed in the ISO image structure. The
# actual location depends on the value of the configuration property
# 'OVERLAY_TYPE'.
#
OVERLAY_LOCATION=iso
# 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
# This property enables the standard penguin boot logo in the upper left corner
# of the screen. The property is used in 'xx_build_kernel.sh'. The default value
# is 'true' for demonstration purposes.

View File

@ -6,6 +6,9 @@ SRC_DIR=$(pwd)
echo "*** PREPARE OVERLAY BEGIN ***"
echo "Preparing overlay work area."
rm -rf $SRC_DIR/work/overlay*
# Read the 'OVERLAY_BUNDLES' property from '.config'
OVERLAY_BUNDLES="$(grep -i ^OVERLAY_BUNDLES .config | cut -f2 -d'=')"

View File

@ -3,7 +3,7 @@ set -e
echo "*** GENERATE ROOTFS BEGIN ***"
SRC_ROOT=$(pwd)
SRC_DIR=$(pwd)
# Remember the sysroot
SYSROOT=$(pwd)/work/sysroot
@ -13,13 +13,13 @@ BUSYBOX_INSTALLED=$(pwd)/work/busybox/busybox_installed
cd work
echo "Preparing initramfs work area..."
echo "Preparing rootfsfs work area."
rm -rf rootfs
# Copy all BusyBox generated stuff to the location of our 'initramfs' folder.
# Copy all BusyBox generated stuff to the location of our 'rootfs' folder.
cp -r $BUSYBOX_INSTALLED rootfs
# Copy all rootfs resources to the location of our 'initramfs' folder.
# Copy all rootfs resources to the location of our 'rootfs' folder.
cp -r ../minimal_rootfs/* rootfs
cd rootfs
@ -53,14 +53,24 @@ cp $SYSROOT/lib/libc.so.6 lib
# Copy all necessary 'glibc' libraries to '/lib' END.
strip -g \
$SRC_ROOT/work/rootfs/bin/* \
$SRC_ROOT/work/rootfs/sbin/* \
$SRC_ROOT/work/rootfs/lib/* \
$SRC_DIR/work/rootfs/bin/* \
$SRC_DIR/work/rootfs/sbin/* \
$SRC_DIR/work/rootfs/lib/* \
2>/dev/null
echo "Reduced the size of libraries and executables."
echo "The initramfs area has been generated."
# Read the 'OVERLAY_LOCATION' property from '.config'
OVERLAY_LOCATION="$(grep -i ^OVERLAY_LOCATION $SRC_DIR/.config | cut -f2 -d'=')"
cd $SRC_ROOT
if [ "$OVERLAY_LOCATION" = "rootfs" -a -d $SRC_DIR/work/overlay_rootfs ] ; then
echo "Merging overlay software in rootfs."
cp -r $SRC_DIR/work/overlay_rootfs/* .
cp -r $SRC_DIR/minimal_overlay/rootfs/* .
fi
echo "The rootfs area has been generated."
cd $SRC_DIR
echo "*** GENERATE ROOTFS END ***"

View File

@ -50,7 +50,14 @@ cp ../rootfs.cpio.xz ./rootfs.xz
# Read the 'OVERLAY_TYPE' property from '.config'
OVERLAY_TYPE="$(grep -i ^OVERLAY_TYPE $SRC_DIR/.config | cut -f2 -d'=')"
if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then
# Read the 'OVERLAY_LOCATION' property from '.config'
OVERLAY_LOCATION="$(grep -i ^OVERLAY_LOCATION $SRC_DIR/.config | cut -f2 -d'=')"
if [ "$OVERLAY_LOCATION" = "iso" \
-a "$OVERLAY_TYPE" = "sparse" \
-a -d $SRC_DIR/work/overlay_rootfs \
-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 'minimal_overlay' will be merged
@ -83,8 +90,8 @@ if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then
mkdir -p sparse/work
# Copy the overlay content.
cp -r $SRC_DIR/overlay_rootfs/* sparse/rootfs/
cp -r $SRC_DIR/minimal_overlay/rootfs/* sparse/rootfs/
cp -r $SRC_DIR/overlay_rootfs/* sparse/rootfs
cp -r $SRC_DIR/minimal_overlay/rootfs/* sparse/rootfs
# Unmount the sparse file and delete the temporary folder.
$BUSYBOX umount sparse
@ -92,7 +99,10 @@ if [ "$OVERLAY_TYPE" = "sparse" -a "$(id -u)" = "0" ] ; then
# Detach the loop device since we no longer need it.
$BUSYBOX losetup -d $LOOP_DEVICE
elif [ "$OVERLAY_TYPE" = "folder" ] ; then
elif [ "$OVERLAY_LOCATION" = "iso" \
-a "$OVERLAY_TYPE" = "folder" \
-a -d $SRC_DIR/work/overlay_rootfs ] ; 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.
@ -103,10 +113,10 @@ elif [ "$OVERLAY_TYPE" = "folder" ] ; then
mkdir -p minimal/work
# Copy the overlay content.
cp -rf $SRC_DIR/work/overlay_rootfs/* minimal/rootfs/
cp -r $SRC_DIR/minimal_overlay/rootfs/* minimal/rootfs/
cp -rf $SRC_DIR/work/overlay_rootfs/* minimal/rootfs
cp -r $SRC_DIR/minimal_overlay/rootfs/* minimal/rootfs
else
echo "Generating ISO image with no overlay structure..."
echo "The ISO image will have no overlay structure."
fi
# Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32' in the ISO image

View File

@ -11,13 +11,26 @@ rm -f mll_image.tgz
rm -rf $SRC_DIR/work/mll_image
mkdir -p $SRC_DIR/work/mll_image
# Copy the rootfs.
cp -r $SRC_DIR/work/rootfs/* \
$SRC_DIR/work/mll_image
if [ -d $SRC_DIR/work/rootfs ] ; then
# Copy the rootfs.
cp -r $SRC_DIR/work/rootfs/* \
$SRC_DIR/work/mll_image
else
echo "Cannot continue - rootfs is missing."
exit 1
fi
# Copy the overlay area.
cp -r $SRC_DIR/work/src/minimal_overlay/rootfs/* \
$SRC_DIR/work/mll_image
if [ -d $SRC_DIR/work/overlay_rootfs ] ; then
echo "Merging overlay software in image."
# Copy the overlay area.
cp -r $SRC_DIR/work/overlay_rootfs/* \
$SRC_DIR/work/mll_image
cp -r $SRC_DIR/minimal_overlay/rootfs/* \
$SRC_DIR/work/mll_image
else
echo "MLL image will have no overlay software."
fi
cd $SRC_DIR/work/mll_image

View File

@ -14,8 +14,8 @@ cmd="qemu-system-$(uname -m) -m 128M -cdrom minimal_linux_live.iso -boot d -vga
if [ "$1" = "-hdd" -o "$1" = "-h" ] ; then
echo "Starting QEMU with attached ISO image and hard disk."
$cmd -hda hdd.img
$cmd -hda hdd.img &
else
echo "Starting QEMU with attached ISO image."
$cmd
$cmd &
fi

View File

@ -7,7 +7,7 @@ set -e
#
# Note: this will also rebuild all overlay bundles.
./08_prepare_src.sh
./08_prepare_bundles.sh
./09_generate_rootfs.sh
./10_pack_rootfs.sh
./12_generate_iso.sh