2013-12-29 12:01:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-02-26 14:46:08 +01:00
|
|
|
set -e
|
|
|
|
|
2014-02-28 08:03:56 +01:00
|
|
|
# Requires root ..
|
|
|
|
if [ "$UID" -ne 0 ]; then
|
|
|
|
echo "Please run as root"
|
|
|
|
fi
|
|
|
|
|
2014-02-28 12:21:10 +01:00
|
|
|
CWD=$(pwd)
|
|
|
|
|
2014-01-02 11:33:32 +01:00
|
|
|
# --- Configuration -------------------------------------------------------------
|
2014-02-26 14:07:17 +01:00
|
|
|
IMG_NAME=${IMG_NAME:-"SlackwareARM_cubitruck"}
|
|
|
|
VERSION=${VERSION:-0.2}
|
2014-02-28 12:12:27 +01:00
|
|
|
COMPILE=${COMPILE:-"false"}
|
2014-02-26 14:07:17 +01:00
|
|
|
DEST=${DEST:-~/cubieslack}
|
2014-02-27 23:11:40 +01:00
|
|
|
CUBIETRUCK_DISPLAY=${CUBIETRUCK_DISPLAY:-"HDMI"} # "HDMI" or "VGA"
|
2014-02-26 14:07:17 +01:00
|
|
|
IMAGE_SIZE_MB=${IMAGE_SIZE_MB:-2000}
|
|
|
|
SLACKWARE_VERSION=${SLACKWARE_VERSION:-14.1}
|
|
|
|
ROOTFS_VERSION=${ROOTFS_VERSION:-04Nov13}
|
2014-02-26 14:46:08 +01:00
|
|
|
TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION:-4.8-2013.10}
|
|
|
|
TOOLCHAIN_URL_RANDOM_NUMBER=${TOOLCHAIN_URL_RANDOM_NUMBER:-155358238}
|
2014-02-26 14:07:17 +01:00
|
|
|
|
2014-02-28 12:12:50 +01:00
|
|
|
PACKAGE_BINARIES=false
|
|
|
|
|
|
|
|
BINARIES_DIR=$CWD/binaries
|
|
|
|
|
2014-02-28 08:23:39 +01:00
|
|
|
# commandline arguments processing
|
|
|
|
while [ "x$1" != "x" ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
-c | --compile )
|
|
|
|
shift
|
|
|
|
COMPILE="true"
|
|
|
|
;;
|
|
|
|
-dc | --dont-compile )
|
|
|
|
shift
|
|
|
|
COMPILE="false"
|
|
|
|
;;
|
|
|
|
-d | --display )
|
|
|
|
shift
|
|
|
|
CUBIETRUCK_DISPLAY=$1
|
|
|
|
shift
|
|
|
|
;;
|
2014-02-28 08:42:21 +01:00
|
|
|
-gz | --compress )
|
|
|
|
shift
|
|
|
|
COMPRESS="true"
|
|
|
|
;;
|
2014-02-28 08:23:39 +01:00
|
|
|
-n | --image-name )
|
|
|
|
shift
|
|
|
|
IMG_NAME=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-r | --rootfs-version )
|
|
|
|
shift
|
|
|
|
ROOTFS_VERSION=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-o | --output )
|
|
|
|
shift
|
|
|
|
DEST=$1
|
|
|
|
shift
|
|
|
|
;;
|
2014-02-28 12:12:50 +01:00
|
|
|
--package-binaries )
|
|
|
|
shift
|
|
|
|
PACKAGE_BINARIES=true
|
|
|
|
;;
|
2014-02-28 08:23:39 +01:00
|
|
|
-v | --image-version )
|
|
|
|
shift
|
|
|
|
VERSION=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-xv | --toolchain-version )
|
|
|
|
shift
|
|
|
|
TOOLCHAIN_VERSION=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-xumn | --toolchain-url-magic-number )
|
|
|
|
shift
|
|
|
|
TOOLCHAIN_URL_RANDOM_NUMBER=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-h | --help )
|
|
|
|
echo -e "Usage: run as root: $0 <options>"
|
|
|
|
echo -e "Options:"
|
|
|
|
echo -e "\t-c | --compile"
|
2014-02-28 12:12:27 +01:00
|
|
|
echo -e "\t-dc | --dont-compile (default)"
|
2014-02-28 08:23:39 +01:00
|
|
|
echo -e "\t-d | --display [\"HDMI\"|\"VGA\"] (default: $CUBIETRUCK_DISPLAY)"
|
|
|
|
echo -e "\t-n | --image-name [\"nom\"] (default: $IMG_NAME)"
|
|
|
|
echo -e "\t-r | --rootfs-version [\"version number\"] (default: $ROOTFS_VERSION)"
|
|
|
|
echo -e "\t-o | --output [/directory/] (default: $DEST)"
|
2014-02-28 12:12:50 +01:00
|
|
|
echo -e "\t --package-binaries"
|
|
|
|
echo -e "\t\tpackage compiled binaries into $BINARIES_DIR-$VERSION.tar.xz"
|
|
|
|
echo -e "\t\t(combine with --compile)"
|
2014-02-28 08:23:39 +01:00
|
|
|
echo -e "\t-v | --image-version [\"version number\"] (default: $VERSION)"
|
|
|
|
echo -e "\t-xv | --toolchain-version [\"version number\"] (default: $TOOLCHAIN_VERSION)"
|
|
|
|
echo -e "\t-xumn | --toolchain-url-magic-number [\"magic number\"] (default: $TOOLCHAIN_URL_RANDOM_NUMBER)"
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2014-02-26 14:07:17 +01:00
|
|
|
# --- Script --------------------------------------------------------------------
|
2014-02-26 12:06:35 +01:00
|
|
|
mkdir -p $DEST
|
|
|
|
|
2014-02-26 14:46:08 +01:00
|
|
|
echo "Building Cubietruck-Slackware in $DEST from $CWD"
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-28 08:03:56 +01:00
|
|
|
if [ "$COMPILE" = "true" ]; then
|
2014-02-28 11:12:33 +01:00
|
|
|
mkdir -p $BINARIES_DIR
|
|
|
|
|
2014-02-28 08:03:56 +01:00
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
echo "Downloading necessary files for building - aka Toolchain"
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
if $(uname -m | grep -q arm); then
|
|
|
|
CROSS_COMPILE=''
|
|
|
|
else
|
|
|
|
#Read this for further information if you run into problems with gcc compiler
|
|
|
|
#http://linux-sunxi.org/Toolchain
|
|
|
|
if [ ! -e $PWD/gcc-linaro-arm-linux-gnueabihf-${TOOLCHAIN_VERSION}_linux/ ]; then
|
|
|
|
[ ! -e $CWD/gcc-linaro-arm-linux-gnueabihf-${TOOLCHAIN_VERSION}_linux.tar.xz ] && wget -c https://launchpadlibrarian.net/$TOOLCHAIN_URL_RANDOM_NUMBER/gcc-linaro-arm-linux-gnueabihf-${TOOLCHAIN_VERSION}_linux.tar.xz -O $CWD/gcc-linaro-arm-linux-gnueabihf-${TOOLCHAIN_VERSION}_linux.tar.xz
|
|
|
|
tar xf $CWD/gcc-linaro-arm-linux-gnueabihf-${TOOLCHAIN_VERSION}_linux.tar.xz
|
|
|
|
fi
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-28 08:03:56 +01:00
|
|
|
CROSS_COMPILE=$PWD/gcc-linaro-arm-linux-gnueabihf-${TOOLCHAIN_VERSION}_linux/bin/arm-linux-gnueabihf-
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
echo "Clone / Pull sources and patch"
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
mkdir -p $DEST/output
|
2014-02-17 08:53:07 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
# Boot loader
|
|
|
|
if [ -d "$DEST/u-boot-sunxi" ]; then
|
|
|
|
( cd $DEST/u-boot-sunxi;
|
|
|
|
git pull )
|
|
|
|
else
|
|
|
|
git clone https://github.com/cubieboard/u-boot-sunxi $DEST/u-boot-sunxi
|
|
|
|
|
|
|
|
# Applying Patch for 2gb memory
|
2014-02-28 12:01:20 +01:00
|
|
|
patch -f $DEST/u-boot-sunxi/include/configs/sunxi-common.h < $CWD/patches/u-boot-sunxi/memory.patch || true
|
2014-02-27 23:11:40 +01:00
|
|
|
fi
|
2014-02-28 10:10:59 +01:00
|
|
|
echo "------ Compiling boot loader"
|
|
|
|
( cd $DEST/u-boot-sunxi
|
2014-02-28 11:11:48 +01:00
|
|
|
make clean CROSS_COMPILE=$CROSS_COMPILE
|
2014-02-28 10:10:59 +01:00
|
|
|
make -j2 'cubietruck' CROSS_COMPILE=$CROSS_COMPILE
|
2014-02-28 11:12:33 +01:00
|
|
|
make HOSTCC=gcc CROSS_COMPILE='' tools
|
|
|
|
|
|
|
|
mkdir -p $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
mv tools/mkimage $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
)
|
2014-02-27 23:11:40 +01:00
|
|
|
|
|
|
|
# Allwinner tools
|
|
|
|
if [ -d "$DEST/sunxi-tools" ]; then
|
|
|
|
( cd $DEST/sunxi-tools;
|
|
|
|
git pull )
|
|
|
|
else
|
|
|
|
git clone https://github.com/linux-sunxi/sunxi-tools.git $DEST/sunxi-tools
|
|
|
|
fi
|
2014-02-28 10:10:59 +01:00
|
|
|
echo "------ Compiling sunxi tools"
|
|
|
|
( cd $DEST/sunxi-tools
|
|
|
|
make clean
|
2014-02-28 11:12:33 +01:00
|
|
|
make fex2bin bin2fex
|
|
|
|
|
|
|
|
mkdir -p $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
mv fexc fex2bin bin2fex $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
)
|
2014-02-27 23:11:40 +01:00
|
|
|
|
|
|
|
# Hardware configurations
|
|
|
|
if [ -d "$DEST/cubie_configs" ]; then
|
|
|
|
( cd $DEST/cubie_configs;
|
|
|
|
git pull )
|
|
|
|
else
|
|
|
|
git clone https://github.com/cubieboard/cubie_configs $DEST/cubie_configs
|
|
|
|
|
|
|
|
# Applying Patch for high load. Could cause troubles with USB OTG port
|
|
|
|
sed -e 's/usb_detect_type = 1/usb_detect_type = 0/g' $DEST/cubie_configs/sysconfig/linux/cubietruck.fex > $DEST/cubie_configs/sysconfig/linux/ct.fex
|
|
|
|
|
|
|
|
# Prepare fex files for VGA & HDMI
|
|
|
|
sed -e 's/screen0_output_type.*/screen0_output_type = 3/g' $DEST/cubie_configs/sysconfig/linux/ct.fex > $DEST/cubie_configs/sysconfig/linux/ct-hdmi.fex
|
|
|
|
sed -e 's/screen0_output_type.*/screen0_output_type = 4/g' $DEST/cubie_configs/sysconfig/linux/ct.fex > $DEST/cubie_configs/sysconfig/linux/ct-vga.fex
|
|
|
|
fi
|
2014-02-28 11:12:33 +01:00
|
|
|
mkdir -p $BINARIES_DIR/cubie_configs
|
|
|
|
$BINARIES_DIR/sunxi-tools/fex2bin $DEST/cubie_configs/sysconfig/linux/ct-vga.fex $BINARIES_DIR/cubie_configs/script-vga.bin
|
|
|
|
$BINARIES_DIR/sunxi-tools/fex2bin $DEST/cubie_configs/sysconfig/linux/ct-hdmi.fex $BINARIES_DIR/cubie_configs/script-hdmi.bin
|
2014-02-27 23:11:40 +01:00
|
|
|
|
|
|
|
# Patwood's kernel 3.4.75+
|
|
|
|
if [ -d "$DEST/linux-sunxi" ]; then
|
|
|
|
( cd $DEST/linux-sunxi;
|
|
|
|
git pull -f )
|
|
|
|
else
|
|
|
|
git clone https://github.com/patrickhwood/linux-sunxi $DEST/linux-sunxi
|
|
|
|
fi
|
2014-02-26 12:06:35 +01:00
|
|
|
echo "------ Compiling kernel"
|
2014-02-28 10:10:59 +01:00
|
|
|
( cd $DEST/linux-sunxi
|
2014-02-28 11:12:33 +01:00
|
|
|
PATH=$PATH:$BINARIES_DIR/u-boot-sunxi/
|
|
|
|
|
2014-02-28 10:10:59 +01:00
|
|
|
make clean
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-28 10:10:59 +01:00
|
|
|
# Adding wlan firmware to kernel source
|
|
|
|
( cd $DEST/linux-sunxi/firmware;
|
2014-02-28 11:58:39 +01:00
|
|
|
unzip -o $CWD/firmwares/ap6210.zip )
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-28 10:10:59 +01:00
|
|
|
make -j2 ARCH=arm CROSS_COMPILE=$CROSS_COMPILE sun7i_defconfig
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-28 10:10:59 +01:00
|
|
|
# get proven config
|
|
|
|
cp $CWD/config/kernel.config $DEST/linux-sunxi/.config
|
|
|
|
make -j2 ARCH=arm CROSS_COMPILE=$CROSS_COMPILE uImage modules
|
|
|
|
make -j2 ARCH=arm CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH=output modules_install
|
2014-02-28 11:12:33 +01:00
|
|
|
make -j2 ARCH=arm CROSS_COMPILE=$CROSS_COMPILE INSTALL_HDR_PATH=output headers_install
|
|
|
|
|
|
|
|
mkdir -p $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
cp $DEST/linux-sunxi/arch/arm/boot/uImage $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
cp -R $DEST/linux-sunxi/output/lib/modules $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
cp -R $DEST/linux-sunxi/output/lib/firmware/ $BINARIES_DIR/$(basename $(pwd))
|
|
|
|
)
|
2014-02-28 12:21:10 +01:00
|
|
|
else
|
|
|
|
if [ ! -e $BINARIES_DIR ]; then
|
|
|
|
echo "ERROR"
|
|
|
|
echo "Necesary binaries files not present !"
|
|
|
|
echo "Either run $0 --compile or download them from https://bitbucket.org/gwenhael/cubietruck-slackware/downloads"
|
|
|
|
echo "and untar them here."
|
|
|
|
|
|
|
|
exit 99
|
|
|
|
fi
|
2014-02-10 13:36:25 +01:00
|
|
|
fi
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-28 12:12:50 +01:00
|
|
|
if [ "$PACKAGE_BINARIES" = "true" ]; then
|
2014-02-28 12:21:10 +01:00
|
|
|
tar Jcf $BINARIES_DIR-$VERSION.tar.xz $BINARIES_DIR
|
2014-02-28 12:25:36 +01:00
|
|
|
|
|
|
|
exit -1
|
2014-02-28 12:12:50 +01:00
|
|
|
fi
|
2014-02-27 23:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
echo "Creating SD Image"
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
2014-02-28 12:25:59 +01:00
|
|
|
mkdir -p $DEST/output
|
2013-12-29 12:01:02 +01:00
|
|
|
cd $DEST/output
|
2014-02-26 14:07:17 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "create image and mount image to next free loop device"
|
2014-02-26 14:07:17 +01:00
|
|
|
dd if=/dev/zero of=${IMG_NAME}-${VERSION}_rootfs_SD.raw bs=1M count=$IMAGE_SIZE_MB
|
|
|
|
|
2014-01-07 20:21:03 +01:00
|
|
|
LOOP0=$(losetup -f)
|
2014-02-26 15:51:52 +01:00
|
|
|
losetup $LOOP0 ${IMG_NAME}-${VERSION}_rootfs_SD.raw
|
2013-12-29 12:01:02 +01:00
|
|
|
|
2014-01-02 11:33:32 +01:00
|
|
|
echo "------ Partitionning and mounting filesystem"
|
2014-01-07 20:21:03 +01:00
|
|
|
dd if=$DEST/u-boot-sunxi/u-boot-sunxi-with-spl.bin of=$LOOP0 bs=1024 seek=8
|
2013-12-29 12:01:02 +01:00
|
|
|
|
|
|
|
# create one partition starting at 2048 which is default
|
2014-01-07 20:21:03 +01:00
|
|
|
(echo n; echo p; echo 1; echo; echo; echo w) | fdisk $LOOP0 >> /dev/null || true
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2013-12-29 12:01:02 +01:00
|
|
|
# just to make sure
|
2014-01-07 20:27:30 +01:00
|
|
|
partprobe $LOOP0
|
2013-12-29 12:01:02 +01:00
|
|
|
|
2014-01-07 20:21:03 +01:00
|
|
|
LOOP1=$(losetup -f)
|
2013-12-29 12:01:02 +01:00
|
|
|
# 2048 (start) x 512 (block size) = where to mount partition
|
2014-02-24 19:44:00 +01:00
|
|
|
losetup -o 1048576 $LOOP1 $LOOP0
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "create filesystem"
|
2014-01-07 20:21:03 +01:00
|
|
|
mkfs.ext4 $LOOP1
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "create mount point and mount image"
|
2013-12-29 12:01:02 +01:00
|
|
|
mkdir -p $DEST/output/sdcard/
|
2014-01-07 20:21:03 +01:00
|
|
|
mount $LOOP1 $DEST/output/sdcard/
|
2013-12-29 12:01:02 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-24 19:44:00 +01:00
|
|
|
echo "------ Get basic Slackware System"
|
2014-01-24 17:44:16 +01:00
|
|
|
cd $DEST/output/sdcard/
|
2014-02-27 23:11:40 +01:00
|
|
|
[ ! -e $CWD/slack-$SLACKWARE_VERSION-miniroot_$ROOTFS_VERSION.tar.xz ] && wget -c ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-devtools/minirootfs/roots/slack-$SLACKWARE_VERSION-miniroot_$ROOTFS_VERSION.tar.xz -O $CWD/slack-$SLACKWARE_VERSION-miniroot_$ROOTFS_VERSION.tar.xz
|
2014-02-26 15:55:51 +01:00
|
|
|
tar xf $CWD/slack-$SLACKWARE_VERSION-miniroot_$ROOTFS_VERSION.tar.xz
|
2014-01-02 11:33:32 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "Configuring Slackware"
|
2014-01-10 15:08:31 +01:00
|
|
|
cat > $DEST/output/sdcard/etc/motd <<EOF
|
2014-02-24 19:44:00 +01:00
|
|
|
_ _ _ _
|
2014-01-10 15:08:31 +01:00
|
|
|
___ _ _ | |__ (_) ___ | |_ _ __ _ _ ___ | | __
|
|
|
|
/ __|| | | || '_ \ | | / _ \| __|| '__|| | | | / __|| |/ /
|
2014-02-24 19:44:00 +01:00
|
|
|
| (__ | |_| || |_) || || __/| |_ | | | |_| || (__ | <
|
2014-01-10 15:08:31 +01:00
|
|
|
\___| \__,_||_.__/ |_| \___| \__||_| \__,_| \___||_|\_\
|
2014-02-24 19:44:00 +01:00
|
|
|
Slackware
|
2014-01-10 15:08:31 +01:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "install script to turn off the LED blinking"
|
2014-02-26 14:46:08 +01:00
|
|
|
cp $CWD/scripts/disable_led.sh $DEST/output/sdcard/bin/disable_led.sh
|
2014-01-24 17:44:16 +01:00
|
|
|
chmod +x $DEST/output/sdcard/bin/disable_led.sh
|
2014-01-01 19:34:06 +01:00
|
|
|
|
2014-02-27 22:35:25 +01:00
|
|
|
cat <<EOF >> $DEST/output/sdcard/etc/rc.d/rc.local
|
|
|
|
|
|
|
|
# Uncomment the following line to turn off the leds after booting
|
|
|
|
# /bin/disable_led.sh
|
|
|
|
EOF
|
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "scripts for autoresize at first boot from cubian"
|
2014-02-26 14:46:08 +01:00
|
|
|
cp $CWD/scripts/resize2fs-arch.sh $DEST/output/sdcard/root/resize2fs-root.sh
|
2014-02-26 12:06:35 +01:00
|
|
|
chmod +x $DEST/output/sdcard/root/resize2fs-root.sh
|
2013-12-29 12:01:02 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "set hostname"
|
2014-02-26 12:06:35 +01:00
|
|
|
echo darkstar > $DEST/output/sdcard/etc/HOSTNAME
|
2014-01-29 19:33:14 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "setup fstab"
|
2014-02-26 12:06:35 +01:00
|
|
|
### declare root partition in fstab
|
|
|
|
echo '/dev/mmcblk0p1 / ext4 defaults 1 1' >> $DEST/output/sdcard/etc/fstab
|
2014-02-15 15:22:33 +01:00
|
|
|
### mount /tmp as tmpfs
|
2014-02-26 12:06:35 +01:00
|
|
|
echo 'tmpfs /tmp tmpfs defaults,nosuid,size=30% 0 0' >> $DEST/output/sdcard/etc/fstab
|
2014-02-15 15:22:33 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "modules to load"
|
2014-02-26 12:06:35 +01:00
|
|
|
cat >> $DEST/output/sdcard/etc/rc.d/rc.modules <<EOT
|
|
|
|
#!/bin/sh
|
|
|
|
|
2014-02-24 19:44:00 +01:00
|
|
|
/sbin/modprobe hci_uart
|
|
|
|
/sbin/modprobe gpio_sunxi
|
|
|
|
/sbin/modprobe bcmdhd
|
|
|
|
/sbin/modprobe ump
|
|
|
|
/sbin/modprobe mali
|
|
|
|
#/sbin/modprobe sunxi_gmac
|
2014-01-25 11:03:52 +01:00
|
|
|
EOT
|
2013-12-29 12:01:02 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "remove the preconfigured boot and setup ours"
|
2014-01-22 11:47:48 +01:00
|
|
|
rm -rf $DEST/output/sdcard/boot/
|
2014-02-26 12:06:35 +01:00
|
|
|
mkdir -p $DEST/output/sdcard/boot/
|
2014-02-27 23:11:40 +01:00
|
|
|
cat <<EOF > $DEST/output/sdcard/boot/uEnv.txt
|
|
|
|
root=/dev/mmcblk0p1 ro
|
|
|
|
extraargs=console=tty0,115200 sunxi_no_mali_mem_reserve sunxi_g2d_mem_reserve=0 sunxi_ve_mem_reserve=0 hdmi.audio=EDID:0 disp.screen0_output_mode=EDID:1280x720p50 rootwait panic=10 rootfstype=ext4 rootflags=discard
|
|
|
|
panic=10 rootfstype=ext4 rootflags=discard
|
|
|
|
EOF
|
2013-12-29 12:01:02 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "setup video output"
|
|
|
|
echo $CUBIETRUCK_DISPLAY
|
|
|
|
case $CUBIETRUCK_DISPLAY in
|
|
|
|
VGA) # VGA
|
2014-02-28 11:12:33 +01:00
|
|
|
cp $BINARIES_DIR/cubie_configs/script-vga.bin $DEST/output/sdcard/boot/script.bin
|
2014-02-26 16:14:39 +01:00
|
|
|
;;
|
2014-02-27 23:11:40 +01:00
|
|
|
HDMI) # HDMI
|
2014-02-28 11:12:33 +01:00
|
|
|
cp $BINARIES_DIR/cubie_configs/script-hdmi.bin $DEST/output/sdcard/boot/script.bin
|
2014-02-26 16:14:39 +01:00
|
|
|
;;
|
|
|
|
*) exit 1
|
|
|
|
esac
|
2014-01-15 18:03:53 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
echo "Installing kernel"
|
2014-02-28 11:12:33 +01:00
|
|
|
cp $BINARIES_DIR/linux-sunxi/uImage $DEST/output/sdcard/boot/
|
|
|
|
cp -R $BINARIES_DIR/linux-sunxi/modules $DEST/output/sdcard/lib/
|
|
|
|
cp -R $BINARIES_DIR/linux-sunxi/firmware/ $DEST/output/sdcard/lib/
|
2013-12-29 12:01:02 +01:00
|
|
|
|
2014-02-27 23:11:40 +01:00
|
|
|
sync
|
|
|
|
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
echo "umount images"
|
2014-02-27 23:15:20 +01:00
|
|
|
umount -d -l $DEST/output/sdcard/
|
2014-01-07 20:21:03 +01:00
|
|
|
losetup -d $LOOP1
|
|
|
|
losetup -d $LOOP0
|
2014-02-26 12:06:35 +01:00
|
|
|
|
2014-02-27 23:16:25 +01:00
|
|
|
echo "cleaning"
|
|
|
|
rm -r $DEST/output/sdcard/
|
|
|
|
|
2014-02-28 08:42:21 +01:00
|
|
|
if [ "$COMPRESS" = "true" ]; then
|
|
|
|
echo "compress image"
|
2014-02-28 08:43:23 +01:00
|
|
|
xz -z $DEST/output/${IMG_NAME}-${VERSION}_rootfs_SD.raw
|
2014-02-28 08:42:21 +01:00
|
|
|
fi
|