Merge pull request #110 from bauen1/misc-changes

Misc changes - added deps for some bundles, autorun enhancements, host resolution, code refactoring.
This commit is contained in:
Ivan Davidov 2017-11-18 22:59:03 +02:00 committed by GitHub
commit 23f34f3941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 164 additions and 143 deletions

View File

@ -238,29 +238,30 @@ COPY_SOURCE_ISO=true
#
# Currently available overlay software:
#
# glibc_full - all core GNU C libraries (useful if other software is included).
# cf_cli - CLoud Foundry CLI (command line interface).
# coreutils - set of commonly used GNU executable utilities.
# dhcp - DHCP and DNS functionality.
# dialog - shell scripting for ncurses
# dropbear - SSH server and client.
# felix - Apache Felix OSGi framework.
# fio - I/O load generator.
# java - installs Oracle's JRE or JDK. Manual preparations are required.
# kbd - keyboard utilities
# libevent - event notification library.
# links - text browser for the web.
# lua - scripting language.
# mll_utils - set of executable utilities (mll-*).
# nano - simple command-line text editor with on-screen shortcuts.git
# ncurses - "GUI-like" API that runs within a terminal emulator.
# nweb - simple mini http server.
# openjdk - installs Open JDK. All operations are automated.
# static_get - portable binaries for Linux (http://s.minos.io).
# stress - CPU and RAM load generator.
# util_linux - set of executable utilities distributed by the Linux Kernel Org.
# vim - an advanced text editor.
# zlib - DEFLATE compression/decompression library.
# glibc_full - all core GNU C libraries (useful if other software is included).
# cf_cli - CLoud Foundry CLI (command line interface).
# coreutils - set of commonly used GNU executable utilities.
# dhcp - DHCP and DNS functionality.
# dialog - shell scripting for ncurses
# dropbear - SSH server and client.
# felix - Apache Felix OSGi framework.
# fio - I/O load generator.
# java - installs Oracle's JRE or JDK. Manual preparations are required.
# kbd - keyboard utilities
# kexec-tools - execute another kernel from userspace
# libevent - event notification library.
# links - text browser for the web.
# lua - scripting language.
# mll_utils - set of executable utilities (mll-*).
# nano - simple command-line text editor with on-screen shortcuts.git
# ncurses - "GUI-like" API that runs within a terminal emulator.
# nweb - simple mini http server.
# openjdk - installs Open JDK. All operations are automated.
# static_get - portable binaries for Linux (http://s.minos.io).
# stress - CPU and RAM load generator.
# util_linux - set of executable utilities distributed by the Linux Kernel Org.
# vim - an advanced text editor.
# zlib - DEFLATE compression/decompression library.
#
# Refer to the README file for more information.
#

View File

@ -1,12 +1,11 @@
#!/bin/sh
set -e
echo "*** CLEAN BEGIN ***"
echo "Cleaning up the main work area. This may take a while..."
rm -rf work
mkdir work
# -p stops errors if the directory already exists
mkdir -p source
echo "*** CLEAN END ***"

View File

@ -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

View File

@ -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.

View File

@ -1,4 +1,5 @@
#!/bin/sh
set -e
echo "*** PREPARE SRC BEGIN ***"

View File

@ -1,4 +1,5 @@
#!/bin/sh
set -e
echo "*** GENERATE ROOTFS BEGIN ***"
@ -23,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'

View File

@ -1,4 +1,5 @@
#!/bin/sh
set -e
echo "*** PACK ROOTFS BEGIN ***"

View File

@ -1,4 +1,5 @@
#!/bin/sh
set -e
echo "*** GET SYSLINUX BEGIN ***"

View File

@ -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

View File

@ -20,100 +20,102 @@ additional software being downloaded, built and installed on the ISO image.
Currently available overlay bundles:
* GLIBC - Set of all core GNU C libraries packaged together. Requires ~3MB
additional space. This overlay bundle is not host specific and
can always be built. The libraries are useful if you plan to use
more software after boot.
* GLIBC - Set of all core GNU C libraries packaged together. Requires ~3MB
additional space. This overlay bundle is not host specific and
can always be built. The libraries are useful if you plan to use
more software after boot.
This overlay bundle depends on the GLIBC build process.
This overlay bundle depends on the GLIBC build process.
* coreutils - set of commonly used GNU executable utilities.
* coreutils - set of commonly used GNU executable utilities.
* dhcp - DHCP and DNS functionality to connect to the Internet.
* dhcp - DHCP and DNS functionality to connect to the Internet.
* dialog - shell scripting library for ncurses
* dialog - shell scripting library for ncurses
This overlay bundle requires ncurses
This overlay bundle requires ncurses
* Dropbear - SSH server/client. Requires ~1MB additional space. The build
process creates user 'root' with password 'toor'. These are
sample commands which demonstrate how to use Dropbear:
* Dropbear - SSH server/client. Requires ~1MB additional space. The build
process creates user 'root' with password 'toor'. These are
sample commands which demonstrate how to use Dropbear:
SSH server (Alt + F1): dropbear -E -F
SSH client (Alt + F2): dbclient 10.0.2.15 -l root
SSH server (Alt + F1): dropbear -E -F
SSH client (Alt + F2): dbclient 10.0.2.15 -l root
This overlay bundle requires GLIBC.
This overlay bundle requires GLIBC.
* Felix OSGi - Apache Felix OSGi framework. Requires ~2MB additional space. Use
the "felix-start" command to run the Apache Felix OSGi framework.
* Felix OSGi - Apache Felix OSGi framework. Requires ~2MB additional space. Use
the "felix-start" command to run the Apache Felix OSGi framework.
This overlay bundle requires JRE or JDK.
This overlay bundle requires JRE or JDK.
* fio - I/O load generator that can simulate a wide variety of workloads
on RAM or disks. fio is essential for troubleshooting data
bottlenecks.
* fio - I/O load generator that can simulate a wide variety of workloads
on RAM or disks. fio is essential for troubleshooting data
bottlenecks.
* JRE / JDK - Oracle's JRE or JDK. Requires ~366MB additional space for JDK.
This overlay bundle requires some manual preparation steps. Refer
to the "JAVA_ARCHIVE" property in the ".config" file for more
detailed information.
* JRE / JDK - Oracle's JRE or JDK. Requires ~366MB additional space for JDK.
This overlay bundle requires some manual preparation steps. Refer
to the "JAVA_ARCHIVE" property in the ".config" file for more
detailed information.
This overlay bundle requires GLIBC. JDK 9 requires ZLIB.
This overlay bundle requires GLIBC. JDK 9 requires ZLIB.
* kbd - Keyboard utilities and keymaps, you can for example load
a german keyboard layout:
* kbd - Keyboard utilities and keymaps, you can for example load
a german keyboard layout:
loadkeys de
loadkeys de
* libevent - event notification library API provides a mechanism to execute a
callback function when a specific event occurs on a file
descriptor or after a timeout has been reached.
* libevent - event notification library API provides a mechanism to execute a
callback function when a specific event occurs on a file
descriptor or after a timeout has been reached.
* Links - Text based browser. Requires ~1MB additional space. Use the
"links" command to activate the browser.
* kexec-tools - Kexec tools, can be used to boot another kernel from userspace
* Open JDK - The open source JDK. No need for manual steps.
* Links - Text based browser. Requires ~1MB additional space. Use the
"links" command to activate the browser.
This overlay bundle requires GLIBC and ZLIB.
* Open JDK - The open source JDK. No need for manual steps.
* Lua - The Lua Scripting Language 5.3. Requires ~ 800kb additional
space. Use the "lua" command to run an interactive lua
interpreter.
This overlay bundle requires GLIBC and ZLIB.
* MLL Utils - Set of experimental shell scripts (mll-*.sh) which provide
additional functionality, e.g. installer and useful tools.
* Lua - The Lua Scripting Language 5.3. Requires ~ 800kb additional
space. Use the "lua" command to run an interactive lua
interpreter.
This overlay bundle is currently experimental and its build
process depends on the host machine.
* MLL Utils - Set of experimental shell scripts (mll-*.sh) which provide
additional functionality, e.g. installer and useful tools.
* nano - Simple command-line text editor with on-screen shortcuts.
This overlay bundle is currently experimental and its build
process depends on the host machine.
This overlay bundle requires ncurses.
* nano - Simple command-line text editor with on-screen shortcuts.
* ncurses - "GUI-like" API that runs within a terminal emulator.
This overlay bundle requires ncurses.
* nweb - nweb is a very small and easy to use webserver, it is run
automatically on port 80. To portforward port 80 from the
guest (minimal) to port 8080 on the host add
'-net nic,model=e1000 -net user,hostfwd=tcp::8080-:80' to
'cmd' in the qemu.sh file.
* ncurses - "GUI-like" API that runs within a terminal emulator.
* stress - simple workload generator. Imposes a configurable amount of CPU,
memory, I/O, and disk stress on the system. stress is useful for
troubleshooting CPU and RAM.
* nweb - nweb is a very small and easy to use webserver, it is run
automatically on port 80. To portforward port 80 from the
guest (minimal) to port 8080 on the host add
'-net nic,model=e1000 -net user,hostfwd=tcp::8080-:80' to
'cmd' in the qemu.sh file.
* util_linux - Set of executable utilities distributed by the Linux Kernel
similar to busybox or GNU Core Utils.
* stress - simple workload generator. Imposes a configurable amount of CPU,
memory, I/O, and disk stress on the system. stress is useful for
troubleshooting CPU and RAM.
Some packages in this overlay bundle require ncurses.
* util_linux - Set of executable utilities distributed by the Linux Kernel
similar to busybox or GNU Core Utils.
* vim - An advanced text editor that seeks to provide the power of
the de-facto Unix editor 'Vi', with a more complete feature
set.
Some packages in this overlay bundle require ncurses.
This package will create symlinks on top of vi.
* vim - An advanced text editor that seeks to provide the power of
the de-facto Unix editor 'Vi', with a more complete feature
set.
* ZLIB - Software library used for data compression.
This package will create symlinks on top of vi.
* ZLIB - Software library used for data compression.
### ### ###

View File

@ -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.

View File

@ -13,6 +13,8 @@ DESTDIR="$MAIN_SRC_DIR/work/src/minimal_overlay/rootfs"
mkdir -p "$DESTDIR"
install -d -m755 "$DESTDIR/etc"
install -m644 "$SRC_DIR/hosts" "$DESTDIR/etc/hosts"
install -m644 "$SRC_DIR/nsswitch.conf" "$DESTDIR/etc/nsswitch.conf"
install -m644 "$SRC_DIR/resolv.conf" "$DESTDIR/etc/resolv.conf"
install -d -m755 "$DESTDIR/etc/autorun"
install -m755 "$SRC_DIR/01_network.sh" "$DESTDIR/etc/autorun/01_network.sh"
@ -22,6 +24,7 @@ install -m755 "$SRC_DIR/05_rc.dhcp" "$DESTDIR/etc/05_rc.dhcp"
install -d -m755 "$DESTDIR/lib"
install -m755 "$SYSROOT/lib/libresolv.so.2" "$DESTDIR/lib/libresolv.so.2"
install -m755 "$SYSROOT/lib/libnss_dns.so.2" "$DESTDIR/lib/libnss_dns.so.2"
install -m755 "$SYSROOT/lib/libnss_files.so.2" "$DESTDIR/lib/libnss_files.so.2"
strip -g "$DESTDIR/lib/*" 2>/dev/null
echo "dhcp scripts and libraries have been installed"

View File

@ -0,0 +1,5 @@
# /etc/hosts
127.0.0.1 localhost
# ipv6
::1 localhost ipv6-localhost

View File

@ -0,0 +1 @@
hosts: files dns

View File

@ -0,0 +1 @@
ncurses

View File

@ -0,0 +1 @@
glibc_full

View File

@ -0,0 +1 @@
ncurses

View File

@ -24,7 +24,7 @@ install -m644 "$SRC_DIR/index.html" "$DESTDIR/srv/www/index.html"
install -m644 "$SRC_DIR/favicon.ico" "$DESTDIR/srv/www/favicon.ico"
install -d -m755 "$DESTDIR/etc"
install -d -m755 "$DESTDIR/etc/autorun"
install -m755 "$SRC_DIR/nweb.sh" "$DESTDIR/etc/autorun/90_nweb.sh"
install -m755 "$SRC_DIR/90_nweb.sh" "$DESTDIR/etc/autorun/90_nweb.sh"
echo "nweb has been installed."
echo "It will be autostarted on boot."

View File

@ -0,0 +1 @@
ncurses

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
SRC_DIR=$(pwd)

View File

@ -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

View File

@ -30,8 +30,10 @@ echo -e "Welcome to \\e[1mMinimal \\e[32mLinux \\e[31mLive\\e[0m (/sbin/init)"
if [ -d /etc/autorun ] ; then
for AUTOSCRIPT in /etc/autorun/*
do
echo -e "Executing \\e[32m$AUTOSCRIPT\\e[0m in subshell."
sh $AUTOSCRIPT
if [ -f "$AUTOSCRIPT" ] && [ -x "$AUTOSCRIPT" ]; then
echo -e "Executing \\e[32m$AUTOSCRIPT\\e[0m in subshell."
$AUTOSCRIPT
fi
done
fi