|
@@ -5,6 +5,7 @@
|
|
|
######################
|
|
|
|
|
|
set -e
|
|
|
+set -x
|
|
|
|
|
|
show_usage() {
|
|
|
cat <<EOF
|
|
@@ -14,20 +15,33 @@ cat <<EOF
|
|
|
|
|
|
# OPTIONS
|
|
|
|
|
|
- -o offline mode (mandatory)
|
|
|
- -t olinux type (a10lime, a20lime, a20lime2, a20micro) (default: a20lime)
|
|
|
+ -o offline mode (mandatory)
|
|
|
+ -b olinux board (a10lime, a20lime, a20lime2, a20micro) (default: a20lime)
|
|
|
+ -t number of thread (default: 2)
|
|
|
+ -l change linux boot logo
|
|
|
|
|
|
EOF
|
|
|
exit 1
|
|
|
}
|
|
|
|
|
|
-while getopts ":ot:" opt; do
|
|
|
+
|
|
|
+THREADS=2
|
|
|
+MAINTAINER="Emile"
|
|
|
+MAINTAINERMAIL="emile@bleuchtang.fr"
|
|
|
+
|
|
|
+while getopts ":ob:t:l" opt; do
|
|
|
case $opt in
|
|
|
o)
|
|
|
- offline=$OPTARG
|
|
|
+ OFFLINE=yes
|
|
|
+ ;;
|
|
|
+ b)
|
|
|
+ BOARD=$OPTARG
|
|
|
;;
|
|
|
t)
|
|
|
- olinux=$OPTARG
|
|
|
+ THREADS=$OPTARG
|
|
|
+ ;;
|
|
|
+ l)
|
|
|
+ LOGO=yes
|
|
|
;;
|
|
|
\?)
|
|
|
show_usage
|
|
@@ -35,58 +49,58 @@ while getopts ":ot:" opt; do
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
+source /olinux/config_board.sh
|
|
|
+
|
|
|
clone_or_pull (){
|
|
|
project=$1
|
|
|
repo=$2
|
|
|
name=$(echo $project | sed 's/.git$//')
|
|
|
- if [ "$offline" ] ; then
|
|
|
- cd /olinux/sunxi/$name/ && make clean
|
|
|
- return 0
|
|
|
+ if [ "$OFFLINE" ] ; then
|
|
|
+ if [ -f /olinux/sunxi/$name/Makefile ] ; then
|
|
|
+ cd /olinux/sunxi/$name/ && make clean && git checkout .
|
|
|
+ return 0
|
|
|
+ else
|
|
|
+ return 0
|
|
|
+ fi
|
|
|
fi
|
|
|
if [ -d /olinux/sunxi/$name/ ] ; then
|
|
|
- cd /olinux/sunxi/$name/ && make clean && git pull --depth 1
|
|
|
+ if [ -f /olinux/sunxi/$name/Makefile ] ; then
|
|
|
+ cd /olinux/sunxi/$name/ && make clean && git checkout . && git pull
|
|
|
+ else
|
|
|
+ cd /olinux/sunxi/$name/ && git checkout . && git pull
|
|
|
+ fi
|
|
|
else
|
|
|
- git clone --depth 1 $repo/$project /olinux/sunxi/$name/
|
|
|
+ git clone $repo/$project /olinux/sunxi/$name/
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
-if [ "$olinux" = "a20lime2" ] ; then
|
|
|
- u_boot_config="A20-OLinuXino-Lime2_defconfig"
|
|
|
- sunxi_board_config="a20/a20-olinuxino_lime2.fex"
|
|
|
- kernel_defconfig="a20_defconfig"
|
|
|
-elif [ "$olinux" = "a20micro" ] ; then
|
|
|
- u_boot_config="A20-OLinuXino_MICRO_defconfig"
|
|
|
- sunxi_board_config="a20/a20-olinuxino_micro.fex"
|
|
|
- kernel_defconfig="a20_defconfig"
|
|
|
-elif [ "$olinux" = "a10lime" ] ; then
|
|
|
- u_boot_config="A10-OLinuXino-Lime_defconfig"
|
|
|
- sunxi_board_config="a10/a10-olinuxino-lime.fex"
|
|
|
- kernel_defconfig="a10_defconfig"
|
|
|
-else
|
|
|
- u_boot_config="A20-OLinuXino-Lime_defconfig"
|
|
|
- sunxi_board_config="a20/a20-olinuxino_lime.fex"
|
|
|
- kernel_defconfig="a20_defconfig"
|
|
|
+mkdir -p /olinux/sunxi/
|
|
|
+
|
|
|
+## Sunxi u-boot
|
|
|
+clone_or_pull u-boot git://git.denx.de
|
|
|
+cd /olinux/sunxi/u-boot/
|
|
|
+make $u_boot_config ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
|
|
|
+if [ "$LOGO" ] ; then
|
|
|
+ cp /olinux/logo/LDN_logo.bmp /olinux/sunxi/u-boot/tools/logos/denx.bmp
|
|
|
+ sed -i -e 's/#define CONFIG_VIDEO_LOGO/#define CONFIG_VIDEO_LOGO\n#define CONFIG_VIDEO_BMP_LOGO/' /olinux/sunxi/u-boot/include/configs/sunxi-common.h
|
|
|
fi
|
|
|
+make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
|
|
|
|
|
|
-mkdir -p /olinux/sunxi/
|
|
|
+# Linux kernel
|
|
|
+clone_or_pull linux.git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds
|
|
|
+cd /olinux/sunxi/linux/
|
|
|
+# igorpecovnik patch for debian package
|
|
|
+patch -p1 < /olinux/patch/packaging-next.patch
|
|
|
+cp /olinux/linux-sunxi.config /olinux/sunxi/linux/.config
|
|
|
+if [ "$LOGO" ] ; then
|
|
|
+ cp /olinux/logo/LDN_logo.ppm /olinux/sunxi/linux/drivers/video/logo/logo_linux_clut224.ppm
|
|
|
+fi
|
|
|
+#make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig
|
|
|
+#make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
|
|
|
+make -j${THREADS} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- all zImage
|
|
|
+# Install device tree blobs in separate package, link zImage to kernel image script
|
|
|
+rm -f /olinux/sunxi/*.deb
|
|
|
+make -j1 deb-pkg KBUILD_DEBARCH=armhf ARCH=arm DEBFULLNAME="$MAINTAINER" DEBEMAIL="$MAINTAINERMAIL" CROSS_COMPILE=arm-linux-gnueabihf-
|
|
|
|
|
|
-# Sunxi u-boot
|
|
|
-#clone_or_pull u-boot-sunxi
|
|
|
-clone_or_pull u-boot.git git://git.denx.de
|
|
|
-cd /olinux/sunxi/u-boot && make CROSS_COMPILE=arm-linux-gnueabihf $u_boot_config && make CROSS_COMPILE=arm-linux-gnueabihf-
|
|
|
-
|
|
|
-# Sunxi kernel
|
|
|
-clone_or_pull linux-sunxi.git https://github.com/linux-sunxi
|
|
|
-cp /olinux/$kernel_defconfig /olinux/sunxi/linux-sunxi/arch/arm/configs/.
|
|
|
-cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm $kernel_defconfig
|
|
|
-cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 uImage
|
|
|
-cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 INSTALL_MOD_PATH=out modules
|
|
|
-cd /olinux/sunxi/linux-sunxi/ && make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 INSTALL_MOD_PATH=out modules_install
|
|
|
-
|
|
|
-# Sunxi board configs
|
|
|
-clone_or_pull sunxi-boards.git https://github.com/linux-sunxi
|
|
|
-# Sunxi tools
|
|
|
-clone_or_pull sunxi-tools.git https://github.com/linux-sunxi
|
|
|
-cd /olinux/sunxi/sunxi-tools/ && make
|
|
|
-cd /olinux/sunxi/ && rm -f script.bin && ./sunxi-tools/fex2bin sunxi-boards/sys_config/$sunxi_board_config script.bin
|
|
|
-cd /olinux/sunxi/ && chmod +x script.bin
|
|
|
+rm -rf /olinux/sunxi/config/boot.scr
|
|
|
+mkimage -C none -A arm -T script -d /olinux/boot.cmd /olinux/sunxi/boot.scr
|