diff --git a/classes/fiasco.yaml b/classes/fiasco.yaml new file mode 100644 index 00000000..b7eb91a8 --- /dev/null +++ b/classes/fiasco.yaml @@ -0,0 +1,63 @@ +# Generic recipe for building fiasco. +# +# Use it like this in your own recipes: +# +# inherit: [fiasco] +# +# checkoutSCM: +# # our configuration: +# - scm: import +# url: src/l4re +# dir: conf +# +# # fiasco: +# - scm: git +# url: ${GITHUB_MIRROR}/kernkonzept/fiasco.git +# dir: fiasco +# +# buildScript: | +# fiascoBuild $1/fiasco \ +# $1/conf/defconfig_fiasco +# +# packageScript: | +# fiascoInstall $1 + +inherit: [pkg-config, make] + +buildTools: [host-toolchain, target-toolchain, m4, flex, bison] +buildVars: [CC, CXX, LD, CROSS_COMPILE] +buildSetup: | + # $1: source dir + # $2: defconfig + fiascoBuild() + { + # If this is the first run, create the build directory. However, delete + # the default config, so it is updated below. + test -e build || (make -C "$1" BUILDDIR=$PWD/build && rm $PWD/build/globalconfig.out) + + # Is the defconfig a default config? + DEF_CFG=$2 + if [[ -f "$1/src/templates/globalconfig.out.$2" ]] ; then + DEF_CFG="$1/src/templates/globalconfig.out.$2" + fi + # check if the defconfig file exists + if [[ ! -f "$DEF_CFG" ]]; then + >&2 echo "Don't know how to use $DEF_CFG as kernel config!" + false + fi + # check if the source file is newer than .config + if [[ ! -f build/globalconfig.out || $DEF_CFG -nt build/globalconfig.out ]]; then + # redo the .config file + cp -u "$DEF_CFG" build/globalconfig.out + makeParallel -C $PWD/build olddefconfig + fi + + makeParallel -C $PWD/build + } + +packageSetup: | + # $1: build dir + fiascoInstall() + { + cp -L "$1/build/fiasco" . + } diff --git a/classes/fiasco/menuconfig.yaml b/classes/fiasco/menuconfig.yaml new file mode 100644 index 00000000..e323c723 --- /dev/null +++ b/classes/fiasco/menuconfig.yaml @@ -0,0 +1,33 @@ +inherit: [fiasco] + +depends: + - tools: + target-toolchain: host-compat-toolchain + depends: + - libs::ncurses-dev + +buildSetup: | + # Calls the fiasco savedefconfig target + # + # Especially in the sandbox this can be tricky. Provide some convenience method. + fiascoSavedefconfig() + { + makeParallel \ + HOSTCC="gcc" \ + savedefconfig + } + + # Calls the fiasco menuconfig target + # + # Especially in the sandbox this can be tricky. Provide some convenience method. + fiascoMenuconfig() + { + NCDEP=${BOB_DEP_PATHS[libs::ncurses-dev]}/usr + makeParallel \ + HOSTCC="gcc" \ + HOSTCFLAGS="-I${NCDEP}/include -DCURSES_LOC=\"\" -DLOCALE $(pkg-config --cflags ncurses)" \ + HOSTLDLIBS="-L${NCDEP}/lib $(pkg-config --libs ncurses)" \ + menuconfig + # Always save a defconfig + fiascoSavedefconfig + } diff --git a/classes/l4re.yaml b/classes/l4re.yaml new file mode 100644 index 00000000..884ccb25 --- /dev/null +++ b/classes/l4re.yaml @@ -0,0 +1,105 @@ +# Generic recipe for building l4re. +# +# Use it like this in your own recipes: +# +# inherit: [l4re] +# +# depends: +# # add additional dependencies here, like linux kernels or external +# # device trees +# - fiasco +# +# checkoutSCM: +# # our configuration: +# - scm: import +# url: src/l4re +# dir: conf +# +# # l4re repositories we want to use +# - scm: git +# url: ${GITHUB_MIRROR}/kernkonzept/mk.git +# dir: l4re +# - scm: git +# url: ${GITHUB_MIRROR}/kernkonzept/bootstrap.git +# dir: l4re/pkg/bootstrap +# - ... +# +# buildSetup: | +# # Add additional paths to dependencies here: +# export MODULE_SEARCH_PATH+=:$1/conf +# buildScript: | +# l4reBuild $1/l4re \ +# $1/conf/defconfig_l4re \ +# pkg/bootstrap pkg/... ... +# +# l4reBuildImage $1/l4re \ +# uimage \ +# demo \ +# $1/conf/modules.list +# +# packageScript: | +# l4reInstall $1 \ +# bootstrap.uimage + +inherit: [pkg-config, make] + +depends: + - tools: + target-toolchain: host-compat-toolchain + depends: + - name: devel::dtc + use: [tools] + - name: bsp::uboot-tools + use: [tools] + +buildTools: [host-toolchain, target-toolchain, m4, flex, bison, dtc, uboot-tools] +buildVars: [CROSS_COMPILE] +buildSetup: | + # Add all dependencies to the l4re module search path + MODULE_SEARCH_PATH="" + for i in "$@" ; do + MODULE_SEARCH_PATH+=":$i" + done + export MODULE_SEARCH_PATH + + # $1: source dir + # $2: defconfig + # $3: targets (optional) + l4reBuild() + { + if [[ ! -e build/.bob-init-done ]] ; then + rm -rf $BOB_CWD/build + make -C $1 B=$BOB_CWD/build \ + DEFCONFIG="$2" + make -C $1 O=$BOB_CWD/build \ + olddefconfig + touch build/.bob-init-done + fi + + makeParallel -C $1 O=$BOB_CWD/build \ + ${3:-} + } + + # $1: source dir + # $2: image type + # $3: modules entry + # $4: modules list + l4reBuildImage() + { + # we may want to replace this with l4image in a separate step + makeParallel -C $1 O=$BOB_CWD/build \ + "$2" \ + E="$3" \ + MODULES_LIST="$4" \ + MODULE_SEARCH_PATH="$MODULE_SEARCH_PATH" + } + +packageSetup: | + # $1: build dir + # $2+: image name(s) + l4reInstall() + { + for i in ${@:2}; do + cp -L "$1/build/images/$i" . + done + } diff --git a/classes/l4re/menuconfig.yaml b/classes/l4re/menuconfig.yaml new file mode 100644 index 00000000..227a3dc2 --- /dev/null +++ b/classes/l4re/menuconfig.yaml @@ -0,0 +1,33 @@ +inherit: [l4re] + +depends: + - tools: + target-toolchain: host-compat-toolchain + depends: + - libs::ncurses-dev + +buildSetup: | + # Calls the L4Re savedefconfig target + # + # Especially in the sandbox this can be tricky. Provide some convenience method. + l4reSavedefconfig() + { + makeParallel \ + HOSTCC="gcc" \ + savedefconfig + } + + # Calls the L4Re menuconfig target + # + # Especially in the sandbox this can be tricky. Provide some convenience method. + l4reMenuconfig() + { + NCDEP=${BOB_DEP_PATHS[libs::ncurses-dev]}/usr + makeParallel \ + HOSTCC="gcc" \ + HOSTCFLAGS="-I${NCDEP}/include -DCURSES_LOC=\"\" -DLOCALE $(pkg-config --cflags ncurses)" \ + HOSTLDLIBS="-L${NCDEP}/lib $(pkg-config --libs ncurses)" \ + menuconfig + # Always save a defconfig + l4reSavedefconfig + }