]> git.mdlowis.com Git - proto/aardvark-linux.git/commitdiff
Base chroot system is now fully functional and theoretically capable of rebuilding...
authorMike Lowis <mike.lowis@gentex.com>
Wed, 27 Jan 2016 09:10:51 +0000 (09:10 +0000)
committerMike Lowis <mike.lowis@gentex.com>
Wed, 27 Jan 2016 09:10:51 +0000 (09:10 +0000)
build.sh
clean.sh [new file with mode: 0755]
config.sh
enter-chroot.sh
scripts/configopts.sh [new file with mode: 0755]
scripts/kernel-config [moved from kernel-config with 100% similarity]
scripts/musl-cross-config.sh [moved from musl-cross-config.sh with 94% similarity]
scripts/musl-static-config.sh [new file with mode: 0644]

index 4853112b0175c766b6d6a3633a05efb624081715..c4a41f692c6aca7148fcb2fb0b8baee45962882f 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -3,7 +3,6 @@
 ###############################################################################
 # Configuration Settings
 ###############################################################################
-
 # Turn off command hashing and make the script exit when a command errors.
 set -e
 
@@ -15,13 +14,13 @@ set -e
 ###############################################################################
 fetch(){
     if [ ! -d "$3" ]; then
-        mkdir -p "$AL_TARBALLS"
-        if [ ! -f "$AL_TARBALLS/$1" ]; then
-            echo curl -L --retry 5 "$2/$1" > "$AL_TARBALLS/$1"
-            curl -L --retry 5 "$2/$1" > "$AL_TARBALLS/$1"
+        mkdir -p "$AL_SOURCES"
+        if [ ! -f "$AL_SOURCES/$1" ]; then
+            echo curl -L --retry 5 "$2/$1" > "$AL_SOURCES/$1"
+            curl -L --retry 5 "$2/$1" > "$AL_SOURCES/$1"
         fi
         mkdir -p "$3"
-        tar -xvf "$AL_TARBALLS/$1" -C "$3" --strip-components 1
+        tar -xvf "$AL_SOURCES/$1" -C "$3" --strip-components 1
     fi
 }
 
@@ -31,68 +30,96 @@ gitclone(){
     fi
 }
 
-###############################################################################
-# Build the Cross-Compiler
-###############################################################################
-if [ ! -d "$AL_TOOLS/$(uname -m)-linux-musl" ]; then
-    mkdir -vp $AL_TOOLS
-    gitclone https://github.com/sabotage-linux/musl-cross.git "$AL_SOURCES/musl-cross"
-    cd "$AL_SOURCES/musl-cross"
-    cp "$AL/musl-cross-config.sh" config.sh
-    ./build.sh
-    cd "$AL"
-fi
-
-###############################################################################
-# Setup the Build Environment
-###############################################################################
-export CC="$(uname -m)-linux-musl-gcc"
-export CXX="$(uname -m)-linux-musl-g++"
-export AR="$(uname -m)-linux-musl-ar"
-export AS="$(uname -m)-linux-musl-as"
-export LD="$(uname -m)-linux-musl-ld"
-export RANLIB="$(uname -m)-linux-musl-ranlib"
-export READELF="$(uname -m)-linux-musl-readelf"
-export STRIP="$(uname -m)-linux-musl-strip"
-export LDFLAGS="--static"
-
 ###############################################################################
 # Install the Base Packages
 ###############################################################################
+# Fetch the prebuilt cross compiler
+fetch crossx86-x86_64-linux-musl-1.1.12.tar.xz \
+      https://e82b27f594c813a5a4ea5b07b06f16c3777c3b8c.googledrive.com/host/0BwnS5DMB0YQ6bDhPZkpOYVFhbk0/musl-1.1.12/ \
+      "$AL_TOOLS"
 
 # Install sbase
 gitclone http://git.suckless.org/sbase "$AL_SOURCES/sbase"
-cd "$AL_SOURCES/sbase"
-make CC="$CC" LD="$LD" LDFLAGS="$LDFLAGS" -j8
-make PREFIX=$AL_ROOT install
-cd $AL
+if [ ! -f "$AL_ROOT/bin/ls" ]; then
+    cd "$AL_SOURCES/sbase"
+    make $MAKEFLAGS CC="$CC" LD="$LD" LDFLAGS="$LDFLAGS"
+    make $MAKEFLAGS PREFIX=$AL_ROOT install
+    rm -f "$AL_ROOT/bin/grep"
+    cd $AL
+fi
 
 # Install ubase
 gitclone http://git.suckless.org/ubase "$AL_SOURCES/ubase"
-cd "$AL_SOURCES/ubase"
-make CC="$CC" LD="$LD" LDFLAGS="$LDFLAGS" -j8
-make PREFIX=$AL_ROOT install
-cd $AL
+if [ ! -f "$AL_ROOT/bin/clear" ]; then
+    echo ubase
+    cd "$AL_SOURCES/ubase"
+    make $MAKEFLAGS CC="$CC" LD="$LD" LDFLAGS="$LDFLAGS"
+    make $MAKEFLAGS PREFIX=$AL_ROOT install
+    cd $AL
+fi
 
 # Install mksh
 fetch mksh-R52b.tgz https://www.mirbsd.org/MirOS/dist/mir/mksh/ "$AL_SOURCES/mksh"
-cd "$AL_SOURCES/mksh"
-if [ ! -f mksh ]; then
+if [ ! -f "$AL_ROOT/bin/mksh" ]; then
+    cd "$AL_SOURCES/mksh"
     chmod +x Build.sh
     ./Build.sh
+    mkdir -p "$AL_ROOT/etc/" "$AL_ROOT/share/doc/mksh/examples"
+    cp -f mksh "$AL_ROOT/bin/"
+    chmod 555 "$AL_ROOT/bin/mksh"
+    cp -f dot.mkshrc "$AL_ROOT/share/doc/mksh/examples"
+    ln -svf mksh "$AL_ROOT/bin/sh"
+    cd $AL
+fi
+
+# Install GNU grep
+fetch grep-2.9.tar.xz http://ftp.gnu.org/gnu/grep/ "$AL_SOURCES/grep"
+if [ ! -f "$AL_ROOT/bin/grep" ]; then
+    cd "$AL_SOURCES/grep"
+    ./configure             \
+        LDFLAGS="--static"  \
+        --prefix="$AL_ROOT" \
+        --disable-threads   \
+        --disable-rpath     \
+        --disable-nls
+    make $MAKEFLAGS install
+    cd $AL
+fi
+
+# Install GNU awk
+fetch gawk-4.1.3.tar.xz http://ftp.gnu.org/gnu/gawk/ "$AL_SOURCES/gawk"
+if [ ! -f "$AL_ROOT/bin/gawk" ]; then
+    cd "$AL_SOURCES/gawk"
+    ./configure              \
+        LDFLAGS="--static"   \
+        --prefix="$AL_ROOT"  \
+        --disable-extensions \
+        --disable-rpath      \
+        --disable-nls        \
+        --without-readline
+    make $MAKEFLAGS gawk
+    cp "$AL_SOURCES/gawk/gawk" "$AL_ROOT/bin"
+    cd $AL
+fi
+
+# Install GNU make
+fetch make-4.1.tar.gz http://ftp.gnu.org/gnu/make/ "$AL_SOURCES/make"
+if [ ! -f "$AL_ROOT/bin/make" ]; then
+    cd "$AL_SOURCES/make"
+    ./configure              \
+        LDFLAGS="--static"   \
+        --prefix="$AL_ROOT"  \
+        --without-guile
+    make $MAKEFLAGS install
+    cd $AL
 fi
-mkdir -p "$AL_ROOT/etc/" "$AL_ROOT/share/doc/mksh/examples"
-cp -f mksh "$AL_ROOT/bin/"
-chmod 555 "$AL_ROOT/bin/mksh"
-cp -f dot.mkshrc "$AL_ROOT/share/doc/mksh/examples"
-ln -svf mksh "$AL_ROOT/bin/sh"
-cd $AL
 
 ###############################################################################
 # Install Sources
 ###############################################################################
 fetch linux-4.4.tar.xz https://cdn.kernel.org/pub/linux/kernel/v4.x/ "$AL_ROOT/src/linux"
-fetch make-4.1.tar.gz  http://ftp.gnu.org/gnu/make/                  "$AL_ROOT/src/make"
+#fetch make-4.1.tar.gz http://ftp.gnu.org/gnu/make/ "$AL_ROOT/src/make"
+#fetch musl-1.1.12.tar.gz http://www.musl-libc.org/releases/ "$AL_SOURCES/musl"
 
 ###############################################################################
 # Finalize the Chroot
@@ -102,5 +129,3 @@ mkdir -pv "$AL_ROOT/proc"
 mkdir -pv "$AL_ROOT/sys"
 mkdir -pv "$AL_ROOT/tmp"
 mkdir -pv "$AL_ROOT/root"
-#mkdir -pv "$AL_ROOT/$AL_ROOT"
-#ln -svf /tools "$AL_ROOT/$AL_TOOLS"
diff --git a/clean.sh b/clean.sh
new file mode 100755 (executable)
index 0000000..0e35f67
--- /dev/null
+++ b/clean.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+. ./config.sh
+echo rm -r "$AL_ROOT"
+rm -rf "$AL_ROOT"
+echo rm -r "$AL_SOURCES"
+rm -rf "$AL_SOURCES"
index e97c8fdff753671ae184bd9f05b03a5256966348..d5383a00e62dd6c9f728860aa206be9af825e483 100644 (file)
--- a/config.sh
+++ b/config.sh
@@ -1,7 +1,6 @@
 ###############################################################################
 # Aardvark Linux Build Config
 ###############################################################################
-
 # Define a variable to point to the root of the project
 export AL=$PWD
 
@@ -22,12 +21,24 @@ export AL_TARBALLS=$AL/tarballs
 # Variable pointing to the sources directory
 export AL_SOURCES=$AL/sources
 
+# Choose the target triple. This will select the prebuilt cross compiler to use.
+export AL_TGT=$(uname -m)-linux-musl
+
+# Options to use for every invocation of make
+export MAKEFLAGS="-j8"
+
 ###############################################################################
 # Build Environment Settings
 ###############################################################################
-
-# Setup the path to use the cross-tools when they're available
-export AL_TGT=$(uname -m)-linux-musl
-
-#
-export PATH=$AL_ROOT/tools/$AL_TGT/bin:$PATH
+# These settings should not have to change from the defaults. They are mainly
+# here for informational purposes.
+export PATH="$AL_TOOLS/bin:$PATH"
+export CC="$AL_TGT-gcc"
+export CXX="$AL_TGT-g++"
+export AR="$AL_TGT-ar"
+export AS="$AL_TGT-as"
+export LD="$AL_TGT-ld"
+export RANLIB="$AL_TGT-ranlib"
+export READELF="$AL_TGT-readelf"
+export STRIP="$AL_TGT-strip"
+export LDFLAGS="--static"
index c11712c95cc06db2dcd766a7211264de54164d25..f7e52ceb9ce9c8f6d70599c52c20a574100869ba 100755 (executable)
@@ -11,7 +11,7 @@ mount --rbind /dev "$AL_ROOT/dev"
 mount --make-rslave "$AL_ROOT/dev"
 
 # Setup env variables
-export PATH=/bin:/tools/$AL_TGT/bin
+export PATH=/bin:/tools/bin
 
 # Enter the chroot
 chroot "$AL_ROOT" /bin/sh
diff --git a/scripts/configopts.sh b/scripts/configopts.sh
new file mode 100755 (executable)
index 0000000..df87f78
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+cmake \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DLLVM_ENABLE_ZLIB=OFF \
+    -DLLVM_TARGETS_TO_BUILD=X86 \
+    -DLLVM_ENABLE_THREADS=OFF \
+    -DLLVM_ENABLE_PIC=ON \
+    -DLLVM_ENABLE_ZLIB=OFF \
+    -G"Unix Makefiles" \
+    ../
similarity index 100%
rename from kernel-config
rename to scripts/kernel-config
similarity index 94%
rename from musl-cross-config.sh
rename to scripts/musl-cross-config.sh
index 6b360853a9e397b4ac8ec42c98c86e6afeebb071..17f41dd987c304a01f2a6fec7625433554ad2b01 100644 (file)
@@ -7,7 +7,7 @@
 #ARCH=mips
 #ARCH=mipsel
 
-CC_BASE_PREFIX=$AL_TOOLS
+CC_BASE_PREFIX=/tmp/
 
 # If you use arm, you may need more fine-tuning:
 # arm hardfloat v7
@@ -20,6 +20,7 @@ CC_BASE_PREFIX=$AL_TOOLS
 #GCC_BOOTSTRAP_CONFFLAGS="--with-arch=armv7-a --with-float=softfp"
 #GCC_CONFFLAGS="--with-arch=armv7-a --with-float=softfp"
 
+GCC_BUILTIN_PREREQS=yes
 MAKEFLAGS=-j8
 
 # Enable this to build the bootstrap gcc (thrown away) without optimization, to reduce build time
diff --git a/scripts/musl-static-config.sh b/scripts/musl-static-config.sh
new file mode 100644 (file)
index 0000000..5178431
--- /dev/null
@@ -0,0 +1,12 @@
+# ARCH will be auto-detected as the host if not specified
+#ARCH=i486
+CC_BASE_PREFIX="$AL_TOOLS"
+MAKEFLAGS=-j8
+
+GCC_BOOTSTRAP_CONFFLAGS=--disable-lto-plugin
+GCC_CONFFLAGS=--disable-lto-plugin
+MUSL_CC_PREFIX="musl-"
+# Disable these three lines when running build-gcc-deps.sh
+CC="'"${MUSL_CC_PREFIX}gcc"' -Wl,-Bstatic -static-libgcc"
+CXX="'"${MUSL_CC_PREFIX}g++"' -Wl,-Bstatic -static-libgcc"
+export CC CXX