Skip to content

Commit 7a102f1

Browse files
authored
Merge pull request #96 from sixtyfourktec/l4re
L4re
2 parents eb7eba5 + c71099f commit 7a102f1

4 files changed

Lines changed: 234 additions & 0 deletions

File tree

classes/fiasco.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Generic recipe for building fiasco.
2+
#
3+
# Use it like this in your own recipes:
4+
#
5+
# inherit: [fiasco]
6+
#
7+
# checkoutSCM:
8+
# # our configuration:
9+
# - scm: import
10+
# url: src/l4re
11+
# dir: conf
12+
#
13+
# # fiasco:
14+
# - scm: git
15+
# url: ${GITHUB_MIRROR}/kernkonzept/fiasco.git
16+
# dir: fiasco
17+
#
18+
# buildScript: |
19+
# fiascoBuild $1/fiasco \
20+
# $1/conf/defconfig_fiasco
21+
#
22+
# packageScript: |
23+
# fiascoInstall $1
24+
25+
inherit: [pkg-config, make]
26+
27+
buildTools: [host-toolchain, target-toolchain, m4, flex, bison]
28+
buildVars: [CC, CXX, LD, CROSS_COMPILE]
29+
buildSetup: |
30+
# $1: source dir
31+
# $2: defconfig
32+
fiascoBuild()
33+
{
34+
# If this is the first run, create the build directory. However, delete
35+
# the default config, so it is updated below.
36+
test -e build || (make -C "$1" BUILDDIR=$PWD/build && rm $PWD/build/globalconfig.out)
37+
38+
# Is the defconfig a default config?
39+
DEF_CFG=$2
40+
if [[ -f "$1/src/templates/globalconfig.out.$2" ]] ; then
41+
DEF_CFG="$1/src/templates/globalconfig.out.$2"
42+
fi
43+
# check if the defconfig file exists
44+
if [[ ! -f "$DEF_CFG" ]]; then
45+
>&2 echo "Don't know how to use $DEF_CFG as kernel config!"
46+
false
47+
fi
48+
# check if the source file is newer than .config
49+
if [[ ! -f build/globalconfig.out || $DEF_CFG -nt build/globalconfig.out ]]; then
50+
# redo the .config file
51+
cp -u "$DEF_CFG" build/globalconfig.out
52+
makeParallel -C $PWD/build olddefconfig
53+
fi
54+
55+
makeParallel -C $PWD/build
56+
}
57+
58+
packageSetup: |
59+
# $1: build dir
60+
fiascoInstall()
61+
{
62+
cp -L "$1/build/fiasco" .
63+
}

classes/fiasco/menuconfig.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
inherit: [fiasco]
2+
3+
depends:
4+
- tools:
5+
target-toolchain: host-compat-toolchain
6+
depends:
7+
- libs::ncurses-dev
8+
9+
buildSetup: |
10+
# Calls the fiasco savedefconfig target
11+
#
12+
# Especially in the sandbox this can be tricky. Provide some convenience method.
13+
fiascoSavedefconfig()
14+
{
15+
makeParallel \
16+
HOSTCC="gcc" \
17+
savedefconfig
18+
}
19+
20+
# Calls the fiasco menuconfig target
21+
#
22+
# Especially in the sandbox this can be tricky. Provide some convenience method.
23+
fiascoMenuconfig()
24+
{
25+
NCDEP=${BOB_DEP_PATHS[libs::ncurses-dev]}/usr
26+
makeParallel \
27+
HOSTCC="gcc" \
28+
HOSTCFLAGS="-I${NCDEP}/include -DCURSES_LOC=\"<ncurses.h>\" -DLOCALE $(pkg-config --cflags ncurses)" \
29+
HOSTLDLIBS="-L${NCDEP}/lib $(pkg-config --libs ncurses)" \
30+
menuconfig
31+
# Always save a defconfig
32+
fiascoSavedefconfig
33+
}

classes/l4re.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
}

classes/l4re/menuconfig.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
inherit: [l4re]
2+
3+
depends:
4+
- tools:
5+
target-toolchain: host-compat-toolchain
6+
depends:
7+
- libs::ncurses-dev
8+
9+
buildSetup: |
10+
# Calls the L4Re savedefconfig target
11+
#
12+
# Especially in the sandbox this can be tricky. Provide some convenience method.
13+
l4reSavedefconfig()
14+
{
15+
makeParallel \
16+
HOSTCC="gcc" \
17+
savedefconfig
18+
}
19+
20+
# Calls the L4Re menuconfig target
21+
#
22+
# Especially in the sandbox this can be tricky. Provide some convenience method.
23+
l4reMenuconfig()
24+
{
25+
NCDEP=${BOB_DEP_PATHS[libs::ncurses-dev]}/usr
26+
makeParallel \
27+
HOSTCC="gcc" \
28+
HOSTCFLAGS="-I${NCDEP}/include -DCURSES_LOC=\"<ncurses.h>\" -DLOCALE $(pkg-config --cflags ncurses)" \
29+
HOSTLDLIBS="-L${NCDEP}/lib $(pkg-config --libs ncurses)" \
30+
menuconfig
31+
# Always save a defconfig
32+
l4reSavedefconfig
33+
}

0 commit comments

Comments
 (0)