arm-sdk

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

droid4.sh (2869B)


      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 Motorola DROID4
     19 
     20 ## settings & config
     21 vars+=(device_name arch size parted_type parted_boot parted_root bootfs inittab)
     22 vars+=(gitkernel gitbranch)
     23 arrs+=(custmodules)
     24 
     25 device_name="droid4"
     26 arch="armhf"
     27 size=1891
     28 inittab=("s0:12345:respawn:/sbin/agetty -L ttyS2 115200 vt100")
     29 
     30 parted_type="dos"
     31 bootfs="ext2"
     32 rootfs="ext4"
     33 dos_boot="$bootfs 8192s 270335s"
     34 dos_root="$rootfs 270336s 100%"
     35 
     36 extra_packages+=(firmware-ti-connectivity)
     37 custmodules=()
     38 
     39 #gitkernel="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
     40 #gitbranch="v4.16-rc1"
     41 gitkernel="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git"
     42 gitbranch="linux-4.14.y"
     43 
     44 
     45 prebuild() {
     46 	fn prebuild
     47 	req=(device_name strapdir)
     48 	ckreq || return 1
     49 
     50 	notice "executing $device_name prebuild"
     51 
     52 	mkdir -p $R/tmp/kernels/$device_name
     53 }
     54 
     55 postbuild() {
     56 	fn postbuild
     57 
     58 	notice "executing $device_name postbuild"
     59 
     60 	copy-root-overlay
     61 
     62 	if [[ -e "$strapdir/boot/boot/boot.cfg" ]]; then
     63 		sudo sed -e "s/@release@/${release}/" -i "$strapdir/boot/boot/boot.cfg"
     64 	fi
     65 }
     66 
     67 build_kernel_${arch}() {
     68 	fn build_kernel_${arch}
     69 	req=(R arch device_name gitkernel gitbranch MAKEOPTS)
     70 	req+=(strapdir)
     71 	req+=(loopdevice)
     72 	ckreq || return 1
     73 
     74 	notice "building $arch kernel"
     75 
     76 	prebuild || zerr
     77 
     78 	get-kernel-sources
     79 	pushd $R/tmp/kernels/$device_name/${device_name}-linux
     80 	git checkout -- .
     81 	copy-kernel-config
     82 
     83 	_patchdir="$R/extra/patches/linux-droid4-patches"
     84 	_patchset="$(find ${_patchdir} -name '*.patch' | sort)"
     85 	for i in "${=_patchset}"; do
     86 		patch -p1 < "$i"
     87 	done
     88 
     89 	# compile kernel and modules
     90 	make \
     91 		$MAKEOPTS \
     92 		ARCH=arm \
     93 		CROSS_COMPILE=$compiler \
     94 			zImage modules omap4-droid4-xt894.dtb || zerr
     95 	sudo mkdir -p "$strapdir/boot/boot/"
     96 	sudo cp -v arch/arm/boot/zImage "$strapdir/boot/boot" || zerr
     97 	sudo cp -v arch/arm/boot/dts/omap4-droid4-xt894.dtb "$strapdir/boot/boot" || zerr
     98 
     99 	# install kernel modules
    100 	sudo -E PATH="$PATH" \
    101 		make \
    102 			$MAKEOPTS \
    103 			ARCH=arm \
    104 			CROSS_COMPILE=$compiler \
    105 			INSTALL_MOD_PATH=$strapdir \
    106 			INSTALL_MOD_STRIP=1 \
    107 				modules_install || zerr
    108 	popd
    109 
    110 	postbuild || zerr
    111 }