Skip to content

L4re #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 5, 2025
Merged

L4re #96

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions classes/fiasco.yaml
Original file line number Diff line number Diff line change
@@ -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" .
}
33 changes: 33 additions & 0 deletions classes/fiasco/menuconfig.yaml
Original file line number Diff line number Diff line change
@@ -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=\"<ncurses.h>\" -DLOCALE $(pkg-config --cflags ncurses)" \
HOSTLDLIBS="-L${NCDEP}/lib $(pkg-config --libs ncurses)" \
menuconfig
# Always save a defconfig
fiascoSavedefconfig
}
105 changes: 105 additions & 0 deletions classes/l4re.yaml
Original file line number Diff line number Diff line change
@@ -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
}
33 changes: 33 additions & 0 deletions classes/l4re/menuconfig.yaml
Original file line number Diff line number Diff line change
@@ -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=\"<ncurses.h>\" -DLOCALE $(pkg-config --cflags ncurses)" \
HOSTLDLIBS="-L${NCDEP}/lib $(pkg-config --libs ncurses)" \
menuconfig
# Always save a defconfig
l4reSavedefconfig
}