|
| 1 | +# Generic recipe for building l4re. |
| 2 | +# |
| 3 | +# Use it like this in your own recipes: |
| 4 | +# |
| 5 | +# inherit: [l4re] |
| 6 | +# |
| 7 | +# depends: |
| 8 | +# # add additional dependencies here, like linux kernels or external |
| 9 | +# # device trees |
| 10 | +# - fiasco |
| 11 | +# |
| 12 | +# checkoutSCM: |
| 13 | +# # our configuration: |
| 14 | +# - scm: import |
| 15 | +# url: src/l4re |
| 16 | +# dir: conf |
| 17 | +# |
| 18 | +# # l4re repositories we want to use |
| 19 | +# - scm: git |
| 20 | +# url: ${GITHUB_MIRROR}/kernkonzept/mk.git |
| 21 | +# dir: l4re |
| 22 | +# - scm: git |
| 23 | +# url: ${GITHUB_MIRROR}/kernkonzept/bootstrap.git |
| 24 | +# dir: l4re/pkg/bootstrap |
| 25 | +# - ... |
| 26 | +# |
| 27 | +# buildSetup: | |
| 28 | +# # Add additional paths to dependencies here: |
| 29 | +# export MODULE_SEARCH_PATH+=:$1/conf |
| 30 | +# buildScript: | |
| 31 | +# l4reBuild $1/l4re \ |
| 32 | +# $1/conf/defconfig_l4re \ |
| 33 | +# pkg/bootstrap pkg/... ... |
| 34 | +# |
| 35 | +# l4reBuildImage $1/l4re \ |
| 36 | +# uimage \ |
| 37 | +# demo \ |
| 38 | +# $1/conf/modules.list |
| 39 | +# |
| 40 | +# packageScript: | |
| 41 | +# l4reInstall $1 \ |
| 42 | +# bootstrap.uimage |
| 43 | + |
| 44 | +inherit: [pkg-config, make] |
| 45 | + |
| 46 | +depends: |
| 47 | + - tools: |
| 48 | + target-toolchain: host-compat-toolchain |
| 49 | + depends: |
| 50 | + - name: devel::dtc |
| 51 | + use: [tools] |
| 52 | + - name: bsp::uboot-tools |
| 53 | + use: [tools] |
| 54 | + |
| 55 | +buildTools: [host-toolchain, target-toolchain, m4, flex, bison, dtc, uboot-tools] |
| 56 | +buildVars: [CROSS_COMPILE] |
| 57 | +buildSetup: | |
| 58 | + # Add all dependencies to the l4re module search path |
| 59 | + MODULE_SEARCH_PATH="" |
| 60 | + for i in "$@" ; do |
| 61 | + MODULE_SEARCH_PATH+=":$i" |
| 62 | + done |
| 63 | + export MODULE_SEARCH_PATH |
| 64 | +
|
| 65 | + # $1: source dir |
| 66 | + # $2: defconfig |
| 67 | + # $3: targets (optional) |
| 68 | + l4reBuild() |
| 69 | + { |
| 70 | + if [[ ! -e build/.bob-init-done ]] ; then |
| 71 | + rm -rf $BOB_CWD/build |
| 72 | + make -C $1 B=$BOB_CWD/build \ |
| 73 | + DEFCONFIG="$2" |
| 74 | + make -C $1 O=$BOB_CWD/build \ |
| 75 | + olddefconfig |
| 76 | + touch build/.bob-init-done |
| 77 | + fi |
| 78 | +
|
| 79 | + makeParallel -C $1 O=$BOB_CWD/build \ |
| 80 | + ${3:-} |
| 81 | + } |
| 82 | +
|
| 83 | + # $1: source dir |
| 84 | + # $2: image type |
| 85 | + # $3: modules entry |
| 86 | + # $4: modules list |
| 87 | + l4reBuildImage() |
| 88 | + { |
| 89 | + # we may want to replace this with l4image in a separate step |
| 90 | + makeParallel -C $1 O=$BOB_CWD/build \ |
| 91 | + "$2" \ |
| 92 | + E="$3" \ |
| 93 | + MODULES_LIST="$4" \ |
| 94 | + MODULE_SEARCH_PATH="$MODULE_SEARCH_PATH" |
| 95 | + } |
| 96 | +
|
| 97 | +packageSetup: | |
| 98 | + # $1: build dir |
| 99 | + # $2+: image name(s) |
| 100 | + l4reInstall() |
| 101 | + { |
| 102 | + for i in ${@:2}; do |
| 103 | + cp -L "$1/build/images/$i" . |
| 104 | + done |
| 105 | + } |
0 commit comments