Skip to content

Commit

Permalink
Bundles volatile config proof-of-concept
Browse files Browse the repository at this point in the history
  • Loading branch information
kincsescsaba committed Feb 27, 2024
1 parent c2f6034 commit be3846e
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/minimal_overlay/bundles/ncurses/.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
#
# https://ftp.gnu.org/pub/gnu/ncurses/
#
NCURSES_SOURCE_URL=https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz
NCURSES_SOURCE_URL=https://ftp.gnu.org/pub/gnu/ncurses/ncurses-$NCURSES_VERSION.tar.gz

1 change: 1 addition & 0 deletions src/minimal_overlay/bundles/ncurses/01_get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e

. ../../common.sh
. ../../../settings

# Read the common configuration properties.
DOWNLOAD_URL=`read_property NCURSES_SOURCE_URL`
Expand Down
3 changes: 2 additions & 1 deletion src/minimal_overlay/bundles/ncurses/02_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
set -e

. ../../common.sh
. ../../../settings

cd $WORK_DIR/overlay/$BUNDLE_NAME

# Change to the ncurses source directory which ls finds, e.g. 'ncurses-6.0'.
cd $(ls -d ncurses-*)
cd $(ls -d ncurses-$NCURSES_VERSION)

if [ -f Makefile ] ; then
echo "Preparing '$BUNDLE_NAME' work area. This may take a while."
Expand Down
1 change: 1 addition & 0 deletions src/minimal_overlay/bundles/pkg_config/.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PKG_CONFIG_SOURCE_URL=https://pkgconfig.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VERSION.tar.gz
20 changes: 20 additions & 0 deletions src/minimal_overlay/bundles/pkg_config/01_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -e

. ../../common.sh
. ../../../settings

# Read the 'pkg_config' download URL from '.config'.
DOWNLOAD_URL=`read_property PKG_CONFIG_SOURCE_URL`

# Grab everything after the last '/' character.
ARCHIVE_FILE=${DOWNLOAD_URL##*/}

# Download 'pkg_config' source archive in the 'source/overlay' directory.
download_source $DOWNLOAD_URL $OVERLAY_SOURCE_DIR/$ARCHIVE_FILE

# Extract all 'coreutils' sources in the 'work/overlay/pkg_config' directory.
extract_source $OVERLAY_SOURCE_DIR/$ARCHIVE_FILE pkg_config

cd $SRC_DIR
32 changes: 32 additions & 0 deletions src/minimal_overlay/bundles/pkg_config/02_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

set -e

. ../../common.sh
. ../../../settings

cd `ls -d $OVERLAY_WORK_DIR/$BUNDLE_NAME/pkg-config-$PKG_CONFIG_VERSION`

make_clean

rm -rf $DEST_DIR

echo "Configuring '$BUNDLE_NAME'."
CFLAGS="$CFLAGS" ./configure \
--prefix=/usr \
--with-internal-glib

echo "Building '$BUNDLE_NAME'."
make_target

echo "Installing '$BUNDLE_NAME'."
make_target install DESTDIR=$DEST_DIR

echo "Reducing '$BUNDLE_NAME' size."
reduce_size $DEST_DIR/usr/bin

install_to_overlay

echo "Bundle '$BUNDLE_NAME' has been installed."

cd $SRC_DIR
10 changes: 10 additions & 0 deletions src/minimal_overlay/bundles/pkg_config/bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

set -e

. ../../common.sh

./01_get.sh
./02_build.sh

cd $SRC_DIR
2 changes: 1 addition & 1 deletion src/minimal_overlay/bundles/util_linux/.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
#
# https://www.kernel.org/pub/linux/utils/util-linux/
#
UTIL_LINUX_SOURCE_URL=https://kernel.org/pub/linux/utils/util-linux/v2.34/util-linux-2.34.tar.xz
UTIL_LINUX_SOURCE_URL=https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v$(echo $UTIL_LINUX_VERSION | cut -d '-' -f 1 | cut -d '.' -f 1-2)/util-linux-$UTIL_LINUX_VERSION.tar.xz
1 change: 1 addition & 0 deletions src/minimal_overlay/bundles/util_linux/01_get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e

. ../../common.sh
. ../../../settings

# Read the common configuration properties.
DOWNLOAD_URL=`read_property UTIL_LINUX_SOURCE_URL`
Expand Down
14 changes: 10 additions & 4 deletions src/minimal_overlay/bundles/util_linux/02_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
set -e

. ../../common.sh
. ../../../settings

cd $WORK_DIR/overlay/$BUNDLE_NAME

# Change to the util-linux source directory which ls finds, e.g. 'util-linux-2.34'.
cd $(ls -d util-linux-*)
cd $(ls -d util-linux-$UTIL_LINUX_VERSION)

if [ -f Makefile ] ; then
echo "Preparing '$BUNDLE_NAME' work area. This may take a while."
Expand All @@ -21,6 +22,7 @@ mkdir -p $DEST_DIR/usr/share/doc/util-linux
mkdir -p $DEST_DIR/bin

echo "Configuring '$BUNDLE_NAME'."
./autogen.sh && \
CFLAGS="$CFLAGS" ./configure \
ADJTIME_PATH=/var/lib/hwclock/adjtime \
--prefix=$DEST_DIR \
Expand All @@ -34,16 +36,20 @@ CFLAGS="$CFLAGS" ./configure \
--disable-pylibmount \
--disable-static \
--disable-makeinstall-chown \
--without-python \
--without-systemd \
--without-systemdsystemunitdir
#--enable-libblkid \
#--enable-libuuid \
#--enable-libsmartcols \
#--without-python \
#--without-systemd \
#--without-systemdsystemunitdir

echo "Building '$BUNDLE_NAME'."
make -j $NUM_JOBS

echo "Installing '$BUNDLE_NAME'."
make -j $NUM_JOBS install


echo "Reducing '$BUNDLE_NAME' size."
reduce_size $DEST_DIR/bin

Expand Down
8 changes: 5 additions & 3 deletions src/minimal_overlay/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ read_property() (

if [ ! "$prop_name" = "" ] ; then
# Search in the main '.config' file.
prop_value="`grep -i ^${prop_name}= $CONFIG | cut -f2- -d'=' | xargs`"
value_def=`grep -i ^${prop_name}= $CONFIG | cut -f2- -d'=' | xargs`
prop_value=`eval echo $value_def`

if [ -f $SRC_DIR/.config ] ; then
# Search in the local '.config' file.
prop_value_local="`grep -i ^${prop_name}= $SRC_DIR/.config | cut -f2- -d'=' | xargs`"
value_def_local=`grep -i ^${prop_name}= $SRC_DIR/.config | cut -f2- -d'=' | xargs`
prop_value_local=`eval echo $value_def_local`

if [ ! "$prop_value_local" = "" ] ; then
# Override the original value with the local value.
Expand All @@ -49,7 +51,7 @@ read_property() (
fi
fi

echo "$prop_value"
echo $prop_value
)

# Read commonly used configuration properties.
Expand Down
9 changes: 6 additions & 3 deletions src/settings
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
KERNEL_VERSION=6.6.17
GLIBC_VERSION=2.38
KERNEL_VERSION=6.7.5
GLIBC_VERSION=2.39
BUSYBOX_VERSION=1.36.1
ADD_BUNDLES=dhcp,mll_hello,mll_logo,mll_source,glibc_full
ADD_BUNDLES=dhcp,util_linux
UTIL_LINUX_VERSION=2.39.3
NCURSES_VERSION=6.3
PKG_CONFIG_VERSION=0.29.2

0 comments on commit be3846e

Please sign in to comment.