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