tadd prebuild and postbuild at kernel - arm-sdk - os build toolkit for various embedded devices
 (HTM) git clone https://git.parazyd.org/arm-sdk
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 397332e937352835ab8db0cac87d1ff61693f90a
 (DIR) parent 9a257e450cb0715a6405ddbeb1b1b4bc3758dac4
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Fri, 30 Sep 2016 10:50:36 +0200
       
       add prebuild and postbuild at kernel
       
       Diffstat:
         M boards/example.sh                   |      18 ++++++++++++++++++
         M boards/raspberry-pi.sh              |      35 ++++++++++++++++++++++++++++++-
       
       2 files changed, 52 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/boards/example.sh b/boards/example.sh
       t@@ -46,6 +46,20 @@ custmodules=() # add the snd module here perhaps
        gitkernel="https://github.com/raspberrypi/linux.git"
        gitbranch="rpi-4.4.y"
        
       +## things you need to do before building the kernel
       +prebuild() {
       +        fn prebuild
       +        notice "executing $device_name prebuild"
       +        return 0
       +}
       +
       +## things you need to do after building the kernel
       +postbuild() {
       +        fn postbuild
       +        notice "executing $device_name postbuild"
       +        return 0
       +}
       +
        ## kernel build function
        build_kernel_armhf() {
                fn build_kernel_armhf
       t@@ -53,6 +67,8 @@ build_kernel_armhf() {
                req+=(workdir strapdir)
                ckreq || return 1
        
       +        prebuild
       +
                notice "building $arch kernel"
        
                act "grabbing kernel sources"
       t@@ -73,4 +89,6 @@ are
                sudo rm -rf $strapdir/lib/firmware
                get-kernel-firmware
                sudo cp -ra $R/tmp/linux-firmware $strapdir/lib/firmware
       +
       +        postbuild
        }
 (DIR) diff --git a/boards/raspberry-pi.sh b/boards/raspberry-pi.sh
       t@@ -20,7 +20,7 @@
        ## kernel build script for Raspberry Pi 2/3 boards
        
        ## settings & config
       -vars+=(device_name arch size parted_boot parted_root inittab)
       +vars+=(device_name arch size parted_type parted_boot parted_root inittab)
        vars+=(gitkernel gitbranch rpifirmware)
        arrs+=(custmodules extra_packages)
        
       t@@ -29,6 +29,7 @@ arch="armhf"
        size=1337
        inittab="T0:23:respawn:/sbin/agetty -L ttyAMA0 115200 vt100"
        
       +parted_type="dos"
        parted_boot="fat32 0 64"
        parted_root="ext4 64 -1"
        
       t@@ -39,12 +40,42 @@ gitkernel="https://github.com/raspberrypi/linux.git"
        gitbranch="rpi-4.4.y"
        rpifirmware="https://github.com/raspberrypi/firmware.git"
        
       +prebuild() {
       +        fn prebuild
       +        req=(device_name strapdir)
       +        ckreq || return 1
       +
       +        notice "executing $device_name prebuild"
       +
       +        ## fstab
       +        cat <<EOF | sudo tee ${strapdir}/etc/fstab
       +## <file system>  <mount point> <type> <options>           <dump><pass>
       +## proc
       +proc              /proc         proc   nodev,noexec,nosuid    0    0
       +
       +## rootfs
       +/dev/mmcblk0p2    /             ext4   errors=remount-ro      0    1
       +
       +## bootfs
       +/dev/mmcblk0p1    /boot         vfat   noauto                 0    0
       +EOF
       +}
       +
       +postbuild() {
       +        fn postbuild
       +
       +        notice "executing $device_name postbuild"
       +        return 0
       +}
       +
        build_kernel_armhf() {
                fn build_kernel_armhf
                req=(R arch device_name gitkernel gitbranch MAKEOPTS rpifirmware)
                req+=(workdir strapdir)
                ckreq || return 1
        
       +        prebuild || zerr
       +
                notice "building $arch kernel"
        
                act "grabbing kernel sources"
       t@@ -97,4 +128,6 @@ EOF
                sudo mkdir -p $strapdir/lib/firmware/brcm
                sudo cp -v $R/extra/rpi3/brcmfmac43430-sdio.txt $strapdir/lib/firmware/brcm/
                sudo cp -v $R/extra/rpi3/brcmfmac43430-sdio.bin $strapdir/lib/firmware/brcm/
       +
       +        postbuild || zerr
        }