#!/usr/bin/env zsh # Copyright (c) 2016-2017 Dyne.org Foundation # arm-sdk is written and maintained by Ivan J. # # This file is part of arm-sdk # # This source code is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this source code. If not, see . ## helper functions for arm-sdk get-kernel-sources() { fn get-kernel-sources req=(R device_name gitkernel gitbranch) ckreq || return 1 notice "grabbing kernel sources" if [[ $gitkernel = mainline ]]; then clone-git "$linuxmainline" "$R/tmp/kernels/$device_name/${device_name}-linux" else clone-git "$gitkernel" "$R/tmp/kernels/$device_name/${device_name}-linux" "$gitbranch" fi } get-kernel-firmware() { fn get-kernel-firmware req=(linuxfirmware R) ckreq || return 1 notice "grabbing latest linux-firmware" clone-git "$linuxfirmware" "$R/tmp/linux-firmware" } clone-git() { fn clone-git "$@" req=(giturl clonepath) local giturl="$1" local clonepath="$2" local gitbr="$3" ckreq || return 1 notice "grabbing $(basename $clonepath)" if [[ -d $clonepath ]]; then pushd $clonepath git pull popd else [[ -n $gitbr ]] && gitbr="$gitbr" || gitbr="master" git clone --depth 1 -b "$gitbr" "$giturl" "$clonepath" fi } copy-kernel-config() { fn copy-kernel-config req=(device_name) ckreq || return 1 notice "copying available kernel config" cp -f $R/boards/kernel-configs/${device_name}.config \ $R/tmp/kernels/$device_name/${device_name}-linux/.config } copy-root-overlay() { fn copy-root-overlay req=(strapdir device_name R) ckreq || return 1 [[ -d $R/extra/generic-root ]] && \ notice "copying generic-root" && \ sudo cp -rfv $R/extra/generic-root/* $strapdir [[ -d $R/extra/$device_name ]] && \ notice "copying ${device_name}-root" && \ sudo cp -rfv $R/extra/$device_name/* $strapdir return 0 } postbuild-clean() { fn postbuild-clean req=(qemu_bin strapdir) ckreq || return 1 cat </dev/null #!/bin/sh apt-get update # backports e2fsprogs because 4.x kernels apt-get --yes --force-yes -t jessie-backports install e2fsprogs apt-get --yes --force-yes upgrade apt-get --yes --force-yes autoremove #apt-get clean updatedb EOF chroot-script -d postbuild || zerr sudo rm -f $strapdir/$qemu_bin }