nokia-n900.sh (2691B)
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 Nokia N900 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="n900" 26 arch="armhf" 27 size=1891 28 inittab=("T0:23:respawn:/sbin/getty -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://github.com/maemo-leste/n9xx-linux/" 40 gitbranch="pvr-wip" 41 42 43 postbuild() { 44 fn postbuild 45 46 notice "executing $device_name postbuild" 47 48 copy-root-overlay 49 50 notice "building u-boot" 51 pushd "$R/extra/u-boot" 52 make distclean 53 make \ 54 $MAKEOPTS \ 55 ARCH=arm \ 56 CROSS_COMPILE=$compiler \ 57 nokia_rx51_defconfig 58 make \ 59 $MAKEOPTS \ 60 ARCH=arm \ 61 CROSS_COMPILE=$compiler || { 62 zerr 63 return 1 64 } 65 66 mv -v u-boot.img "$R/dist/n900-u-boot.img" 67 popd 68 } 69 70 build_kernel_${arch}() { 71 fn build_kernel_${arch} 72 req=(R arch device_name gitkernel gitbranch MAKEOPTS) 73 req+=(strapdir) 74 req+=(loopdevice) 75 ckreq || return 1 76 77 notice "building $arch kernel" 78 79 mkdir -p $R/tmp/kernels/$device_name 80 81 get-kernel-sources 82 pushd $R/tmp/kernels/$device_name/${device_name}-linux 83 #copy-kernel-config 84 make \ 85 $MAKEOPTS \ 86 ARCH=arm \ 87 CROSS_COMPILE=$compiler \ 88 rx51_defconfig || zerr 89 90 # compile kernel and modules 91 make \ 92 $MAKEOPTS \ 93 ARCH=arm \ 94 CROSS_COMPILE=$compiler \ 95 zImage modules omap3-n900.dtb || zerr 96 cat arch/arm/boot/zImage arch/arm/boot/dts/omap3-n900.dtb > zImage || 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 108 mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n zImage -d zImage uImage 109 sudo cp -v zImage uImage $strapdir/boot/ 110 popd 111 112 postbuild || zerr 113 }