Skip to content

Commit 46dedc0

Browse files
committed
run.py: improve feature handling for libraries/user-space
Signed-off-by: Reto Achermann <[email protected]>
1 parent 16432cb commit 46dedc0

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

kernel/run.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get_network_config(workers):
4949
config['tap{}'.format(2*i)] = {
5050
'mid': i,
5151
'mac': '56:b4:44:e9:62:d{:x}'.format(i),
52+
'ip' : f"172.31.0.1{i}"
5253
}
5354
return config
5455

@@ -215,8 +216,10 @@ def build_kernel(args):
215216
build_args = ['build', '--target', KERNEL_TARGET]
216217
if args.no_kfeatures:
217218
build_args += ["--no-default-features"]
219+
log(" - enable feature --no-default-features")
218220
for feature in args.kfeatures:
219221
build_args += ['--features', feature]
222+
log(" - enable feature {}".format(feature))
220223
build_args += CARGO_DEFAULT_ARGS
221224
build_args += CARGO_NOSTD_BUILD_ARGS
222225
if args.verbose:
@@ -233,6 +236,16 @@ def build_user_libraries(args):
233236
build_args += ["--features", "rumprt"]
234237
if args.nic == "virtio-net-pci":
235238
build_args += ["--features", "virtio"]
239+
log(" - enable feature virtio")
240+
241+
for featurelist in args.ufeatures:
242+
for feature in featurelist.split(',') :
243+
if ':' in feature:
244+
mod_part, feature_part = feature.split(':')
245+
if "libvibrio" == mod_part:
246+
log(" - enable feature {}".format(feature_part))
247+
build_args += ['--features', feature_part]
248+
236249
# else: use e1000 / wm0
237250
build_args += CARGO_DEFAULT_ARGS
238251
build_args += CARGO_NOSTD_BUILD_ARGS
@@ -259,18 +272,21 @@ def build_userspace(args):
259272
if not (USR_PATH / module).exists():
260273
log("User module {} not found, skipping.".format(module))
261274
continue
275+
log("build user-space module {}".format(module))
262276
with local.cwd(USR_PATH / module):
263277
with local.env(RUSTFLAGS=USER_RUSTFLAGS):
264278
with local.env(RUST_TARGET_PATH=USR_PATH.absolute()):
265279
build_args = build_args_default.copy()
266-
for feature in args.ufeatures:
267-
if ':' in feature:
268-
mod_part, feature_part = feature.split(':')
269-
if module == mod_part:
270-
build_args += ['--features', feature_part]
271-
else:
272-
build_args += ['--features', feature]
273-
log("Build user-module {}".format(module))
280+
for featurelist in args.ufeatures:
281+
for feature in featurelist.split(',') :
282+
if ':' in feature:
283+
mod_part, feature_part = feature.split(':')
284+
if module == mod_part:
285+
log(" - enable feature {}".format(feature_part))
286+
build_args += ['--features', feature_part]
287+
else:
288+
log(" - enable feature {}".format(feature))
289+
build_args += ['--features', feature]
274290
if args.verbose:
275291
print("cd {}".format(USR_PATH / module))
276292
print("RUSTFLAGS={} RUST_TARGET_PATH={} cargo ".format(

0 commit comments

Comments
 (0)