arm-sdk

os build toolkit for various embedded devices
git clone https://git.parazyd.org/arm-sdk
Log | Files | Refs | Submodules | README | LICENSE

turbox-twister.sh (3817B)


      1 #!/usr/bin/env zsh
      2 # Copyright (c) 2016-2021 Ivan J. <parazyd@dyne.org>
      3 # This file is part of arm-sdk
      4 #
      5 # This source code is free software: you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as published by
      7 # the Free Software Foundation, either version 3 of the License, or
      8 # (at your option) any later version.
      9 #
     10 # This software is distributed in the hope that it will be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this source code. If not, see <http://www.gnu.org/licenses/>.
     17 
     18 ## kernel build script for the turbox twister a33 tablet
     19 ## https://leste.maemo.org/A33-TurboX-Twister
     20 
     21 ## settings & config
     22 vars+=(device_name arch size parted_type parted_boot parted_root bootfs inittab)
     23 vars+=(gitkernel gitbranch)
     24 arrs+=(custmodules)
     25 
     26 device_name="turbox-twister"
     27 arch="armhf"
     28 size=1891
     29 inittab=("T1:12345:respawn:/sbin/agetty -L ttyS0 115200 vt100")
     30 
     31 parted_type="dos"
     32 bootfs="ext4"
     33 rootfs="ext4"
     34 dos_boot="$bootfs 2048s 264191s"
     35 dos_root="$rootfs 264192s 100%"
     36 
     37 extra_packages+=()
     38 custmodules=()
     39 
     40 gitkernel="https://github.com/maemo-leste/lime2-linux"
     41 gitbranch="lime2-and-twister"
     42 
     43 
     44 prebuild() {
     45 	fn prebuild
     46 	req=(device_name)
     47 	ckreq || return 1
     48 
     49 	notice "executing $device_name prebuild"
     50 
     51 	copy-root-overlay
     52 
     53 	mkdir -p $R/tmp/kernels/$device_name
     54 }
     55 
     56 postbuild() {
     57 	fn postbuild
     58 	req=(uboot_configs device_name compiler)
     59 	ckreq || return 1
     60 
     61 	notice "executing $device_name postbuild"
     62 
     63 	notice "building u-boot"
     64 	mkdir -p $R/dist/u-boot
     65 	pushd $R/extra/u-boot
     66 		local board="q8_a33_tablet_1024x600_defconfig"
     67 		notice "building u-boot for $board"
     68 
     69 		make distclean
     70 		make \
     71 			$MAKEOPTS \
     72 			ARCH=arm \
     73 			CROSS_COMPILE=$compiler \
     74 				$board
     75 		make \
     76 			$MAKEOPTS \
     77 			ARCH=arm \
     78 			CROSS_COMPILE=$compiler || {
     79 				zerr
     80 				return 1
     81 			}
     82 
     83 		mv -v u-boot-sunxi-with-spl.bin $R/dist/u-boot/${board}.bin
     84 	popd
     85 
     86 	notice "creating boot.cmd"
     87 	cat <<EOF | sudo tee ${strapdir}/boot/boot.cmd
     88 setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 \${extra}
     89 load mmc 0:1 0x43000000 dtbs/\${fdtfile} || load mmc 0:1 0x43000000 boot/dtbs/\${fdtfile}
     90 load mmc 0:1 0x42000000 zImage || load mmc 0:1 0x42000000 boot/zImage
     91 bootz 0x42000000 - 0x43000000
     92 EOF
     93 
     94 	notice "creating u-boot script image"
     95 	sudo mkimage -A arm -T script -C none \
     96 		-d $strapdir/boot/boot.cmd $strapdir/boot/boot.scr || zerr
     97 
     98 
     99 	#notice "building mali"
    100 	#export CROSS_COMPILE=$compiler
    101 	#export KDIR="$R/tmp/kernels/$device_name/${device_name}-linux"
    102 	#clone-git "$sunxi_mali" "$R/tmp/kernels/${device_name}/sunxi-mali"
    103 	#pushd "$R/tmp/kernels/${device_name}/sunxi-mali"
    104 	#	git checkout -- .
    105 	#	git clean -xdf
    106 	#	./build.sh -r r6p2 -b || zerr
    107 	#	sudo cp mali.ko ${strapdir}/lib/modules/*/kernel/drivers/gpu
    108 	#popd
    109 
    110 	postbuild-clean
    111 }
    112 
    113 build_kernel_armhf() {
    114 	fn build_kernel_armhf
    115 	req=(R arch device_name gitkernel gitbranch MAKEOPTS)
    116 	req+=(strapdir)
    117 	ckreq || return 1
    118 
    119 	notice "building $arch kernel"
    120 
    121 	prebuild || zerr
    122 
    123 	get-kernel-sources
    124 	pushd $R/tmp/kernels/$device_name/${device_name}-linux
    125 		copy-kernel-config
    126 
    127 		# compile kernel and modules
    128 		make \
    129 			$MAKEOPTS \
    130 			ARCH=arm \
    131 			CROSS_COMPILE=$compiler \
    132 				zImage sun8i-a33-q8-tablet.dtb modules || zerr
    133 
    134 		# install kernel modules
    135 		sudo -E PATH="$PATH" \
    136 			make \
    137 				$MAKEOPTS \
    138 				ARCH=arm \
    139 				CROSS_COMPILE=$compiler \
    140 				INSTALL_MOD_PATH=$strapdir \
    141 					modules_install || zerr
    142 
    143 		sudo cp -v arch/arm/boot/zImage $strapdir/boot/ || zerr
    144 		sudo mkdir -p $strapdir/boot/dtbs
    145 		sudo cp -v arch/arm/boot/dts/sun8i-a33-q8-tablet.dtb $strapdir/boot/dtbs/ || zerr
    146 	popd
    147 
    148 	postbuild || zerr
    149 }