diff --git a/src/.config b/src/.config index aa769f654..0e62eb91f 100644 --- a/src/.config +++ b/src/.config @@ -47,6 +47,12 @@ SYSLINUX_SOURCE_URL=http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.0 # CLOUD_FOUNDRY_CLI_URL=http://cli.run.pivotal.io/stable?release=linux64-binary&source=github +# You can find the latest coreutils source bundles here: +# +# http://ftp.gnu.org/gnu/coreutils/ +# +COREUTILS_SOURCE_URL=http://ftp.gnu.org/gnu/coreutils/coreutils-8.28.tar.xz + # You can find the latest Dropbear source bundles here: # # http://matt.ucc.asn.au/dropbear/dropbear.html @@ -206,6 +212,7 @@ COPY_SOURCE_ISO=true # # 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. # dropbear - SSH server and client. # felix - Apache Felix OSGi framework. @@ -224,7 +231,7 @@ COPY_SOURCE_ISO=true # # Refer to the README file for more information. # -#OVERLAY_BUNDLES=glibc_full,cf_cli,dhcp,dropbear,felix,java,links,lua,mll_utils,nano,ncurses,nweb,static_get,util_linux,vim,zlib +#OVERLAY_BUNDLES=glibc_full,cf_cli,coreutils,dhcp,dropbear,felix,java,links,lua,mll_utils,nano,ncurses,nweb,openjdk,static_get,util_linux,vim,zlib #OVERLAY_BUNDLES=glibc_full,dhcp,felix,links,openjdk,zlib # This property enables the standard penguin boot logo in the upper left corner diff --git a/src/README b/src/README index 8a92d1d34..968ffd67a 100644 --- a/src/README +++ b/src/README @@ -27,6 +27,8 @@ Currently available overlay bundles: This overlay bundle depends on the GLIBC build process. +* coreutils - set of commonly used GNU executable utilities. + * dhcp - DHCP and DNS functionality to connect to the Internet. * Dropbear - SSH server/client. Requires ~1MB additional space. The build diff --git a/src/minimal_overlay/bundles/coreutils/01_get.sh b/src/minimal_overlay/bundles/coreutils/01_get.sh new file mode 100755 index 000000000..dd879e455 --- /dev/null +++ b/src/minimal_overlay/bundles/coreutils/01_get.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i COREUTILS_SOURCE_URL $MAIN_SRC_DIR/.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 $MAIN_SRC_DIR/.config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE ] ; then + echo "Source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + +cd $MAIN_SRC_DIR/source/overlay + +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading coreutils source bundle file. The '-c' option allows the download to resume. + echo "Downloading coreutils source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local coreutils source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted coreutils. +echo "Removing coreutils work area. This may take a while..." +rm -rf $WORK_DIR/overlay/coreutils +mkdir $WORK_DIR/overlay/coreutils + +# Extract coreutils to folder 'work/overlay/coreutils'. +# Full path will be something like 'work/overlay/coreutils/coreutils-8.28'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/coreutils + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/coreutils/02_build.sh b/src/minimal_overlay/bundles/coreutils/02_build.sh new file mode 100755 index 000000000..a8d22973d --- /dev/null +++ b/src/minimal_overlay/bundles/coreutils/02_build.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/coreutils + +DESTDIR="$PWD/coreutils_installed" + +# Change to the coreutils source directory which ls finds, e.g. 'coreutils-8.28'. +cd $(ls -d coreutils-*) + +echo "Preparing coreutils work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +echo "Configuring coreutils..." +CFLAGS="$CFLAGS" ./configure \ + --prefix=/usr + +echo "Building coreutils..." +make -j $NUM_JOBS + +echo "Installing coreutils..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing coreutils size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +cp -r $DESTDIR/* $ROOTFS + +echo "coreutils has been installed." + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/coreutils/bundle.sh b/src/minimal_overlay/bundles/coreutils/bundle.sh new file mode 100755 index 000000000..cbf2c5338 --- /dev/null +++ b/src/minimal_overlay/bundles/coreutils/bundle.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +./01_get.sh +./02_build.sh + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/nano/02_build.sh b/src/minimal_overlay/bundles/nano/02_build.sh index b63a4208a..9480712e5 100755 --- a/src/minimal_overlay/bundles/nano/02_build.sh +++ b/src/minimal_overlay/bundles/nano/02_build.sh @@ -18,9 +18,8 @@ rm -rf $DESTDIR echo "Configuring nano..." CFLAGS="$CFLAGS" ./configure \ - --prefix=/usr - --disable-utf8 \ - CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" + --prefix=/usr \ + LDFLAGS=-L$WORK_DIR/overlay/ncurses/ncurses_installed/usr/include echo "Building nano..." make -j $NUM_JOBS diff --git a/src/minimal_overlay/bundles/ncurses/02_build.sh b/src/minimal_overlay/bundles/ncurses/02_build.sh index dfe151ca1..3362c6a6a 100755 --- a/src/minimal_overlay/bundles/ncurses/02_build.sh +++ b/src/minimal_overlay/bundles/ncurses/02_build.sh @@ -22,7 +22,7 @@ sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in # Configure Ncurses echo "Configuring Ncurses..." -./configure \ +CFLAGS="$CFLAGS" ./configure \ --prefix=/usr \ --with-termlib \ --with-terminfo-dirs=/lib/terminfo \ @@ -36,7 +36,6 @@ echo "Configuring Ncurses..." --with-shared \ CPPFLAGS=-I$PWD/ncurses/widechar \ LDFLAGS=-L$PWD/lib \ - CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" \ CPPFLAGS="-P" # Most configuration switches are from AwlsomeAlex @@ -68,3 +67,4 @@ cp -r $DESTDIR/usr/* $ROOTFS echo "ncurses has been installed." cd $SRC_DIR +