summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/adkprepare.sh10
-rwxr-xr-xscripts/create.sh13
-rwxr-xr-xscripts/find9
-rw-r--r--scripts/gcc-bisect.sh206
-rwxr-xr-xscripts/install-rpi.sh156
-rw-r--r--scripts/scan-tools.sh134
-rwxr-xr-xscripts/tarpkg4
-rw-r--r--scripts/toolchain.cmake.in10
-rwxr-xr-xscripts/xargs9
9 files changed, 430 insertions, 121 deletions
diff --git a/scripts/adkprepare.sh b/scripts/adkprepare.sh
index 08d1ee1a1..5b18d30e3 100755
--- a/scripts/adkprepare.sh
+++ b/scripts/adkprepare.sh
@@ -21,36 +21,28 @@ openbsd() {
PKG_PATH="ftp://ftp.openbsd.org/pub/OpenBSD/${ver}/packages/${arch}/"
export PKG_PATH
pkg_add -v gmake
- pkg_add -v git
pkg_add -v bash
pkg_add -v wget
pkg_add -v gtar--
pkg_add -v gawk
pkg_add -v gsed
- pkg_add -v screen--
- pkg_add -v vim--no_x11
- pkg_add -v py-libxml
}
netbsd() {
echo "Preparing NetBSD for OpenADK"
PKG_PATH="ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/${arch}/${ver}/All/"
export PKG_PATH
- pkg_add -vu scmgit
pkg_add -vu gmake
pkg_add -vu bash
pkg_add -vu wget
pkg_add -vu gtar
pkg_add -vu gsed
pkg_add -vu gawk
- pkg_add -vu vim
- pkg_add -vu screen
- pkg_add -vu mksh
}
freebsd() {
echo "Preparing FreeBSD for OpenADK"
- pkg_add -r git gmake bash wget gtar gsed gawk screen mksh vim
+ pkg_add -r gmake bash wget gtar gsed gawk
}
case $os in
diff --git a/scripts/create.sh b/scripts/create.sh
index 505549247..79401fda9 100755
--- a/scripts/create.sh
+++ b/scripts/create.sh
@@ -55,7 +55,7 @@ Syntax: $me [-c cfgfssize] [+g] [-i imagesize] [-p panictime]
[-s serialspeed] [-t] [-T imagetype] [+U] target.ima source.tgz
Explanation/Defaults:
-c: minimum 0, maximum 5, default 1 (MiB)
- +g: disables installing GNU GRUB 2 (-g enables it, default)
+ -g: enable installing GNU GRUB 2
-i: total image, default 512 (MiB; max. approx. 2 TiB)
-p: default 10 (seconds; 0 disables; max. 300)
-s: default 115200 (bps, others: 9600 19200 38400 57600)
@@ -66,7 +66,7 @@ EOF
}
cfgfs=1
-usegrub=1
+usegrub=0
tgtmib=512
panicreboot=10
speed=115200
@@ -80,7 +80,6 @@ while getopts "c:ghi:p:s:tT:" ch; do
usage
fi ;;
(g) usegrub=1 ;;
- (+g) usegrub=0 ;;
(h) usage 0 ;;
(i) if (( (tgtmib = OPTARG) < 7 || tgtmib > 2097150 )); then
print -u2 "$me: -i $OPTARG out of bounds"
@@ -153,7 +152,7 @@ else
fi
if (( usegrub )); then
- tar -xOzf "$src" usr/share/grub-bin/core.img >"$T/core.img"
+ tar -xOzf "$src" boot/grub/core.img >"$T/core.img"
integer coreimgsz=$($statcmd "$T/core.img")
if (( coreimgsz < 1024 )); then
print -u2 core.img is probably too small: $coreimgsz
@@ -274,12 +273,6 @@ if (( usegrub )); then
print "\tlinux /boot/kernel $linuxargs"
print '}'
) >boot/grub/grub.cfg
- set -A grubfiles
- ngrubfiles=0
- for a in usr/lib/grub/*-pc/{*.mod,efiemu??.o,command.lst,moddep.lst,fs.lst,handler.lst,parttool.lst}; do
- [[ -e $a ]] && grubfiles[ngrubfiles++]=$a
- done
- cp "${grubfiles[@]}" boot/grub/
fi
print "Creating ext2fs filesystem image..."
diff --git a/scripts/find b/scripts/find
deleted file mode 100755
index ea38d92fb..000000000
--- a/scripts/find
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-if [ -z "$(which gfind 2>/dev/null)" ];then
- /usr/bin/find "$@"
-else
- gfind "$@"
-fi
diff --git a/scripts/gcc-bisect.sh b/scripts/gcc-bisect.sh
new file mode 100644
index 000000000..1da4dd5d6
--- /dev/null
+++ b/scripts/gcc-bisect.sh
@@ -0,0 +1,206 @@
+#!/bin/sh
+rm -rf host_x86_64-linux-gnu target_sparc_glibc
+rm -rf gcc-*
+mkdir host_x86_64-linux-gnu
+mkdir target_sparc_glibc
+
+tar xvf binutils-2.24.tar.bz2
+cd binutils-2.24
+./configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
+ --target=sparc-openadk-linux-gnu \
+ --with-sysroot=/home/wbx/smoke/target_sparc_glibc \
+ --disable-dependency-tracking \
+ --disable-libtool-lock \
+ --disable-nls \
+ --disable-werror \
+ --disable-plugins \
+ --disable-libssp --disable-multilib
+make -j4 all
+make install
+cd ..
+
+tar xvf gmp-5.1.3.tar.xz
+cd gmp-5.1.3
+cp configfsf.guess config.guess
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/usr/bin:$PATH" \
+ ./configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
+ --with-pic \
+ --disable-shared \
+ --enable-static
+make -j4 all
+make install
+cd ..
+
+tar xvf mpfr-3.1.2.tar.xz
+cd mpfr-3.1.2
+./configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
+ --with-gmp-build=/home/wbx/smoke/gmp-5.1.3 \
+ --disable-shared \
+ --enable-static
+make -j4 all
+make install
+cd ..
+
+tar xvf mpc-0.8.2.tar.gz
+cd mpc-0.8.2
+./configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
+ --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu \
+ --disable-shared \
+ --enable-static
+make -j4 all
+make install
+make install
+cd ..
+
+tar xvf libelf-0.8.13.tar.gz
+cd libelf-0.8.13
+./configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
+ --disable-nls \
+ --disable-shared \
+ --enable-static
+make -j4 all
+make install
+cd ..
+
+rm -rf host_x86_64-linux-gnu/sparc-openadk-linux-gnu/{lib,sys-include}
+cd host_x86_64-linux-gnu/sparc-openadk-linux-gnu/
+ln -sf ../../target_sparc_glibc/usr/include sys-include
+ln -sf ../../target_sparc_glibc/lib lib
+cd -
+
+mkdir gcc-minimal
+cd gcc-minimal
+CFLAGS="-O0 -g0" \
+CXXFLAGS="-O0 -g0" \
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" \
+../gcc/configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
+ --enable-languages=c \
+ --disable-multilib \
+ --disable-lto \
+ --disable-libssp \
+ --disable-shared \
+ --without-headers
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make -j4 all-gcc
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install-gcc
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+cd ..
+
+cd linux-3.13.6
+make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' INSTALL_HDR_PATH=/home/wbx/smoke/target_sparc_glibc/usr headers_install
+cd ..
+
+cd glibc-2.19-header
+libc_cv_forced_unwind=yes \
+libc_cv_cc_with_libunwind=yes \
+libc_cv_c_cleanup=yes \
+libc_cv_gnu99_inline=yes \
+libc_cv_initfini_array=yes \
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" ../glibc-2.19/configure \
+ --prefix=/home/wbx/smoke/target_sparc_glibc/usr \
+ --with-sysroot=/home/wbx/smoke/target_sparc_glibc \
+ --build=x86_64-linux-gnu --host=sparc-openadk-linux-gnu --with-headers=/home/wbx/smoke/target_sparc_glibc/usr/include --disable-sanity-checks --disable-nls --without-cvs --disable-profile --disable-debug --without-gd --disable-nscd --with-__thread --with-tls --enable-kernel="2.6.32" --enable-add-ons
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make cross-compiling=yes PARALLELMFLAGS="-j1" install-headers
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+cd ..
+touch target_sparc_glibc/usr/include/gnu/stubs.h
+
+mkdir gcc-initial
+cd gcc-initial
+CFLAGS="-O0 -g0" \
+CXXFLAGS="-O0 -g0" \
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" ../gcc/configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
+ --disable-biarch --disable-multilib --enable-libssp --enable-lto \
+ --enable-languages=c \
+ --disable-shared \
+ --disable-threads \
+ --with-sysroot=/home/wbx/smoke/target_sparc_glibc
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all-gcc
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all-target-libgcc
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install-gcc install-target-libgcc
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+cd ..
+
+cd glibc-2.19-final
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" SHELL='/bin/bash' BUILD_CC=cc CFLAGS="-mcpu=v8 -fwrapv -fno-ident -fomit-frame-pointer -O2 -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables -g3" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" CXX="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-g++" AR="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-ar" RANLIB="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-ranlib" libc_cv_forced_unwind=yes libc_cv_cc_with_libunwind=yes libc_cv_c_cleanup=yes libc_cv_gnu99_inline=yes libc_cv_initfini_array=yes \
+../glibc-2.19/configure \
+ --prefix=/usr \
+ --enable-shared \
+ --enable-stackguard-randomization \
+ --build=x86_64-linux-gnu --host=sparc-openadk-linux-gnu --with-headers=/home/wbx/smoke/target_sparc_glibc/usr/include --disable-sanity-checks --disable-nls --without-cvs --disable-profile --disable-debug --without-gd --disable-nscd --with-__thread --with-tls --enable-kernel="2.6.32" --enable-add-ons
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install_root=/home/wbx/smoke/target_sparc_glibc install
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+cd ..
+
+mkdir gcc-final
+cd gcc-final
+../gcc/configure \
+ --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --with-bugurl="http://www.openadk.org/" --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
+ --disable-biarch --disable-multilib --enable-libssp --enable-lto \
+ --enable-languages=c,c++ \
+ --with-build-sysroot='${prefix}/../target_sparc_glibc' \
+ --with-sysroot='${prefix}/../target_sparc_glibc' \
+ --enable-shared
+make -j4 all
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+make install
+if [ $? -ne 0 ];then
+ echo failed
+ exit
+fi
+cd ..
+
+cd linux-3.13.6/
+cat > mini.config <<EOF
+CONFIG_SPARC=y
+CONFIG_SPARC32=y
+CONFIG_SBUS=y
+CONFIG_SBUSCHAR=y
+CONFIG_PCI=y
+CONFIG_PCI_SYSCALL=y
+CONFIG_PCIC_PCI=y
+CONFIG_OF=y
+CONFIG_NET_VENDOR_AMD=y
+CONFIG_SUNLANCE=y
+CONFIG_SERIAL_CONSOLE=y
+CONFIG_SERIAL_SUNCORE=y
+CONFIG_SERIAL_SUNZILOG=y
+CONFIG_SERIAL_SUNZILOG_CONSOLE=y
+EOF
+
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' KCONFIG_ALLCONFIG=mini.config allnoconfig
+PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' -j4 zImage
diff --git a/scripts/install-rpi.sh b/scripts/install-rpi.sh
index d104f5431..0cf88cf4c 100755
--- a/scripts/install-rpi.sh
+++ b/scripts/install-rpi.sh
@@ -3,125 +3,137 @@
# material, please see the LICENCE file in the top-level directory.
if [ $(id -u) -ne 0 ];then
- printf "Installation is only possible as root\n"
+ echo "Installation is only possible as root"
exit 1
fi
-printf "Checking if parted is installed"
-parted=$(which parted)
-
-if [ ! -z $parted -a -x $parted ];then
- printf "...okay\n"
-else
- printf "...failed\n"
- exit 1
-fi
-
-printf "Checking if sfdisk is installed"
-sfdisk=$(which sfdisk)
-
-if [ ! -z $sfdisk -a -x $sfdisk ];then
- printf "...okay\n"
-else
- printf "...failed\n"
- exit 1
-fi
-
-printf "Checking if mke2fs is installed"
-mke2fs=$(which mke2fs)
+f=0
+for tool in parted sfdisk mkfs.vfat mkfs.ext4;do
+ if ! which $tool >/dev/null; then
+ echo "Checking if $tool is installed... failed"
+ f=1
+ fi
+done
+if [ $f -eq 1 ];then exit 1;fi
-if [ ! -z $mke2fs -a -x $mke2fs ];then
- printf "...okay\n"
-else
- printf "...failed\n"
- exit 1
-fi
+datadir=0
+keep=0
+while getopts "dk" ch; do
+ case $ch in
+ d)
+ datadir=1
+ ;;
+ k)
+ keep=1
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
if [ -z $1 ];then
- printf "Please give your SD card device as first parameter\n"
+ echo "Please give your SD card device as first parameter"
exit 1
else
if [ -z $2 ];then
- printf "Please give your install tar archive as second parameter\n"
- exit 2
+ echo "Please give your install tar archive as second parameter"
+ exit 1
fi
if [ -f $2 ];then
- printf "Installing $2 on $1\n"
+ echo "Installing $2 on $1"
else
- printf "$2 is not a file, Exiting\n"
+ echo "$2 is not a file, exiting"
exit 1
fi
if [ -b $1 ];then
- printf "Using $1 as SD card disk for installation\n"
- printf "This will destroy all data on $1, are you sure?\n"
- printf "Type "y" to continue\n"
+ echo "Using $1 as SD card disk for installation"
+ echo "WARNING: This will destroy all data on $1 - type Yes to continue!"
read y
- if [ "$y" = "y" ];then
- $sfdisk -l $1 2>&1 |grep 'No medium'
+ if [ "$y" = "Yes" ];then
+ env LC_ALL=C sfdisk -l $1 2>&1 |grep 'No medium'
if [ $? -eq 0 ];then
+ echo "No medium found"
exit 1
else
- printf "Starting with installation\n"
+ echo "Starting with installation"
fi
else
- printf "Exiting.\n"
+ echo "Exiting."
exit 1
fi
else
- printf "Sorry $1 is not a block device\n"
+ echo "Sorry $1 is not a block device"
exit 1
fi
fi
if [ $(mount | grep $1| wc -l) -ne 0 ];then
- printf "Block device $1 is in use, please umount first.\n"
+ echo "Block device $1 is in use, please umount first"
exit 1
fi
+echo "Wiping existing partitions"
+dd if=/dev/zero of=$1 bs=512 count=1 >/dev/null 2>&1
+sync
-if [ $($sfdisk -l $1 2>/dev/null|grep Empty|wc -l) -ne 4 ];then
- printf "Partitions already exist, should I wipe them?\n"
- printf "Type y to continue\n"
- read y
- if [ $y = "y" ];then
- printf "Wiping existing partitions\n"
- dd if=/dev/zero of=$1 bs=512 count=1 >/dev/null 2>&1
- else
- printf "Exiting.\n"
- exit 1
- fi
-fi
-
-printf "Create partition and filesystem for raspberry pi\n"
+echo "Create partition and filesystem for raspberry pi"
rootpart=${1}2
-$parted -s $1 mklabel msdos
+parted -s $1 mklabel msdos
sleep 2
-maxsize=$(env LC_ALL=C $parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//')
-rootsize=$(($maxsize-16))
+maxsize=$(env LC_ALL=C parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//')
+
+if [ $datadir -eq 0 ];then
+ rootsize=$(($maxsize-2))
+else
+ rootsize=$(($maxsize-34))
+ datasize=$(($maxsize-2))
+fi
-$parted -s $1 unit cyl mkpart primary fat32 -- 0 16
-$parted -s $1 unit cyl mkpart primary ext2 -- 16 $rootsize
-$parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize
-$parted -s $1 set 1 boot on
-$sfdisk --change-id $1 3 88
+parted -s $1 unit cyl mkpart primary fat32 -- 0 16
+if [ $datadir -eq 0 ];then
+ parted -s $1 unit cyl mkpart primary ext2 -- 16 $rootsize
+ parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize
+ sfdisk --change-id $1 3 88
+else
+ parted -s $1 unit cyl mkpart primary ext2 -- 16 $rootsize
+ parted -s $1 unit cyl mkpart primary ext2 $rootsize $datasize
+ parted -s $1 unit cyl mkpart primary fat32 $datasize $maxsize
+ parted -s $1 set 1 boot on
+ sfdisk --change-id $1 4 88
+fi
sleep 2
-mkfs.vfat ${1}1
-$mke2fs ${1}2
+mkfs.vfat ${1}1 >/dev/null
+mkfs.ext4 -q -O ^huge_file ${1}2
+if [ $datadir -eq 1 ];then
+ if [ $keep -eq 0 ];then
+ mkfs.ext4 -q -O ^huge_file ${1}3
+ fi
+fi
sync
sleep 2
tmp=$(mktemp -d)
-mount -t ext2 ${rootpart} $tmp
+mount -t ext4 ${rootpart} $tmp
mkdir $tmp/boot
+if [ $datadir -eq 1 ];then
+ if [ $keep -eq 0 ];then
+ mkdir $tmp/data
+ mount -t ext4 ${1}3 $tmp/data
+ mkdir $tmp/data/mpd $tmp/data/xbmc
+ umount $tmp/data
+ fi
+fi
mount -t vfat ${1}1 $tmp/boot
-sleep 2
-printf "Extracting install archive\n"
+sleep 1
+echo "Extracting install archive"
tar -C $tmp -xzpf $2
-printf "Fixing permissions\n"
+echo "Fixing permissions"
chmod 1777 $tmp/tmp
chmod 4755 $tmp/bin/busybox
+if [ $datadir -eq 1 ];then
+ echo "/dev/mmcblk0p3 /data ext4 rw 0 0" >>$tmp/etc/fstab
+fi
umount $tmp/boot
umount $tmp
-printf "Successfully installed.\n"
+echo "Successfully installed."
exit 0
diff --git a/scripts/scan-tools.sh b/scripts/scan-tools.sh
index 33365483a..f513b5861 100644
--- a/scripts/scan-tools.sh
+++ b/scripts/scan-tools.sh
@@ -196,24 +196,138 @@ if ! which perl >/dev/null 2>&1; then
out=1
fi
-if ! which xargs >/dev/null 2>&1; then
- echo "You need xargs to continue."
- echo
- out=1
-fi
-
if ! which g++ >/dev/null 2>&1; then
echo "You need g++ (GNU C++ compiler) to continue."
echo
out=1
fi
-if ! which git >/dev/null 2>&1; then
- echo "You need git to continue."
- echo
- out=1
+# always required, but can be provided by host
+host_build_bc=0
+if ! which bc >/dev/null 2>&1; then
+ echo "No bc found, will build one."
+ host_build_bc=1
fi
+host_build_bison=0
+if ! which bison >/dev/null 2>&1; then
+ echo "No bison found, will build one."
+ host_build_bison=1
+fi
+
+host_build_bzip2=0
+if ! which bzip2 >/dev/null 2>&1; then
+ echo "No bzip2 found, will build one."
+ host_build_bzip2=1
+fi
+
+host_build_file=0
+if ! which file >/dev/null 2>&1; then
+ echo "No file found, will build one."
+ host_build_file=1
+fi
+
+host_build_flex=0
+if ! which flex >/dev/null 2>&1; then
+ echo "No flex found, will build one."
+ host_build_m4=1
+fi
+
+host_build_m4=0
+if ! which m4 >/dev/null 2>&1; then
+ echo "No m4 found, will build one."
+ host_build_m4=1
+fi
+
+host_build_pkgconf=0
+if ! which pkgconf >/dev/null 2>&1; then
+ echo "No pkgconf found, will build one."
+ host_build_pkgconf=1
+fi
+
+host_build_findutils=0
+if ! which gxargs >/dev/null 2>&1; then
+ if which xargs >/dev/null 2>&1; then
+ if ! xargs --version 2>/dev/null|grep GNU >/dev/null;then
+ echo "No GNU xargs found, will build one."
+ host_build_findutils=1
+ fi
+ fi
+fi
+
+if ! which gfind >/dev/null 2>&1; then
+ if which find >/dev/null 2>&1; then
+ if ! find --version 2>/dev/null|grep GNU >/dev/null;then
+ echo "No GNU find found, will build one."
+ host_build_findutils=1
+ fi
+ fi
+fi
+
+host_build_xz=0
+if ! which xz >/dev/null 2>&1; then
+ echo "No xz found, will build one."
+ host_build_xz=1
+fi
+
+# optional
+host_build_cdrtools=0
+if ! which mkisofs >/dev/null 2>&1; then
+ echo "No mkisofs found, will build one when required."
+ host_build_cdrtools=1
+fi
+
+host_build_ccache=0
+if ! which ccache >/dev/null 2>&1; then
+ echo "No ccache found, will build one when required."
+ host_build_ccache=1
+fi
+
+host_build_genext2fs=0
+if ! which genext2fs >/dev/null 2>&1; then
+ echo "No genext2fs found, will build one when required."
+ host_build_genext2fs=1
+fi
+
+host_build_lzma=0
+if ! which lzma >/dev/null 2>&1; then
+ echo "No lzma found, will build one when required."
+ host_build_lzma=1
+fi
+
+host_build_lzop=0
+if ! which lzop >/dev/null 2>&1; then
+ echo "No lzop found, will build one when required."
+ host_build_lzop=1
+fi
+
+host_build_qemu=0
+if ! which qemu-img >/dev/null 2>&1; then
+ echo "No qemu found, will build one when required."
+ host_build_qemu=1
+fi
+
+echo "config ADK_HOST_BUILD_TOOLS" > $topdir/target/config/Config.in.prereq
+printf "\t%s\n" "boolean" >> $topdir/target/config/Config.in.prereq
+printf "\t%s\n" "default y" >> $topdir/target/config/Config.in.prereq
+# always required
+if [ $host_build_bc -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BC" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_bison -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BISON" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_bzip2 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BZIP2" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_file -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FILE" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_flex -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FLEX" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_m4 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_M4" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_pkgconf -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_PKGCONF" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_findutils -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FINDUTILS" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_xz -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_XZ" >> $topdir/target/config/Config.in.prereq ;fi
+# optional
+if [ $host_build_ccache -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_CCACHE if ADK_HOST_NEED_CCACHE" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_cdrtools -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_CDRTOOLS if ADK_HOST_NEED_CDRTOOLS" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_genext2fs -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_GENEXT2FS if ADK_HOST_NEED_GENEXT2FS" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_lzma -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZMA if ADK_HOST_NEED_LZMA" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_lzop -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZOP if ADK_HOST_NEED_LZOP" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_qemu -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_QEMU if ADK_HOST_NEED_QEMU" >> $topdir/target/config/Config.in.prereq ;fi
+
cd $topdir
rm -rf tmp
diff --git a/scripts/tarpkg b/scripts/tarpkg
index 37c0b2079..40342d401 100755
--- a/scripts/tarpkg
+++ b/scripts/tarpkg
@@ -16,14 +16,14 @@ if [ "$1" = "build" ];then
chmod +x ${2}/usr/lib/pkg/${pkgname}.$file )
done
rm -rf $2/CONTROL
- (cd $2 && tar -czf $3/${pkgname}_${version}_${arch}.tar.gz .)
+ (cd $2 && tar -cJf $3/${pkgname}_${version}_${arch}.tar.xz .)
elif [ "$1" = "install" ];then
pkg=$(echo $(basename $2)|sed -e "s#_.*##")
if [ -x ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst ]; then
IPKG_INSTROOT="$PKG_INSTROOT" ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst
rm ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst
fi
- tar -xzpf $2 -C ${PKG_INSTROOT}
+ tar -xJpf $2 -C ${PKG_INSTROOT}
if [ -x ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst ]; then
IPKG_INSTROOT="$PKG_INSTROOT" ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst
rm ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst
diff --git a/scripts/toolchain.cmake.in b/scripts/toolchain.cmake.in
new file mode 100644
index 000000000..150bfcb27
--- /dev/null
+++ b/scripts/toolchain.cmake.in
@@ -0,0 +1,10 @@
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_C_COMPILER @@TARGET_CC@@)
+set(CMAKE_CXX_COMPILER @@TARGET_CXX@@)
+set(CMAKE_INSTALL_SO_NO_EXE 0)
+set(CMAKE_PROGRAM_PATH \"@@STAGING_HOST_DIR@@/usr/bin\")
+set(CMAKE_FIND_ROOT_PATH \"@@STAGING_TARGET_DIR@@\")
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(ENV{PKG_CONFIG_SYSROOT_DIR} \"@@STAGING_TARGET_DIR@@\")
diff --git a/scripts/xargs b/scripts/xargs
deleted file mode 100755
index cbe9bd015..000000000
--- a/scripts/xargs
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-if [ -z "$(which gxargs 2>/dev/null)" ];then
- /usr/bin/xargs "$@"
-else
- gxargs "$@"
-fi