2013-12-29 12:01:02 +01:00
#!/bin/bash
2014-01-02 11:33:32 +01:00
# --- Configuration -------------------------------------------------------------
2014-01-24 09:35:26 +01:00
#change to your needs
2014-01-22 11:47:48 +01:00
VERSION = "ArchLinux_0.1"
DEST_LANG = "de_DE"
DEST_LANGUAGE = "de"
2014-01-24 17:44:16 +01:00
mkdir ~/cubie
DEST = ~/cubie
2014-01-22 11:47:48 +01:00
DISPLAY = 3 # "3:hdmi; 4:vga"
2014-01-02 11:33:32 +01:00
# --- End -----------------------------------------------------------------------
SRC = $( pwd )
set -e
2013-12-29 13:57:19 +01:00
2013-12-29 12:01:02 +01:00
#Requires root ..
2014-01-02 11:33:32 +01:00
if [ " $UID " -ne 0 ]
then echo "Please run as root"
exit
fi
2014-01-22 11:47:48 +01:00
echo " Building Cubietruck-Arch in $DEST from $SRC "
2014-01-02 11:33:32 +01:00
sleep 3
2013-12-29 12:01:02 +01:00
#--------------------------------------------------------------------------------
2014-01-24 09:35:26 +01:00
# Downloading necessary files for building - aka Toolchain
2013-12-29 12:01:02 +01:00
#--------------------------------------------------------------------------------
2014-01-02 11:33:32 +01:00
echo "------ Downloading necessary files"
2014-01-22 15:04:26 +01:00
#Read this for further information if you run into problems with gcc compiler
#http://linux-sunxi.org/Toolchain
apt-get -qq -y install binfmt-support bison build-essential ccache debootstrap flex gawk gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gettext linux-headers-generic linux-image-generic lvm2 qemu-user-static texinfo texlive u-boot-tools uuid-dev zlib1g-dev unzip libncurses5-dev pkg-config libusb-1.0-0-dev
2013-12-29 12:01:02 +01:00
#--------------------------------------------------------------------------------
# Preparing output / destination files
#--------------------------------------------------------------------------------
2014-01-02 11:33:32 +01:00
echo "------ Fetching files from github"
2013-12-29 12:01:02 +01:00
mkdir -p $DEST /output
cp output/uEnv.txt $DEST /output
2014-01-02 11:33:32 +01:00
if [ -d " $DEST /u-boot-sunxi " ]
then
cd $DEST /u-boot-sunxi ; git pull; cd $SRC
else
git clone https://github.com/cubieboard/u-boot-sunxi $DEST /u-boot-sunxi # Boot loader
fi
if [ -d " $DEST /sunxi-tools " ]
then
cd $DEST /sunxi-tools; git pull; cd $SRC
else
git clone https://github.com/linux-sunxi/sunxi-tools.git $DEST /sunxi-tools # Allwinner tools
fi
if [ -d " $DEST /cubie_configs " ]
then
cd $DEST /cubie_configs; git pull; cd $SRC
else
git clone https://github.com/cubieboard/cubie_configs $DEST /cubie_configs # Hardware configurations
fi
if [ -d " $DEST /linux-sunxi " ]
then
cd $DEST /linux-sunxi; git pull -f; cd $SRC
else
2014-01-09 19:10:17 +01:00
# git clone https://github.com/cubieboard/linux-sunxi/ $DEST/linux-sunxi # Kernel 3.4.61+
git clone https://github.com/patrickhwood/linux-sunxi -b pat-3.4.75-ct $DEST /linux-sunxi # Patwood's kernel 3.4.75+
2014-01-02 11:33:32 +01:00
fi
2013-12-29 12:01:02 +01:00
2013-12-29 14:14:43 +01:00
# Applying Patch for 2gb memory
2014-01-15 18:16:04 +01:00
#patch -f $DEST/u-boot-sunxi/include/configs/sunxi-common.h < $SRC/patch/memory.patch || true
2014-01-09 18:05:18 +01:00
2014-01-02 16:13:39 +01:00
# Applying Patch for gpio
2014-01-15 18:16:04 +01:00
#patch -f $DEST/linux-sunxi/drivers/gpio/gpio-sunxi.c < $SRC/patch/gpio.patch || true
2013-12-29 12:01:02 +01:00
2014-01-09 18:05:18 +01:00
# Applying Patch for high load. Could cause troubles with USB OTG port
2014-01-09 21:29:46 +01:00
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
2014-01-09 18:05:18 +01:00
2014-01-15 18:03:53 +01:00
# 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
2013-12-29 12:01:02 +01:00
2014-01-02 11:33:32 +01:00
# Copying Kernel config
cp $SRC /config/kernel.config $DEST /linux-sunxi/
2013-12-29 12:01:02 +01:00
#--------------------------------------------------------------------------------
# Compiling everything
#--------------------------------------------------------------------------------
2014-01-02 11:33:32 +01:00
#if false; then
echo "------ Compiling kernel boot loaderb"
2013-12-29 12:01:02 +01:00
cd $DEST /u-boot-sunxi
# boot loader
2014-01-02 11:33:32 +01:00
make clean && make -j2 'cubietruck' CROSS_COMPILE = arm-linux-gnueabihf-
echo "------ Compiling sunxi tools"
cd $DEST /sunxi-tools
2013-12-29 12:01:02 +01:00
# sunxi-tools
2014-01-15 18:37:59 +01:00
make clean && make fex2bin && make bin2fex
cp fex2bin bin2fex /usr/local/bin/
2013-12-29 12:01:02 +01:00
# hardware configuration
2014-01-15 18:03:53 +01:00
fex2bin $DEST /cubie_configs/sysconfig/linux/ct-vga.fex $DEST /output/script-vga.bin
fex2bin $DEST /cubie_configs/sysconfig/linux/ct-hdmi.fex $DEST /output/script-hdmi.bin
2014-01-02 11:33:32 +01:00
2013-12-29 12:01:02 +01:00
# kernel image
2014-01-02 11:33:32 +01:00
echo "------ Compiling kernel"
cd $DEST /linux-sunxi
make clean
2014-01-15 18:45:01 +01:00
# Adding wlan firmware to kernel source
2014-01-18 17:41:11 +01:00
cd $DEST /linux-sunxi/firmware;
unzip -o $SRC /bin/ap6210.zip
2014-01-15 18:52:46 +01:00
cd $DEST /linux-sunxi
2014-01-15 18:45:01 +01:00
2013-12-29 12:01:02 +01:00
make -j2 ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf- sun7i_defconfig
# get proven config
2014-01-02 11:33:32 +01:00
cp $DEST /linux-sunxi/kernel.config $DEST /linux-sunxi/.config
2013-12-29 12:01:02 +01:00
make -j2 ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf- uImage modules
make -j2 ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf- INSTALL_MOD_PATH = output modules_install
2014-01-07 10:30:49 +01:00
make -j2 ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf- INSTALL_HDR_PATH = output headers_install
2014-01-02 11:33:32 +01:00
#fi
2013-12-29 12:01:02 +01:00
#--------------------------------------------------------------------------------
# Creating SD Images
#--------------------------------------------------------------------------------
2014-01-02 11:33:32 +01:00
echo "------ Creating SD Images"
2013-12-29 12:01:02 +01:00
cd $DEST /output
2014-01-24 09:38:38 +01:00
# create 2Gb image and mount image to next free loop device
dd if = /dev/zero of = arch_rootfs.raw bs = 1M count = 2000
2014-01-07 20:21:03 +01:00
LOOP0 = $( losetup -f)
2014-01-22 11:47:48 +01:00
losetup $LOOP0 arch_rootfs.raw
2013-12-29 12:01:02 +01:00
2014-01-02 11:33:32 +01:00
echo "------ Partitionning and mounting filesystem"
2013-12-29 12:01:02 +01:00
# make image bootable
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
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-01-07 20:21:03 +01:00
losetup -o 1048576 $LOOP1 $LOOP0
2013-12-29 12:01:02 +01:00
# create filesystem
2014-01-07 20:21:03 +01:00
mkfs.ext4 $LOOP1
2013-12-29 12:01:02 +01:00
# create mount point and mount image
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-01-24 09:35:26 +01:00
echo "------ Get basic Arch System"
2013-12-29 12:01:02 +01:00
# install base system
2014-01-22 11:47:48 +01:00
#debootstrap --no-check-gpg --arch=armhf --foreign wheezy $DEST/output/sdcard/
2014-01-24 09:35:26 +01:00
2014-01-22 11:47:48 +01:00
#fetching latest Arch-Image for ARMv7 Allwinner Platform for the root filesystem
2014-01-24 17:44:16 +01:00
#wget -q -P $DEST/output/sdcard/ -O - http://archlinuxarm.org/os/ArchLinuxARM-sun7i-latest.tar.gz | tar -xzf -
cd $DEST /output/sdcard/
wget -q http://archlinuxarm.org/os/ArchLinuxARM-sun7i-latest.tar.gz
tar xvzf ArchLinuxARM-sun7i-latest.tar.gz
2014-01-26 10:26:06 +01:00
sync
2014-01-25 11:03:52 +01:00
rm ArchLinuxARM-sun7i-latest.tar.gz
2013-12-29 12:01:02 +01:00
# we need this
2014-01-24 09:35:26 +01:00
#cp /usr/bin/qemu-arm-static $DEST/output/sdcard/usr/bin/
2014-01-09 18:24:12 +01:00
# mount proc inside chroot
2014-01-22 11:47:48 +01:00
#mount -t proc chproc $DEST/output/sdcard/proc
2014-01-09 18:24:12 +01:00
# second stage unmounts proc
2014-01-22 11:47:48 +01:00
#chroot $DEST/output/sdcard /bin/bash -c "/debootstrap/debootstrap --second-stage"
2014-01-07 22:10:52 +01:00
# mount proc, sys and dev
2014-01-22 11:47:48 +01:00
#mount -t proc chproc $DEST/output/sdcard/proc
#mount -t sysfs chsys $DEST/output/sdcard/sys
2014-01-07 22:10:52 +01:00
# This works on half the systems I tried. Else use bind option
2014-01-22 11:47:48 +01:00
#mount -t devtmpfs chdev $DEST/output/sdcard/dev || mount --bind /dev $DEST/output/sdcard/dev
#mount -t devpts chpts $DEST/output/sdcard/dev/pts
2013-12-29 12:01:02 +01:00
2014-01-02 11:33:32 +01:00
# update /etc/issue
2014-01-22 11:47:48 +01:00
#cat <<EOT > $DEST/output/sdcard/etc/issue
#Debian GNU/Linux 7 $VERSION
2014-01-25 11:03:52 +01:00
#EOT
2014-01-02 11:33:32 +01:00
2014-01-10 15:08:31 +01:00
# update /etc/motd
cat > $DEST /output/sdcard/etc/motd <<EOF
_ _ _ _
___ _ _ | | __ ( _) ___ | | _ _ __ _ _ ___ | | __
/ __|| | | || '_ \ | | / _ \| __|| ' __|| | | | / __|| | / /
| ( __ | | _| || | _) || || __/| | _ | | | | _| || ( __ | <
\_ __| \_ _,_|| _.__/ | _| \_ __| \_ _|| _| \_ _,_| \_ __|| _| \_ \
EOF
2013-12-29 12:01:02 +01:00
# apt list
2014-01-22 11:47:48 +01:00
#cat <<EOT > $DEST/output/sdcard/etc/apt/sources.list
#deb http://http.debian.net/debian wheezy main contrib non-free
#deb-src http://http.debian.net/debian wheezy main contrib non-free
#deb http://http.debian.net/debian wheezy-updates main contrib non-free
#deb-src http://http.debian.net/debian wheezy-updates main contrib non-free
#deb http://security.debian.org/debian-security wheezy/updates main contrib non-free
#deb-src http://security.debian.org/debian-security wheezy/updates main contrib non-free
#EOT
2013-12-29 12:01:02 +01:00
# update
2014-01-22 11:47:48 +01:00
#chroot $DEST/output/sdcard /bin/bash -c "apt-get update"
#chroot $DEST/output/sdcard /bin/bash -c "export LANG=C"
2013-12-29 12:01:02 +01:00
# set up 'apt
2014-01-22 11:47:48 +01:00
#cat <<END > $DEST/output/sdcard/etc/apt/apt.conf.d/71-no-recommends
#APT::Install-Recommends "0";
#APT::Install-Suggests "0";
#END
2013-12-29 12:01:02 +01:00
2014-01-01 19:34:06 +01:00
# script to turn off the LED blinking
2014-01-24 17:44:16 +01:00
cp $SRC /scripts/disable_led.sh $DEST /output/sdcard/bin/disable_led.sh
2014-01-01 19:34:06 +01:00
# make it executable
2014-01-24 17:44:16 +01:00
#chroot $DEST/output/sdcard /bin/bash -c "chmod +x /etc/scripts/disable_led.sh"
chmod +x $DEST /output/sdcard/bin/disable_led.sh
2014-01-01 19:34:06 +01:00
# and startable on boot
2014-01-24 09:35:26 +01:00
#if you want place an entry to /etc/rc.locale
echo disable_led.sh > $DEST /output/sdcard/etc/rc.locale
2014-01-22 11:47:48 +01:00
#chroot $DEST/output/sdcard /bin/bash -c "update-rc.d disable_led.sh defaults"
2014-01-01 19:34:06 +01:00
2013-12-29 12:01:02 +01:00
# scripts for autoresize at first boot from cubian
2014-01-24 17:44:16 +01:00
cp $SRC /scripts/cubian-resize2fs $DEST /output/sdcard/bin/cubian-resize2fs
cp $SRC /scripts/cubian-firstrun $DEST /output/sdcard/bin/cubian-firstrun
2013-12-29 12:01:02 +01:00
2014-01-12 13:57:42 +01:00
# script to install to NAND
2014-01-22 11:47:48 +01:00
#cp $SRC/scripts/nand-install.sh $DEST/output/sdcard/root
#cp $SRC/bin/nand1-cubietruck-debian-boot.tgz $DEST/output/sdcard/root
2014-01-12 13:57:42 +01:00
2013-12-29 12:01:02 +01:00
# make it executable
2014-01-24 17:44:16 +01:00
#chroot $DEST/output/sdcard /bin/bash -c "chmod +x /etc/scripts/cubian-*"
chmod +x $DEST /output/sdcard/bin/cubian-*
2013-12-29 12:01:02 +01:00
# and startable on boot
2014-01-24 09:35:26 +01:00
echo cubian-firstrun > $DEST /output/sdcard/etc/rc.locale
#chroot $DEST/output/sdcard /bin/bash -c "update-rc.d cubian-firstrun defaults"
2014-01-22 11:47:48 +01:00
# install and configure locales for Germany
2014-01-24 17:44:16 +01:00
echo LANG = '$DEST_LANG' .UTF-8 > $DEST /output/sdcard/etc/default.conf
2014-01-22 11:47:48 +01:00
echo KEYMAP = de-latin1-nodeadkeys > $DEST /output/sdcard/etc/vconsole.conf
2014-01-26 09:15:13 +01:00
#use this command when System runs
# timedatectl set-timezone Europe/Berlin
#ln -s /usr/share/zoneinfo/Europe/Berlin $DEST/output/sdcard/etc/localtime
2014-01-22 11:47:48 +01:00
#chroot $DEST/output/sdcard /bin/bash -c "pacman -S locales"
2014-01-03 13:48:08 +01:00
# reconfigure locales
2014-01-22 11:47:48 +01:00
#echo -e $DEST_LANG'.UTF-8 UTF-8\n' > $DEST/output/sdcard/etc/locale.gen
#chroot $DEST/output/sdcard /bin/bash -c "locale-gen"
#echo -e 'LANG="'$DEST_LANG'.UTF-8"\nLANGUAGE="'$DEST_LANG':'$DEST_LANGUAGE'"\n' > $DEST/output/sdcard/etc/default/locale
#chroot $DEST/output/sdcard /bin/bash -c "export LANG=$DEST_LANG.UTF-8"
#chroot $DEST/output/sdcard /bin/bash -c "apt-get -qq -y install git hostapd dosfstools htop openssh-server ca-certificates module-init-tools dhcp3-client udev ifupdown iproute iputils-ping ntpdate ntp rsync usbutils uboot-envtools pciutils wireless-tools wpasupplicant procps libnl-dev parted cpufrequtils console-setup unzip bridge-utils"
#chroot $DEST/output/sdcard /bin/bash -c "apt-get -qq -y upgrade"
2013-12-29 12:01:02 +01:00
2014-01-26 09:15:13 +01:00
# configure MIN / MAX Speed for cpufrequtils change that with cpufrequ-set or with the /boot/config.fex
2014-01-24 17:44:16 +01:00
#sed -e 's/MIN_SPEED="0"/MIN_SPEED="480000"/g' -i $DEST/output/sdcard/etc/init.d/cpufrequtils
#sed -e 's/MAX_SPEED="0"/MAX_SPEED="1010000"/g' -i $DEST/output/sdcard/etc/init.d/cpufrequtils
2014-01-22 11:47:48 +01:00
#overclocked
#sed -e 's/MAX_SPEED="0"/MAX_SPEED="1200000"/g' -i $DEST/output/sdcard/etc/init.d/cpufrequtils
2014-01-24 17:44:16 +01:00
#sed -e 's/ondemand/interactive/g' -i $DEST/output/sdcard/etc/init.d/cpufrequtils
2014-01-02 11:33:32 +01:00
2014-01-22 11:47:48 +01:00
# i recommend you to change this urgently!!!
2014-01-01 19:22:46 +01:00
# set password to 1234
2014-01-26 09:15:13 +01:00
#echo 1234;echo 1234; | passwd root
2013-12-29 12:01:02 +01:00
# set hostname
echo cubie > $DEST /output/sdcard/etc/hostname
2014-01-26 09:15:13 +01:00
# load modules you may load them per sysctl
2014-01-26 10:21:37 +01:00
cat > $DEST /output/sdcard/etc/modules-load.d/cubieModules.conf <<EOT
2014-01-25 11:03:52 +01:00
hci_uart
gpio_sunxi
bcmdhd
2014-01-10 09:22:30 +01:00
#sunxi_gmac
2014-01-25 12:10:05 +01:00
2014-01-25 11:03:52 +01:00
EOT
2013-12-29 12:01:02 +01:00
2014-01-26 09:15:13 +01:00
# edit this to your personal needs/network configs take the ones from /etc/netctl/examples/ folder
2013-12-29 12:01:02 +01:00
# create interfaces configuration
2014-01-26 10:21:37 +01:00
cat > $DEST /output/sdcard/etc/netctl/interfaces/eth0 <<EOT
2014-01-10 09:22:30 +01:00
auto eth0
2013-12-29 12:01:02 +01:00
allow-hotplug eth0
iface eth0 inet dhcp
2014-01-22 11:47:48 +01:00
# hwaddress ether AE:50:30:27:5A:CF # change this
2014-01-13 21:50:47 +01:00
# pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838
2014-01-25 12:10:05 +01:00
2014-01-25 11:03:52 +01:00
EOT
2014-01-25 12:10:05 +01:00
2014-01-26 10:21:37 +01:00
cat > $DEST /output/sdcard/etc/netctl/interfaces/wlan0 <<EOT
2014-01-24 17:44:16 +01:00
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
2014-01-10 09:22:30 +01:00
# wpa-ssid SSID
# wpa-psk xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2013-12-29 12:01:02 +01:00
# to generate proper encrypted key: wpa_passphrase yourSSID yourpassword
2014-01-25 12:10:05 +01:00
EOT
2014-01-18 17:41:11 +01:00
# create interfaces if you want to have AP. /etc/modules must be: bcmdhd op_mode=2
2014-01-22 11:47:48 +01:00
#cat <<EOT >> $DEST/output/sdcard/etc/network/interfaces.hostapd
#auto lo br0
#iface lo inet loopback
2014-01-18 17:41:11 +01:00
2014-01-22 11:47:48 +01:00
#allow-hotplug eth0
#iface eth0 inet manual
2014-01-18 17:41:11 +01:00
2014-01-22 11:47:48 +01:00
#allow-hotplug wlan0
#iface wlan0 inet manual
2014-01-18 17:41:11 +01:00
2014-01-22 11:47:48 +01:00
#iface br0 inet dhcp
#bridge_ports eth0 wlan0
#EOT
2014-01-18 17:41:11 +01:00
2013-12-29 12:01:02 +01:00
# enable serial console (Debian/sysvinit way)
2014-01-24 17:44:16 +01:00
#echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> $DEST/output/sdcard/etc/inittab
2013-12-29 12:01:02 +01:00
2014-01-22 11:47:48 +01:00
#remove the preconfigured boot from the image and use the one we want
rm -rf $DEST /output/sdcard/boot/
mkdir $DEST /output/sdcard/boot/
2013-12-29 12:01:02 +01:00
cp $DEST /output/uEnv.txt $DEST /output/sdcard/boot/
cp $DEST /linux-sunxi/arch/arm/boot/uImage $DEST /output/sdcard/boot/
2014-01-15 18:03:53 +01:00
# copy proper bin file
2014-01-16 08:13:28 +01:00
if [ $DISPLAY = 4 ] ; then
2014-01-15 18:03:53 +01:00
cp $DEST /output/script-vga.bin $DEST /output/sdcard/boot/script.bin
else
cp $DEST /output/script-hdmi.bin $DEST /output/sdcard/boot/script.bin
fi
2013-12-29 12:01:02 +01:00
cp -R $DEST /linux-sunxi/output/lib/modules $DEST /output/sdcard/lib/
cp -R $DEST /linux-sunxi/output/lib/firmware/ $DEST /output/sdcard/lib/
2014-01-10 09:06:38 +01:00
# USB redirector tools http://www.incentivespro.com
cd $DEST
wget http://www.incentivespro.com/usb-redirector-linux-arm-eabi.tar.gz
tar xvfz usb-redirector-linux-arm-eabi.tar.gz
rm usb-redirector-linux-arm-eabi.tar.gz
cd $DEST /usb-redirector-linux-arm-eabi/files/modules/src/tusbd
make -j2 ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf- KERNELDIR = $DEST /linux-sunxi/
# configure USB redirector
sed -e 's/%INSTALLDIR_TAG%/\/usr\/local/g' $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd > $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd1
sed -e 's/%PIDFILE_TAG%/\/var\/run\/usbsrvd.pid/g' $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd1 > $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd
sed -e 's/%STUBNAME_TAG%/tusbd/g' $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd > $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd1
sed -e 's/%DAEMONNAME_TAG%/usbsrvd/g' $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd1 > $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd
chmod +x $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd
# copy to root
cp $DEST /usb-redirector-linux-arm-eabi/files/usb* $DEST /output/sdcard/usr/local/bin/
cp $DEST /usb-redirector-linux-arm-eabi/files/modules/src/tusbd/tusbd.ko $DEST /output/sdcard/usr/local/bin/
2014-01-25 11:03:52 +01:00
cp $DEST /usb-redirector-linux-arm-eabi/files/rc.usbsrvd $DEST /output/sdcard/etc/modules-load.d/
2014-01-10 15:06:23 +01:00
# started by default ----- update.rc rc.usbsrvd defaults
2014-01-25 11:03:52 +01:00
#chroot $DEST/output/sdcard /bin/bash -c "update-rc.d rc.usbsrvd defaults"
2014-01-10 09:06:38 +01:00
2014-01-18 17:41:11 +01:00
# hostapd from testing binary replace.
cd $DEST /output/sdcard/usr/sbin/
tar xvfz $SRC /bin/hostapd21.tgz
cp $SRC /config/hostapd.conf $DEST /output/sdcard/etc/
2014-01-02 11:33:32 +01:00
# sunxi-tools
cd $DEST /sunxi-tools
2014-01-06 13:17:16 +01:00
make clean && make -j2 'fex2bin' CC = arm-linux-gnueabihf-gcc && make -j2 'bin2fex' CC = arm-linux-gnueabihf-gcc && make -j2 'nand-part' CC = arm-linux-gnueabihf-gcc
2014-01-02 11:33:32 +01:00
cp fex2bin $DEST /output/sdcard/usr/bin/
cp bin2fex $DEST /output/sdcard/usr/bin/
2014-01-06 13:17:16 +01:00
cp nand-part $DEST /output/sdcard/usr/bin/
2014-01-01 17:40:05 +01:00
2013-12-29 12:01:02 +01:00
# cleanup
2014-01-08 19:31:48 +01:00
# unmount proc, sys and dev from chroot
umount $DEST /output/sdcard/dev/pts
umount $DEST /output/sdcard/dev
umount $DEST /output/sdcard/proc
umount $DEST /output/sdcard/sys
2013-12-29 12:01:02 +01:00
rm $DEST /output/sdcard/usr/bin/qemu-arm-static
# umount images
umount $DEST /output/sdcard/
2014-01-07 20:21:03 +01:00
losetup -d $LOOP1
losetup -d $LOOP0
2013-12-29 12:01:02 +01:00
# compress image
2014-01-01 17:12:16 +01:00
gzip $DEST /output/*.raw