droid3.sh (2678B)
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 DROID3 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="droid3" 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/stable/linux-stable.git" 40 gitbranch="linux-5.15.y" 41 42 43 prebuild() { 44 fn prebuild 45 req=(device_name strapdir) 46 ckreq || return 1 47 48 notice "executing $device_name prebuild" 49 50 mkdir -p $R/tmp/kernels/$device_name 51 } 52 53 postbuild() { 54 fn postbuild 55 56 notice "executing $device_name postbuild" 57 58 copy-root-overlay 59 60 if [[ -e "$strapdir/boot/boot/boot.cfg" ]]; then 61 sudo sed -e "s/@release@/${release}/" -i "$strapdir/boot/boot/boot.cfg" 62 fi 63 } 64 65 build_kernel_${arch}() { 66 fn build_kernel_${arch} 67 req=(R arch device_name gitkernel gitbranch MAKEOPTS) 68 req+=(strapdir) 69 req+=(loopdevice) 70 ckreq || return 1 71 72 notice "building $arch kernel" 73 74 prebuild || zerr 75 76 get-kernel-sources 77 pushd $R/tmp/kernels/$device_name/${device_name}-linux 78 git checkout -- . 79 80 # compile kernel and modules 81 make \ 82 $MAKEOPTS \ 83 ARCH=arm \ 84 CROSS_COMPILE=$compiler \ 85 omap2plus_defconfig || zerr 86 87 make \ 88 $MAKEOPTS \ 89 ARCH=arm \ 90 CROSS_COMPILE=$compiler \ 91 zImage modules omap4-droid3-xt862.dtb || zerr 92 93 sudo mkdir -p "$strapdir/boot/boot/" 94 sudo cp -v arch/arm/boot/zImage "$strapdir/boot/boot" || zerr 95 sudo cp -v arch/arm/boot/dts/omap4-droid3-xt862.dtb "$strapdir/boot/boot" || zerr 96 97 # install kernel modules 98 sudo -E PATH="$PATH" \ 99 make \ 100 $MAKEOPTS \ 101 ARCH=arm \ 102 CROSS_COMPILE=$compiler \ 103 INSTALL_MOD_PATH=$strapdir \ 104 INSTALL_MOD_STRIP=1 \ 105 modules_install || zerr 106 popd 107 108 postbuild || zerr 109 }