Updated all scripts to use common functions. Updated the sparse image size to 3MB by default.
This commit is contained in:
parent
b87a4e2a95
commit
691a321ead
12
src/.config
12
src/.config
@ -1,4 +1,4 @@
|
|||||||
# If this is the first time you build "Minimal Linux Live", then I suggest you
|
# If this is the first time you build 'Minimal Linux Live', then I suggest you
|
||||||
# go through the README file first.
|
# go through the README file first.
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#
|
#
|
||||||
KERNEL_SOURCE_URL=http://kernel.org/pub/linux/kernel/v4.x/linux-4.14.4.tar.xz
|
KERNEL_SOURCE_URL=http://kernel.org/pub/linux/kernel/v4.x/linux-4.14.4.tar.xz
|
||||||
|
|
||||||
# You can find the latest GNU libc source bundles here:
|
# You can find the latest GNU C library source bundles here:
|
||||||
#
|
#
|
||||||
# http://gnu.org/software/libc
|
# http://gnu.org/software/libc
|
||||||
#
|
#
|
||||||
@ -66,9 +66,9 @@ USE_PREDEFINED_BUSYBOX_CONFIG=false
|
|||||||
# media is writeable, then all changes on the root filesystem are automatically
|
# media is writeable, then all changes on the root filesystem are automatically
|
||||||
# persisted and preserved on reboot.
|
# persisted and preserved on reboot.
|
||||||
#
|
#
|
||||||
# sparse - use sparse file 'minimal.img' with hardcoded maximal size of 1MB (see
|
# sparse - use sparse file 'minimal.img' with hardcoded maximal size of 3MB (see
|
||||||
# xx_generate_iso.sh). The generated ISO image is larger because the
|
# xx_generate_overlay.sh). The generated ISO image is larger because
|
||||||
# sparse file is treated as regular file. This option requires root
|
# the sparse file is treated as regular file. This option requires root
|
||||||
# permissions or otherwise sparse file generation is silently skipped.
|
# permissions or otherwise sparse file generation is silently skipped.
|
||||||
# Sparse file is treated as separate disk image and works fine on FAT.
|
# Sparse file is treated as separate disk image and works fine on FAT.
|
||||||
#
|
#
|
||||||
@ -97,7 +97,7 @@ OVERLAY_TYPE=folder
|
|||||||
#
|
#
|
||||||
# Note that if you build any overlay software and you are using sparse image file
|
# Note that if you build any overlay software and you are using sparse image file
|
||||||
# for the overlay structure then most probably something will go wrong because
|
# for the overlay structure then most probably something will go wrong because
|
||||||
# the overlay software requires more than 1MB free space. The solution is to use
|
# the overlay software requires more than 3MB free space. The solution is to use
|
||||||
# folder overlay or to edit the script 'xx_generate_overlay.sh' and modify it to
|
# folder overlay or to edit the script 'xx_generate_overlay.sh' and modify it to
|
||||||
# create sparse image file with bigger size.
|
# create sparse image file with bigger size.
|
||||||
#
|
#
|
||||||
|
@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** CLEAN BEGIN ***"
|
echo "*** CLEAN BEGIN ***"
|
||||||
|
|
||||||
echo "Cleaning up the main work area. This may take a while."
|
echo "Cleaning up the main work area. This may take a while."
|
||||||
rm -rf work
|
rm -rf $WORK_DIR
|
||||||
mkdir work
|
mkdir $WORK_DIR
|
||||||
mkdir -p source
|
mkdir -p $SOURCE_DIR
|
||||||
|
|
||||||
echo "*** CLEAN END ***"
|
echo "*** CLEAN END ***"
|
||||||
|
@ -19,7 +19,7 @@ download_source $DOWNLOAD_URL $SOURCE_DIR/$ARCHIVE_FILE
|
|||||||
# Extract the kernel sources in the 'work/kernel' directory.
|
# Extract the kernel sources in the 'work/kernel' directory.
|
||||||
extract_source $SOURCE_DIR/$ARCHIVE_FILE kernel
|
extract_source $SOURCE_DIR/$ARCHIVE_FILE kernel
|
||||||
|
|
||||||
# Just in case we go back to the main MLL source folder.
|
# We go back to the main MLL source folder.
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
|
||||||
echo "*** GET KERNEL END ***"
|
echo "*** GET KERNEL END ***"
|
||||||
|
@ -7,14 +7,13 @@ set -e
|
|||||||
|
|
||||||
echo "*** BUILD KERNEL BEGIN ***"
|
echo "*** BUILD KERNEL BEGIN ***"
|
||||||
|
|
||||||
cd work/kernel
|
|
||||||
|
|
||||||
# Prepare the kernel install area.
|
# Prepare the kernel install area.
|
||||||
rm -rf kernel_installed
|
echo "Removing old kernel artifacts. This may take a while."
|
||||||
mkdir kernel_installed
|
rm -rf $KERNEL_INSTALLED
|
||||||
|
mkdir $KERNEL_INSTALLED
|
||||||
|
|
||||||
# Change to the kernel source directory which ls finds, e.g. 'linux-4.4.6'.
|
# Change to the kernel source directory which ls finds, e.g. 'linux-4.4.6'.
|
||||||
cd $(ls -d linux-*)
|
cd `ls -d $WORK_DIR/kernel/linux-*`
|
||||||
|
|
||||||
# Cleans up the kernel sources, including configuration files.
|
# Cleans up the kernel sources, including configuration files.
|
||||||
echo "Preparing kernel work area."
|
echo "Preparing kernel work area."
|
||||||
@ -98,13 +97,13 @@ make \
|
|||||||
|
|
||||||
# Install the kernel file.
|
# Install the kernel file.
|
||||||
cp arch/x86/boot/bzImage \
|
cp arch/x86/boot/bzImage \
|
||||||
$SRC_DIR/work/kernel/kernel_installed/kernel
|
$KERNEL_INSTALLED/kernel
|
||||||
|
|
||||||
# Install kernel headers which are used later when we build and configure the
|
# Install kernel headers which are used later when we build and configure the
|
||||||
# GNU C library (glibc).
|
# GNU C library (glibc).
|
||||||
echo "Generating kernel headers."
|
echo "Generating kernel headers."
|
||||||
make \
|
make \
|
||||||
INSTALL_HDR_PATH=$SRC_DIR/work/kernel/kernel_installed \
|
INSTALL_HDR_PATH=$KERNEL_INSTALLED \
|
||||||
headers_install -j $NUM_JOBS
|
headers_install -j $NUM_JOBS
|
||||||
|
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
@ -2,43 +2,24 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** GET GLIBC BEGIN ***"
|
echo "*** GET GLIBC BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
# Read the 'GLIBC_SOURCE_URL' property from '.config'.
|
||||||
|
DOWNLOAD_URL=`read_property GLIBC_SOURCE_URL`
|
||||||
# Grab everything after the '=' character.
|
|
||||||
DOWNLOAD_URL=$(grep -i ^GLIBC_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##*/}
|
||||||
|
|
||||||
# Read the 'USE_LOCAL_SOURCE' property from '.config'
|
# Download glibc source archive in the 'source' directory.
|
||||||
USE_LOCAL_SOURCE="$(grep -i ^USE_LOCAL_SOURCE .config | cut -f2 -d'=')"
|
download_source $DOWNLOAD_URL $SOURCE_DIR/$ARCHIVE_FILE
|
||||||
|
|
||||||
if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE ] ; then
|
# Extract the glibc sources in the 'work/glibc' directory.
|
||||||
echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded."
|
extract_source $SOURCE_DIR/$ARCHIVE_FILE glibc
|
||||||
USE_LOCAL_SOURCE="false"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd source
|
|
||||||
|
|
||||||
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. This may take a while."
|
|
||||||
rm -rf ../work/glibc
|
|
||||||
mkdir ../work/glibc
|
|
||||||
|
|
||||||
# Extract glibc to folder 'work/glibc'.
|
|
||||||
# Full path will be something like 'work/glibc/glibc-2.23'.
|
|
||||||
tar -xvf $ARCHIVE_FILE -C ../work/glibc
|
|
||||||
|
|
||||||
|
# We go back to the main MLL source folder.
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
|
||||||
echo "*** GET GLIBC END ***"
|
echo "*** GET GLIBC END ***"
|
||||||
|
@ -2,47 +2,29 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** BUILD GLIBC BEGIN ***"
|
echo "*** BUILD GLIBC BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
|
||||||
|
|
||||||
# Read the 'JOB_FACTOR' property from '.config'
|
|
||||||
JOB_FACTOR="$(grep -i ^JOB_FACTOR .config | cut -f2 -d'=')"
|
|
||||||
|
|
||||||
# Read the 'CFLAGS' property from '.config'
|
|
||||||
CFLAGS="$(grep -i ^CFLAGS .config | cut -f2 -d'=')"
|
|
||||||
|
|
||||||
# Find the number of available CPU cores.
|
|
||||||
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
|
|
||||||
|
|
||||||
# Calculate the number of 'make' jobs to be used later.
|
|
||||||
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
|
|
||||||
|
|
||||||
# Save the kernel installation directory.
|
|
||||||
KERNEL_INSTALLED=$SRC_DIR/work/kernel/kernel_installed
|
|
||||||
|
|
||||||
cd work/glibc
|
|
||||||
|
|
||||||
# Find the glibc source directory, e.g. 'glibc-2.23' and remember it.
|
|
||||||
cd $(ls -d glibc-*)
|
|
||||||
GLIBC_SRC=$(pwd)
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# Prepare the work area, e.g. 'work/glibc/glibc_objects'.
|
# Prepare the work area, e.g. 'work/glibc/glibc_objects'.
|
||||||
echo "Preparing glibc object area. This may take a while."
|
echo "Preparing glibc object area. This may take a while."
|
||||||
rm -rf glibc_objects
|
rm -rf $GLIBC_OBJECTS
|
||||||
mkdir glibc_objects
|
mkdir $GLIBC_OBJECTS
|
||||||
|
|
||||||
# Prepare the install area, e.g. 'work/glibc/glibc_installed'.
|
# Prepare the install area, e.g. 'work/glibc/glibc_installed'.
|
||||||
echo "Preparing glibc install area. This may take a while."
|
echo "Preparing glibc install area. This may take a while."
|
||||||
rm -rf glibc_installed
|
rm -rf $GLIBC_INSTALLED
|
||||||
mkdir glibc_installed
|
mkdir $GLIBC_INSTALLED
|
||||||
GLIBC_INSTALLED=$(pwd)/glibc_installed
|
|
||||||
|
# Find the glibc source directory, e.g. 'glibc-2.23' and remember it.
|
||||||
|
cd $WORK_DIR/glibc
|
||||||
|
GLIBC_SRC=$PWD/`ls -d glibc-*`
|
||||||
|
|
||||||
# All glibc work is done from the working area.
|
# All glibc work is done from the working area.
|
||||||
cd glibc_objects
|
cd $GLIBC_OBJECTS
|
||||||
|
|
||||||
# glibc is configured to use the root folder (--prefix=) and as result all
|
# 'glibc' is configured to use the root folder (--prefix=) and as result all
|
||||||
# libraries will be installed in '/lib'. Note that on 64-bit machines BusyBox
|
# 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
|
# 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
|
# to be in '/lib64'. Kernel headers are taken from our already prepared kernel
|
||||||
|
@ -2,22 +2,32 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** PREPARE SYSROOT BEGIN ***"
|
echo "*** PREPARE SYSROOT BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
|
||||||
|
|
||||||
cd work
|
|
||||||
|
|
||||||
echo "Cleaning existing sysroot. This may take a while."
|
echo "Cleaning existing sysroot. This may take a while."
|
||||||
rm -rf sysroot
|
rm -rf $SYSROOT
|
||||||
|
mkdir -p $SYSROOT
|
||||||
|
|
||||||
echo "Preparing glibc. This may take a while."
|
echo "Preparing glibc. This may take a while."
|
||||||
mkdir -p sysroot/usr
|
|
||||||
ln -s ../include sysroot/usr/include
|
|
||||||
ln -s ../lib sysroot/usr/lib
|
|
||||||
|
|
||||||
cp -r kernel/kernel_installed/include sysroot
|
# 1) Copy everything from glibc to the new sysroot area.
|
||||||
cp -r glibc/glibc_installed/* sysroot
|
cp -r $GLIBC_INSTALLED/* $SYSROOT
|
||||||
|
|
||||||
|
# 2) Copy all kernel headers to the sysroot folder.
|
||||||
|
cp -r $KERNEL_INSTALLED/include $SYSROOT
|
||||||
|
|
||||||
|
# 3) Hack for the missing '/work/sysroot/usr' folder. We link
|
||||||
|
# the existing libraries and the kernel headers. Without
|
||||||
|
# this hack the BusyBox compilation process fails. The proper
|
||||||
|
# way to handle this is to use '--prefix=/usr' in the glibc
|
||||||
|
# build process but then we have to deal with other issues.
|
||||||
|
# For now this hack is the easiest and the simplest solution.
|
||||||
|
mkdir -p $SYSROOT/usr
|
||||||
|
ln -s ../include $SYSROOT/usr/include
|
||||||
|
ln -s ../lib $SYSROOT/usr/lib
|
||||||
|
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
|
||||||
|
@ -2,43 +2,24 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** GET BUSYBOX BEGIN ***"
|
echo "*** GET BUSYBOX BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
# Read the 'BUSYBOX_SOURCE_URL' property from '.config'.
|
||||||
|
DOWNLOAD_URL=`read_property BUSYBOX_SOURCE_URL`
|
||||||
# Grab everything after the '=' character.
|
|
||||||
DOWNLOAD_URL=$(grep -i ^BUSYBOX_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##*/}
|
||||||
|
|
||||||
# Read the 'USE_LOCAL_SOURCE' property from '.config'
|
# Download BusyBox source archive in the 'source' directory.
|
||||||
USE_LOCAL_SOURCE="$(grep -i ^USE_LOCAL_SOURCE .config | cut -f2 -d'=')"
|
download_source $DOWNLOAD_URL $SOURCE_DIR/$ARCHIVE_FILE
|
||||||
|
|
||||||
if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE ] ; then
|
# Extract the BusyBox sources in the 'work/busybox' directory.
|
||||||
echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded."
|
extract_source $SOURCE_DIR/$ARCHIVE_FILE busybox
|
||||||
USE_LOCAL_SOURCE="false"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd source
|
|
||||||
|
|
||||||
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. This may take a while."
|
|
||||||
rm -rf ../work/busybox
|
|
||||||
mkdir ../work/busybox
|
|
||||||
|
|
||||||
# Extract busybox to folder 'busybox'.
|
|
||||||
# Full path will be something like 'work/busybox/busybox-1.24.2'.
|
|
||||||
tar -xvf $ARCHIVE_FILE -C ../work/busybox
|
|
||||||
|
|
||||||
|
# We go back to the main MLL source folder.
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
|
||||||
echo "*** GET BUSYBOX END ***"
|
echo "*** GET BUSYBOX END ***"
|
||||||
|
@ -2,29 +2,17 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** BUILD BUSYBOX BEGIN ***"
|
echo "*** BUILD BUSYBOX BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
# Remove the old BusyBox install area.
|
||||||
|
echo "Removing old BusyBox artifacts. This may take a while."
|
||||||
# Read the 'JOB_FACTOR' property from '.config'
|
rm -rf $BUSYBOX_INSTALLED
|
||||||
JOB_FACTOR="$(grep -i ^JOB_FACTOR .config | cut -f2 -d'=')"
|
|
||||||
|
|
||||||
# Find the number of available CPU cores.
|
|
||||||
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
|
|
||||||
|
|
||||||
# Calculate the number of 'make' jobs to be used later.
|
|
||||||
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
|
|
||||||
|
|
||||||
# Remember the sysroot
|
|
||||||
SYSROOT=$(pwd)/work/sysroot
|
|
||||||
|
|
||||||
cd work/busybox
|
|
||||||
|
|
||||||
# Remove the old BusyBox install area
|
|
||||||
rm -rf busybox_installed
|
|
||||||
|
|
||||||
# Change to the source directory ls finds, e.g. 'busybox-1.24.2'.
|
# Change to the source directory ls finds, e.g. 'busybox-1.24.2'.
|
||||||
cd $(ls -d busybox-*)
|
cd `ls -d $WORK_DIR/busybox/busybox-*`
|
||||||
|
|
||||||
# Remove previously generated artifacts.
|
# Remove previously generated artifacts.
|
||||||
echo "Preparing BusyBox work area. This may take a while."
|
echo "Preparing BusyBox work area. This may take a while."
|
||||||
@ -67,7 +55,7 @@ make \
|
|||||||
# Create the symlinks for busybox. The file 'busybox.links' is used for this.
|
# Create the symlinks for busybox. The file 'busybox.links' is used for this.
|
||||||
echo "Generating BusyBox based initramfs area."
|
echo "Generating BusyBox based initramfs area."
|
||||||
make \
|
make \
|
||||||
CONFIG_PREFIX="../busybox_installed" \
|
CONFIG_PREFIX="$BUSYBOX_INSTALLED" \
|
||||||
install -j $NUM_JOBS
|
install -j $NUM_JOBS
|
||||||
|
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** PREPARE OVERLAY BEGIN ***"
|
echo "*** PREPARE OVERLAY BEGIN ***"
|
||||||
|
|
||||||
@ -10,11 +11,11 @@ echo "Preparing overlay work area."
|
|||||||
rm -rf $SRC_DIR/work/overlay*
|
rm -rf $SRC_DIR/work/overlay*
|
||||||
|
|
||||||
# Read the 'OVERLAY_BUNDLES' property from '.config'
|
# Read the 'OVERLAY_BUNDLES' property from '.config'
|
||||||
OVERLAY_BUNDLES="$(grep -i ^OVERLAY_BUNDLES .config | cut -f2 -d'=')"
|
OVERLAY_BUNDLES=`read_property OVERLAY_BUNDLES`
|
||||||
|
|
||||||
if [ ! "$OVERLAY_BUNDLES" = "" ] ; then
|
if [ ! "$OVERLAY_BUNDLES" = "" ] ; then
|
||||||
echo "Generating additional overlay bundles. This may take a while."
|
echo "Generating additional overlay bundles. This may take a while."
|
||||||
cd minimal_overlay
|
cd $SRC_DIR/minimal_overlay
|
||||||
./overlay_build.sh
|
./overlay_build.sh
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
else
|
else
|
||||||
|
@ -2,74 +2,69 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** GENERATE ROOTFS BEGIN ***"
|
echo "*** GENERATE ROOTFS BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
echo "Preparing rootfs work area. This may take a while."
|
||||||
|
rm -rf $ROOTFS
|
||||||
# Remember the sysroot
|
|
||||||
SYSROOT=$(pwd)/work/sysroot
|
|
||||||
|
|
||||||
# Remember the BysyBox install folder.
|
|
||||||
BUSYBOX_INSTALLED=$(pwd)/work/busybox/busybox_installed
|
|
||||||
|
|
||||||
cd work
|
|
||||||
|
|
||||||
echo "Preparing rootfs work area."
|
|
||||||
rm -rf rootfs
|
|
||||||
|
|
||||||
# Copy all BusyBox generated stuff to the location of our 'rootfs' folder.
|
# Copy all BusyBox generated stuff to the location of our 'rootfs' folder.
|
||||||
cp -r $BUSYBOX_INSTALLED rootfs
|
cp -r $BUSYBOX_INSTALLED $ROOTFS
|
||||||
|
|
||||||
# Copy all rootfs resources to the location of our 'rootfs' folder.
|
# Copy all rootfs resources to the location of our 'rootfs' folder.
|
||||||
cp -r ../minimal_rootfs/* rootfs
|
cp -r $SRC_DIR/minimal_rootfs/* $ROOTFS
|
||||||
|
|
||||||
cd rootfs
|
|
||||||
|
|
||||||
# Delete the '.keep' files which we use in order to keep track of otherwise
|
# Delete the '.keep' files which we use in order to keep track of otherwise
|
||||||
# empty folders.
|
# empty folders.
|
||||||
find * -type f -name '.keep' -exec rm {} +
|
find $ROOTFS/* -type f -name '.keep' -exec rm {} +
|
||||||
|
|
||||||
# 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
|
rm -f $ROOTFS/linuxrc
|
||||||
|
|
||||||
# This is for the dynamic loader. Note that the name and the location are both
|
# This is for the dynamic loader. Note that the name and the location are both
|
||||||
# specific for 32-bit and 64-bit machines. First we check the BusyBox executable
|
# specific for 32-bit and 64-bit machines. First we check the BusyBox executable
|
||||||
# and then we copy the dynamic loader to its appropriate location.
|
# and then we copy the dynamic loader to its appropriate location.
|
||||||
BUSYBOX_ARCH=$(file bin/busybox | cut -d' ' -f3)
|
BUSYBOX_ARCH=$(file $ROOTFS/bin/busybox | cut -d' ' -f3)
|
||||||
if [ "$BUSYBOX_ARCH" = "64-bit" ] ; then
|
if [ "$BUSYBOX_ARCH" = "64-bit" ] ; then
|
||||||
mkdir lib64
|
mkdir -p $ROOTFS/lib64
|
||||||
cp $SYSROOT/lib/ld-linux* lib64
|
cp $SYSROOT/lib/ld-linux* $ROOTFS/lib64
|
||||||
echo "Dynamic loader is accessed via '/lib64'."
|
echo "Dynamic loader is accessed via '/lib64'."
|
||||||
else
|
else
|
||||||
cp $SYSROOT/lib/ld-linux* lib
|
cp $SYSROOT/lib/ld-linux* $ROOTFS/lib
|
||||||
echo "Dynamic loader is accessed via '/lib'."
|
echo "Dynamic loader is accessed via '/lib'."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy all necessary 'glibc' libraries to '/lib' BEGIN.
|
# Copy all necessary 'glibc' libraries to '/lib' BEGIN.
|
||||||
|
|
||||||
# BusyBox has direct dependencies on these libraries.
|
# BusyBox has direct dependencies on these libraries.
|
||||||
cp $SYSROOT/lib/libm.so.6 lib
|
cp $SYSROOT/lib/libm.so.6 $ROOTFS/lib
|
||||||
cp $SYSROOT/lib/libc.so.6 lib
|
cp $SYSROOT/lib/libc.so.6 $ROOTFS/lib
|
||||||
|
|
||||||
# Copy all necessary 'glibc' libraries to '/lib' END.
|
# Copy all necessary 'glibc' libraries to '/lib' END.
|
||||||
|
|
||||||
echo "Reducing the size of libraries and executables."
|
echo "Reducing the size of libraries and executables."
|
||||||
set +e
|
set +e
|
||||||
strip -g \
|
strip -g \
|
||||||
$SRC_DIR/work/rootfs/bin/* \
|
$ROOTFS/bin/* \
|
||||||
$SRC_DIR/work/rootfs/sbin/* \
|
$ROOTFS/sbin/* \
|
||||||
$SRC_DIR/work/rootfs/lib/* \
|
$ROOTFS/lib/* \
|
||||||
2>/dev/null
|
2>/dev/null
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Read the 'OVERLAY_LOCATION' property from '.config'
|
# Read the 'OVERLAY_LOCATION' property from '.config'
|
||||||
OVERLAY_LOCATION="$(grep -i ^OVERLAY_LOCATION $SRC_DIR/.config | cut -f2 -d'=')"
|
OVERLAY_LOCATION=`read_property OVERLAY_LOCATION`
|
||||||
|
|
||||||
if [ "$OVERLAY_LOCATION" = "rootfs" -a -d $SRC_DIR/work/overlay_rootfs ] ; then
|
if [ "$OVERLAY_LOCATION" = "rootfs" -a -d $OVERLAY_ROOTFS ] ; then
|
||||||
echo "Merging overlay software in rootfs."
|
echo "Merging overlay software in rootfs."
|
||||||
|
|
||||||
cp -r $SRC_DIR/work/overlay_rootfs/* .
|
# With '--remove-destination' all possibly existing soft links in
|
||||||
cp -r $SRC_DIR/minimal_overlay/rootfs/* .
|
# $OVERLAY_ROOTFS will be overwritten correctly.
|
||||||
|
cp -r --remove-destination \
|
||||||
|
$OVERLAY_ROOTFS/* $ROOTFS
|
||||||
|
cp -r --remove-destination \
|
||||||
|
$SRC_DIR/minimal_overlay/rootfs/* $ROOTFS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "The rootfs area has been generated."
|
echo "The rootfs area has been generated."
|
||||||
|
@ -2,21 +2,20 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** PACK ROOTFS BEGIN ***"
|
echo "*** PACK ROOTFS BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
|
||||||
|
|
||||||
cd work
|
|
||||||
|
|
||||||
echo "Packing initramfs. This may take a while."
|
echo "Packing initramfs. This may take a while."
|
||||||
|
|
||||||
# Remove the old 'initramfs' archive if it exists.
|
# Remove the old 'initramfs' archive if it exists.
|
||||||
rm -f rootfs.cpio.xz
|
rm -f $WORK_DIR/rootfs.cpio.xz
|
||||||
|
|
||||||
cd rootfs
|
cd $ROOTFS
|
||||||
|
|
||||||
# Packs the current 'initramfs' folder structure in 'cpio.xz' archive.
|
# Packs the current 'initramfs' folder structure in 'cpio.xz' archive.
|
||||||
find . | cpio -R root:root -H newc -o | xz -9 --check=none > ../rootfs.cpio.xz
|
find . | cpio -R root:root -H newc -o | xz -9 --check=none > $WORK_DIR/rootfs.cpio.xz
|
||||||
|
|
||||||
echo "Packing of initramfs has finished."
|
echo "Packing of initramfs has finished."
|
||||||
|
|
||||||
|
@ -2,25 +2,26 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "*** GENERATE OVERLAY BEGIN ***"
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
echo "*** GENERATE OVERLAY BEGIN ***"
|
||||||
|
|
||||||
# Remove the old ISO generation area if it exists.
|
# Remove the old ISO generation area if it exists.
|
||||||
echo "Removing old overlay area. This may take a while."
|
echo "Removing old overlay area. This may take a while."
|
||||||
rm -rf work/isoimage_overlay
|
rm -rf $ISOIMAGE_OVERLAY
|
||||||
mkdir -p work/isoimage_overlay
|
mkdir -p $ISOIMAGE_OVERLAY
|
||||||
cd work/isoimage_overlay
|
cd $ISOIMAGE_OVERLAY
|
||||||
|
|
||||||
# Read the 'OVERLAY_TYPE' property from '.config'
|
# Read the 'OVERLAY_TYPE' property from '.config'
|
||||||
OVERLAY_TYPE="$(grep -i ^OVERLAY_TYPE $SRC_DIR/.config | cut -f2 -d'=')"
|
OVERLAY_TYPE=`read_property OVERLAY_TYPE`
|
||||||
|
|
||||||
# Read the 'OVERLAY_LOCATION' property from '.config'
|
# Read the 'OVERLAY_LOCATION' property from '.config'
|
||||||
OVERLAY_LOCATION="$(grep -i ^OVERLAY_LOCATION $SRC_DIR/.config | cut -f2 -d'=')"
|
OVERLAY_LOCATION=`read_property OVERLAY_LOCATION`
|
||||||
|
|
||||||
if [ "$OVERLAY_LOCATION" = "iso" \
|
if [ "$OVERLAY_LOCATION" = "iso" \
|
||||||
-a "$OVERLAY_TYPE" = "sparse" \
|
-a "$OVERLAY_TYPE" = "sparse" \
|
||||||
-a -d $SRC_DIR/work/overlay_rootfs \
|
-a -d $OVERLAY_ROOTFS \
|
||||||
-a "$(id -u)" = "0" ] ; then
|
-a "$(id -u)" = "0" ] ; then
|
||||||
|
|
||||||
# Use sparse file as storage place. The above check guarantees that the whole
|
# Use sparse file as storage place. The above check guarantees that the whole
|
||||||
@ -31,45 +32,44 @@ if [ "$OVERLAY_LOCATION" = "iso" \
|
|||||||
echo "Using sparse file for overlay."
|
echo "Using sparse file for overlay."
|
||||||
|
|
||||||
# This is the BusyBox executable that we have already generated.
|
# 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
|
# Create sparse image file with 3MB size. Note that this increases the ISO
|
||||||
# image size.
|
# image size.
|
||||||
$BUSYBOX truncate -s 1M minimal.img
|
$BUSYBOX truncate -s 3M $ISOIMAGE_OVERLAY/minimal.img
|
||||||
|
|
||||||
# Find available loop device.
|
# Find available loop device.
|
||||||
LOOP_DEVICE=$($BUSYBOX losetup -f)
|
LOOP_DEVICE=$($BUSYBOX losetup -f)
|
||||||
|
|
||||||
# Associate the available loop device with the sparse image file.
|
# Associate the available loop device with the sparse image file.
|
||||||
$BUSYBOX losetup $LOOP_DEVICE minimal.img
|
$BUSYBOX losetup $LOOP_DEVICE $ISOIMAGE_OVERLAY/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
|
$BUSYBOX mkfs.ext2 $LOOP_DEVICE
|
||||||
|
|
||||||
# Mount the sparse file in folder 'sparse".
|
# Mount the sparse file in folder 'sparse".
|
||||||
mkdir sparse
|
mkdir $ISOIMAGE_OVERLAY/sparse
|
||||||
$BUSYBOX mount minimal.img sparse
|
$BUSYBOX mount $ISOIMAGE_OVERLAY/minimal.img sparse
|
||||||
|
|
||||||
# Create the overlay folders.
|
# Create the overlay folders.
|
||||||
mkdir -p sparse/rootfs
|
mkdir -p $ISOIMAGE_OVERLAY/sparse/rootfs
|
||||||
mkdir -p sparse/work
|
mkdir -p $ISOIMAGE_OVERLAY/sparse/work
|
||||||
|
|
||||||
# Copy the overlay content.
|
# Copy the overlay content.
|
||||||
cp -r $SRC_DIR/overlay_rootfs/* sparse/rootfs
|
cp -r $OVERLAY_ROOTFS/* \
|
||||||
cp -r $SRC_DIR/minimal_overlay/rootfs/* sparse/rootfs
|
$ISOIMAGE_OVERLAY/sparse/rootfs
|
||||||
|
cp -r $SRC_DIR/minimal_overlay/rootfs/* \
|
||||||
|
$ISOIMAGE_OVERLAY/sparse/rootfs
|
||||||
|
|
||||||
# Unmount the sparse file and delete the temporary folder.
|
# Unmount the sparse file and delete the temporary folder.
|
||||||
$BUSYBOX umount sparse
|
$BUSYBOX umount $ISOIMAGE_OVERLAY/sparse
|
||||||
rm -rf sparse
|
rm -rf $ISOIMAGE_OVERLAY/sparse
|
||||||
|
|
||||||
# Detach the loop device since we no longer need it.
|
# Detach the loop device since we no longer need it.
|
||||||
$BUSYBOX losetup -d $LOOP_DEVICE
|
$BUSYBOX losetup -d $LOOP_DEVICE
|
||||||
|
|
||||||
echo "Applying original ownership to all affected files and folders."
|
|
||||||
chown -R $(logname) .
|
|
||||||
elif [ "$OVERLAY_LOCATION" = "iso" \
|
elif [ "$OVERLAY_LOCATION" = "iso" \
|
||||||
-a "$OVERLAY_TYPE" = "folder" \
|
-a "$OVERLAY_TYPE" = "folder" \
|
||||||
-a -d $SRC_DIR/work/overlay_rootfs ] ; then
|
-a -d $OVERLAY_ROOTFS ] ; then
|
||||||
|
|
||||||
# Use normal folder structure for overlay. All files and folders located in
|
# 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.
|
# the folder 'minimal_overlay' will be merged with the root folder on boot.
|
||||||
@ -77,12 +77,14 @@ elif [ "$OVERLAY_LOCATION" = "iso" \
|
|||||||
echo "Using folder structure for overlay."
|
echo "Using folder structure for overlay."
|
||||||
|
|
||||||
# Create the overlay folders.
|
# Create the overlay folders.
|
||||||
mkdir -p minimal/rootfs
|
mkdir -p $ISOIMAGE_OVERLAY/minimal/rootfs
|
||||||
mkdir -p minimal/work
|
mkdir -p $ISOIMAGE_OVERLAY/minimal/work
|
||||||
|
|
||||||
# Copy the overlay content.
|
# Copy the overlay content.
|
||||||
cp -rf $SRC_DIR/work/overlay_rootfs/* minimal/rootfs
|
cp -rf $OVERLAY_ROOTFS/* \
|
||||||
cp -r $SRC_DIR/minimal_overlay/rootfs/* minimal/rootfs
|
$ISOIMAGE_OVERLAY/minimal/rootfs
|
||||||
|
cp -r $SRC_DIR/minimal_overlay/rootfs/* \
|
||||||
|
$ISOIMAGE_OVERLAY/minimal/rootfs
|
||||||
else
|
else
|
||||||
echo "The ISO image will have no overlay structure."
|
echo "The ISO image will have no overlay structure."
|
||||||
fi
|
fi
|
||||||
|
@ -2,44 +2,24 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** GET SYSLINUX BEGIN ***"
|
echo "*** GET SYSLINUX BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
# Read the 'SYSLINUX_SOURCE_URL' property from '.config'.
|
||||||
|
DOWNLOAD_URL=`read_property SYSLINUX_SOURCE_URL`
|
||||||
# Grab everything after the '=' character.
|
|
||||||
DOWNLOAD_URL=$(grep -i ^SYSLINUX_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##*/}
|
||||||
|
|
||||||
# Read the 'USE_LOCAL_SOURCE' property from '.config'
|
# Download Syslinux source archive in the 'source' directory.
|
||||||
USE_LOCAL_SOURCE="$(grep -i ^USE_LOCAL_SOURCE .config | cut -f2 -d'=')"
|
download_source $DOWNLOAD_URL $SOURCE_DIR/$ARCHIVE_FILE
|
||||||
|
|
||||||
if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE ] ; then
|
# Extract the Syslinux sources in the 'work/syslinux' directory.
|
||||||
echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded."
|
extract_source $SOURCE_DIR/$ARCHIVE_FILE syslinux
|
||||||
USE_LOCAL_SOURCE="false"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd source
|
|
||||||
|
|
||||||
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. This may take a while."
|
|
||||||
rm -rf ../work/syslinux
|
|
||||||
mkdir ../work/syslinux
|
|
||||||
|
|
||||||
# Extract Syslinux to folder 'work/syslinux'.
|
|
||||||
# Full path will be something like 'work/syslinux/syslinux-6.03'.
|
|
||||||
tar -xvf $ARCHIVE_FILE -C ../work/syslinux
|
|
||||||
|
|
||||||
|
# We go back to the main MLL source folder.
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
|
||||||
echo "*** GET SYSLINUX END ***"
|
echo "*** GET SYSLINUX END ***"
|
||||||
|
|
||||||
|
@ -2,58 +2,61 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** PREPARE ISO BEGIN ***"
|
echo "*** PREPARE ISO BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
|
||||||
|
|
||||||
# Save the kernel installation directory.
|
|
||||||
KERNEL_INSTALLED=$SRC_DIR/work/kernel/kernel_installed
|
|
||||||
|
|
||||||
# Find the Syslinux build directory.
|
# Find the Syslinux build directory.
|
||||||
cd work/syslinux
|
cd work/syslinux
|
||||||
cd $(ls -d *)
|
cd $(ls -d *)
|
||||||
WORK_SYSLINUX_DIR=$(pwd)
|
WORK_SYSLINUX_DIR=$(pwd)
|
||||||
cd $SRC_DIR
|
|
||||||
|
|
||||||
# Remove the old ISO generation area if it exists.
|
# Remove the old ISO generation area if it exists.
|
||||||
echo "Removing old ISO image work area. This may take a while."
|
echo "Removing old ISO image work area. This may take a while."
|
||||||
rm -rf work/isoimage
|
rm -rf $ISOIMAGE
|
||||||
|
|
||||||
# This is the root folder of the ISO image.
|
# This is the root folder of the ISO image.
|
||||||
echo "Preparing new ISO image work area."
|
echo "Preparing new ISO image work area."
|
||||||
mkdir work/isoimage
|
mkdir -p $ISOIMAGE
|
||||||
|
|
||||||
cd work/isoimage
|
|
||||||
|
|
||||||
# Now we copy the kernel.
|
# Now we copy the kernel.
|
||||||
cp $KERNEL_INSTALLED/kernel ./kernel.xz
|
cp $KERNEL_INSTALLED/kernel $ISOIMAGE/kernel.xz
|
||||||
|
|
||||||
# Now we copy the root file system.
|
# Now we copy the root file system.
|
||||||
cp ../rootfs.cpio.xz ./rootfs.xz
|
cp $WORK_DIR/rootfs.cpio.xz $ISOIMAGE/rootfs.xz
|
||||||
|
|
||||||
# Now we copy the overlay content if it exists
|
# Now we copy the overlay content if it exists
|
||||||
if [ -d $SRC_DIR/work/isoimage_overlay \
|
if [ -d $ISOIMAGE_OVERLAY \
|
||||||
-a ! "`ls $SRC_DIR/work/isoimage_overlay`" = "" ] ; then
|
-a ! "`ls $ISOIMAGE`" = "" ] ; then
|
||||||
|
|
||||||
echo "The ISO image will have overlay structure."
|
echo "The ISO image will have overlay structure."
|
||||||
cp -r $SRC_DIR/work/isoimage_overlay/* .
|
cp -r $ISOIMAGE_OVERLAY/* $ISOIMAGE
|
||||||
else
|
else
|
||||||
echo "The ISO image will have no overlay structure."
|
echo "The ISO image will have no overlay structure."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32' in the ISO image
|
# Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32' in the ISO image
|
||||||
# root folder.
|
# root folder.
|
||||||
cp $WORK_SYSLINUX_DIR/bios/core/isolinux.bin .
|
cp $WORK_SYSLINUX_DIR/bios/core/isolinux.bin $ISOIMAGE
|
||||||
cp $WORK_SYSLINUX_DIR/bios/com32/elflink/ldlinux/ldlinux.c32 .
|
cp $WORK_SYSLINUX_DIR/bios/com32/elflink/ldlinux/ldlinux.c32 $ISOIMAGE
|
||||||
|
|
||||||
# Create the ISOLINUX configuration file.
|
# Create the ISOLINUX configuration file.
|
||||||
cat << CEOF > ./syslinux.cfg
|
cat << CEOF > $ISOIMAGE/syslinux.cfg
|
||||||
PROMPT 1
|
PROMPT 1
|
||||||
TIMEOUT 50
|
TIMEOUT 50
|
||||||
DEFAULT mll
|
DEFAULT mll
|
||||||
|
|
||||||
SAY Press enter to boot Minimal Linux Live or wait 5 seconds.
|
SAY
|
||||||
SAY Press tab to view available boot entries or enter Syslinux commands directly.
|
SAY ##################################################################
|
||||||
|
SAY # #
|
||||||
|
SAY # Press <ENTER> to boot Minimal Linux Live or wait 5 seconds. #
|
||||||
|
SAY # #
|
||||||
|
SAY # Press <TAB> to view available boot entries or enter Syslinux #
|
||||||
|
SAY # commands directly. #
|
||||||
|
SAY # #
|
||||||
|
SAY ##################################################################
|
||||||
|
SAY
|
||||||
|
|
||||||
LABEL mll
|
LABEL mll
|
||||||
LINUX kernel.xz
|
LINUX kernel.xz
|
||||||
@ -66,11 +69,20 @@ LABEL mll_nomodeset
|
|||||||
INITRD rootfs.xz
|
INITRD rootfs.xz
|
||||||
CEOF
|
CEOF
|
||||||
|
|
||||||
# Create UEFI start script.
|
# Create UEFI start script '/efi/boot/startup.nsh'. This script is executed
|
||||||
mkdir -p efi/boot
|
# by the firmware on boot. Currently MLL doesn't provide native UEFI stub
|
||||||
cat << CEOF > ./efi/boot/startup.nsh
|
# for boot manager and this script is the only UEFI compliant way to pass
|
||||||
|
# the execution from the firmware to the kernel.
|
||||||
|
mkdir -p $ISOIMAGE/efi/boot
|
||||||
|
cat << CEOF > $ISOIMAGE/efi/boot/startup.nsh
|
||||||
echo -off
|
echo -off
|
||||||
echo Minimal Linux Live is starting.
|
echo.
|
||||||
|
echo ###################################
|
||||||
|
echo # #
|
||||||
|
echo # Welcome to Minimal Linux Live #
|
||||||
|
echo # #
|
||||||
|
echo ###################################
|
||||||
|
echo.
|
||||||
\\kernel.xz initrd=\\rootfs.xz
|
\\kernel.xz initrd=\\rootfs.xz
|
||||||
CEOF
|
CEOF
|
||||||
|
|
||||||
|
@ -2,33 +2,31 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** GENERATE ISO BEGIN ***"
|
echo "*** GENERATE ISO BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
if [ ! -d $ISOIMAGE ] ; then
|
||||||
|
|
||||||
if [ ! -d $SRC_DIR/work/isoimage ] ; then
|
|
||||||
echo "Cannot locate ISO image work folder. Cannot continue."
|
echo "Cannot locate ISO image work folder. Cannot continue."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $SRC_DIR/work/isoimage
|
cd $ISOIMAGE
|
||||||
|
|
||||||
# Now we generate the ISO image file.
|
# Now we generate the ISO image file.
|
||||||
xorriso \
|
xorriso \
|
||||||
-as mkisofs \
|
-as mkisofs \
|
||||||
-R \
|
-R \
|
||||||
-r \
|
-r \
|
||||||
-o ../minimal_linux_live.iso \
|
-o $SRC_DIR/minimal_linux_live.iso \
|
||||||
-b isolinux.bin \
|
-b isolinux.bin \
|
||||||
-c boot.cat \
|
-c boot.cat \
|
||||||
-input-charset UTF-8 \
|
-input-charset UTF-8 \
|
||||||
-no-emul-boot \
|
-no-emul-boot \
|
||||||
-boot-load-size 4 \
|
-boot-load-size 4 \
|
||||||
-boot-info-table \
|
-boot-info-table \
|
||||||
./
|
$ISOIMAGE
|
||||||
|
|
||||||
# Copy the ISO image to the root project folder.
|
|
||||||
cp ../minimal_linux_live.iso ../../
|
|
||||||
|
|
||||||
cd $SRC_DIR
|
cd $SRC_DIR
|
||||||
|
|
||||||
|
@ -2,39 +2,40 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Load common properties and functions in the current script.
|
||||||
|
. ./common.sh
|
||||||
|
|
||||||
echo "*** GENERATE IMAGE BEGIN ***"
|
echo "*** GENERATE IMAGE BEGIN ***"
|
||||||
|
|
||||||
SRC_DIR=$(pwd)
|
|
||||||
|
|
||||||
# Prepare the work area.
|
# Prepare the work area.
|
||||||
rm -f mll_image.tgz
|
rm -f $SRC_DIR/mll_image.tgz
|
||||||
rm -rf $SRC_DIR/work/mll_image
|
rm -rf $WORK_DIR/mll_image
|
||||||
mkdir -p $SRC_DIR/work/mll_image
|
mkdir -p $WORK_DIR/mll_image
|
||||||
|
|
||||||
if [ -d $SRC_DIR/work/rootfs ] ; then
|
if [ -d $ROOTFS ] ; then
|
||||||
# Copy the rootfs.
|
# Copy the rootfs.
|
||||||
cp -r $SRC_DIR/work/rootfs/* \
|
cp -r $ROOTFS/* \
|
||||||
$SRC_DIR/work/mll_image
|
$WORK_DIR/mll_image
|
||||||
else
|
else
|
||||||
echo "Cannot continue - rootfs is missing."
|
echo "Cannot continue - rootfs is missing."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $SRC_DIR/work/overlay_rootfs ] ; then
|
if [ -d $OVERLAY_ROOTFS ] ; then
|
||||||
echo "Merging overlay software in image."
|
echo "Merging overlay software in image."
|
||||||
|
|
||||||
# Copy the overlay content.
|
# Copy the overlay content.
|
||||||
# With '--remove-destination' all possibly existing soft links in
|
# With '--remove-destination' all possibly existing soft links in
|
||||||
# '$SRC_DIR/work/mll_image' will be overwritten correctly.
|
# $WORK_DIR/mll_image will be overwritten correctly.
|
||||||
cp -r --remove-destination $SRC_DIR/work/overlay_rootfs/* \
|
cp -r --remove-destination $OVERLAY_ROOTFS/* \
|
||||||
$SRC_DIR/work/mll_image
|
$WORK_DIR/mll_image
|
||||||
cp -r --remove-destination $SRC_DIR/minimal_overlay/rootfs/* \
|
cp -r --remove-destination $SRC_DIR/minimal_overlay/rootfs/* \
|
||||||
$SRC_DIR/work/mll_image
|
$WORK_DIR/mll_image
|
||||||
else
|
else
|
||||||
echo "MLL image will have no overlay software."
|
echo "MLL image will have no overlay software."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $SRC_DIR/work/mll_image
|
cd $WORK_DIR/mll_image
|
||||||
|
|
||||||
# Generate the image file (ordinary 'tgz').
|
# Generate the image file (ordinary 'tgz').
|
||||||
tar -zcf $SRC_DIR/mll_image.tgz *
|
tar -zcf $SRC_DIR/mll_image.tgz *
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SRC_DIR=`pwd`
|
|
||||||
|
|
||||||
echo "*** CLEANUP BEGIN ***"
|
echo "*** CLEANUP BEGIN ***"
|
||||||
|
|
||||||
if [ "$(id -u)" = "0" ] ; then
|
if [ "$(id -u)" = "0" ] ; then
|
||||||
|
@ -3,9 +3,18 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
SRC_DIR=`realpath --no-symlinks $PWD`
|
SRC_DIR=`realpath --no-symlinks $PWD`
|
||||||
|
CONFIG=$SRC_DIR/.config
|
||||||
SOURCE_DIR=$SRC_DIR/source
|
SOURCE_DIR=$SRC_DIR/source
|
||||||
WORK_DIR=$SRC_DIR/work
|
WORK_DIR=$SRC_DIR/work
|
||||||
CONFIG=$SRC_DIR/.config
|
KERNEL_INSTALLED=$WORK_DIR/kernel/kernel_installed
|
||||||
|
GLIBC_OBJECTS=$WORK_DIR/glibc/glibc_objects
|
||||||
|
GLIBC_INSTALLED=$WORK_DIR/glibc/glibc_installed
|
||||||
|
BUSYBOX_INSTALLED=$WORK_DIR/busybox/busybox_installed
|
||||||
|
SYSROOT=$WORK_DIR/sysroot
|
||||||
|
ROOTFS=$WORK_DIR/rootfs
|
||||||
|
OVERLAY_ROOTFS=$WORK_DIR/overlay_rootfs
|
||||||
|
ISOIMAGE=$WORK_DIR/isoimage
|
||||||
|
ISOIMAGE_OVERLAY=$WORK_DIR/isoimage_overlay
|
||||||
|
|
||||||
# This function reads property from the main '.config' file.
|
# This function reads property from the main '.config' file.
|
||||||
#
|
#
|
||||||
|
@ -42,7 +42,10 @@ elif [ "$1" = "-f" -o "$1" = "--folder" ] ; then
|
|||||||
losetup -d $LOOP_DEVICE
|
losetup -d $LOOP_DEVICE
|
||||||
echo "Detached hard disk image file from loop device."
|
echo "Detached hard disk image file from loop device."
|
||||||
|
|
||||||
chown $(logname) hdd.img
|
# Find the original user. Note that this may not always be correct.
|
||||||
|
ORIG_USER=`who | awk '{print \$1}'`
|
||||||
|
|
||||||
|
chown $ORIG_USER hdd.img
|
||||||
echo "Applied original ownership to hard disk image file."
|
echo "Applied original ownership to hard disk image file."
|
||||||
elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then
|
elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then
|
||||||
if [ ! "$(id -u)" = "0" ] ; then
|
if [ ! "$(id -u)" = "0" ] ; then
|
||||||
@ -66,8 +69,8 @@ elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then
|
|||||||
echo "Mounted hard disk image file to temporary folder."
|
echo "Mounted hard disk image file to temporary folder."
|
||||||
|
|
||||||
rm -f sparse/minimal.img
|
rm -f sparse/minimal.img
|
||||||
truncate -s 1M sparse/minimal.img
|
truncate -s 3M sparse/minimal.img
|
||||||
echo "Created new overlay image file with 1MB size."
|
echo "Created new overlay image file with 3MB size."
|
||||||
|
|
||||||
LOOP_DEVICE_OVL=$(losetup -f)
|
LOOP_DEVICE_OVL=$(losetup -f)
|
||||||
losetup $LOOP_DEVICE_OVL sparse/minimal.img
|
losetup $LOOP_DEVICE_OVL sparse/minimal.img
|
||||||
@ -121,7 +124,7 @@ elif [ "$1" = "-h" -o "$1" = "--help" ] ; then
|
|||||||
contains compatible overlay folder structure.
|
contains compatible overlay folder structure.
|
||||||
-h, --help Prints this help information.
|
-h, --help Prints this help information.
|
||||||
-s, --sparse Create sparse image file formatted with FAT filesystem which
|
-s, --sparse Create sparse image file formatted with FAT filesystem which
|
||||||
contains sparse image file 'minimal.img' (1MB) formatted with
|
contains sparse image file 'minimal.img' (3MB) formatted with
|
||||||
Ext2 filesystem which contains the actual overlay structure.
|
Ext2 filesystem which contains the actual overlay structure.
|
||||||
CEOF
|
CEOF
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user