From a11ffb64f526527c28513547559416f230a75568 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Tue, 14 Nov 2017 16:14:52 -0500 Subject: [PATCH 1/4] Removed hardcoded CFLAGS --- src/minimal_overlay/bundles/nano/02_build.sh | 5 ++--- src/minimal_overlay/bundles/ncurses/02_build.sh | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) 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 + From cbdaa63284ae61964c6862bf4299fa517ab94761 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Tue, 14 Nov 2017 16:28:58 -0500 Subject: [PATCH 2/4] Add coreutils overlay bundle --- src/.config | 9 +++- src/README | 2 + .../bundles/coreutils/01_get.sh | 41 +++++++++++++++++++ .../bundles/coreutils/02_build.sh | 38 +++++++++++++++++ .../bundles/coreutils/bundle.sh | 9 ++++ 5 files changed, 98 insertions(+), 1 deletion(-) create mode 100755 src/minimal_overlay/bundles/coreutils/01_get.sh create mode 100755 src/minimal_overlay/bundles/coreutils/02_build.sh create mode 100755 src/minimal_overlay/bundles/coreutils/bundle.sh diff --git a/src/.config b/src/.config index 23f091f50..b04a47495 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 @@ -200,6 +206,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. @@ -217,7 +224,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,zlib +#OVERLAY_BUNDLES=glibc_full,cf_cli,coreutils,dhcp,dropbear,felix,java,links,lua,mll_utils,nano,ncurses,nweb,static_get,util_linux,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 d4ac800e4..b726fb841 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..9576e211f --- /dev/null +++ b/src/minimal_overlay/bundles/coreutils/01_get.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +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..6284178ab --- /dev/null +++ b/src/minimal_overlay/bundles/coreutils/bundle.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +time sh 01_get.sh +time sh 02_build.sh + +cd $SRC_DIR + From 116ef1db4b57c4ec16f80021bc3d482659382dd1 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Tue, 14 Nov 2017 17:18:48 -0500 Subject: [PATCH 3/4] Update bundle.sh --- src/minimal_overlay/bundles/coreutils/bundle.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/minimal_overlay/bundles/coreutils/bundle.sh b/src/minimal_overlay/bundles/coreutils/bundle.sh index 6284178ab..cbf2c5338 100755 --- a/src/minimal_overlay/bundles/coreutils/bundle.sh +++ b/src/minimal_overlay/bundles/coreutils/bundle.sh @@ -1,9 +1,8 @@ -#!/bin/sh +#!/bin/bash SRC_DIR=$(pwd) -time sh 01_get.sh -time sh 02_build.sh +./01_get.sh +./02_build.sh cd $SRC_DIR - From a6b10861d17df36ea2e954cd4f022052d1e5aba5 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Tue, 14 Nov 2017 17:19:15 -0500 Subject: [PATCH 4/4] Update 01_get.sh --- src/minimal_overlay/bundles/coreutils/01_get.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/minimal_overlay/bundles/coreutils/01_get.sh b/src/minimal_overlay/bundles/coreutils/01_get.sh index 9576e211f..dd879e455 100755 --- a/src/minimal_overlay/bundles/coreutils/01_get.sh +++ b/src/minimal_overlay/bundles/coreutils/01_get.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash SRC_DIR=$(pwd)