arm-sdk

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

nokia-n950.sh (2530B)


      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 N950
     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="n950"
     26 arch="armhf"
     27 size=1337
     28 
     29 parted_type="dos"
     30 bootfs="none"
     31 rootfs="ext4"
     32 dos_boot="fat32 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/stable/linux-stable.git"
     39 gitbranch="linux-4.16.y"
     40 
     41 postbuild() {
     42 	fn postbuild
     43 
     44 	notice "executing $device_name postbuild"
     45 
     46 	copy-root-overlay
     47 }
     48 
     49 build_kernel_${arch}() {
     50 	fn build_kernel_${arch}
     51 	req=(R arch device_name gitkernel gitbranch MAKEOPTS)
     52 	req+=(strapdir)
     53 	req+=(loopdevice)
     54 	ckreq || return 1
     55 
     56 	notice "building $arch kernel"
     57 
     58 	mkdir -p $R/tmp/kernels/$device_name
     59 
     60 	get-kernel-sources
     61 	pushd $R/tmp/kernels/$device_name/${device_name}-linux
     62 	git checkout -- .
     63 	copy-kernel-config
     64 
     65 	notice "applying patches"
     66 	_patchdir="$R/extra/patches/linux-n950-patches"
     67 	_patchset="$(find ${_patchdir} -name '*.patch' | sort)"
     68 	for i in "${=_patchset}"; do
     69 		patch -p1 < "$i"
     70 	done
     71 
     72 	# Atmel maXTouch configuration
     73 	cp $_patchdir/RM-680_Himalaya_AUO_V1_1.raw firmware/maxtouch.cfg
     74 
     75 	# remove "-dirty" from kernel version tag
     76 	touch .scmversion
     77 
     78 	# compile kernel and modules
     79 	make \
     80 		$MAKEOPTS \
     81 		ARCH=arm \
     82 		CROSS_COMPILE=$compiler \
     83 			zImage modules omap3-n950.dtb || zerr
     84 	cat arch/arm/boot/zImage arch/arm/boot/dts/omap3-n950.dtb > zImage || zerr
     85 
     86 	# install kernel modules
     87 	sudo -E PATH="$PATH" \
     88 		make \
     89 			$MAKEOPTS \
     90 			ARCH=arm \
     91 			CROSS_COMPILE=$compiler \
     92 			INSTALL_MOD_PATH=$strapdir \
     93 			INSTALL_MOD_STRIP=1 \
     94 				modules_install || zerr
     95 	sudo cp -v zImage $strapdir/boot
     96 	popd
     97 
     98 	postbuild || zerr
     99 }