From 383318a4381375add624530005a803bd934ceec7 Mon Sep 17 00:00:00 2001 From: Minep Date: Sat, 27 Jul 2024 14:50:32 +0100 Subject: [PATCH] fix: gen_ksymtable does not work on non-English platform * the grep based method to access ELF class based on readelf output assume the English-language output * fix lunaconfig do not update the config tree when saving --- lunaix-os/arch/LConfig | 2 +- lunaix-os/kernel.mk | 2 +- lunaix-os/scripts/build-tools/lcfg/common.py | 2 +- lunaix-os/scripts/build-tools/luna_build.py | 2 ++ lunaix-os/scripts/gen_ksymtable.sh | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lunaix-os/arch/LConfig b/lunaix-os/arch/LConfig index 22f96c0..95403e3 100644 --- a/lunaix-os/arch/LConfig +++ b/lunaix-os/arch/LConfig @@ -13,7 +13,7 @@ def architecture_support(): default("i386") env_val = env("ARCH") - if env_val is not None: + if env_val: set_value(env_val) @Term diff --git a/lunaix-os/kernel.mk b/lunaix-os/kernel.mk index 69a16db..be10da2 100644 --- a/lunaix-os/kernel.mk +++ b/lunaix-os/kernel.mk @@ -45,7 +45,7 @@ $(tmp_kbin): $(klinking) $(ksrc_objs) $(ksymtable): $(tmp_kbin) $(call status_,KSYM,$@) - @scripts/gen_ksymtable.sh DdRrTtAGg $< > .lunaix_ksymtable.S + @ARCH=$(ARCH) scripts/gen_ksymtable.sh DdRrTtAGg $< > .lunaix_ksymtable.S @$(CC) $(CFLAGS) -c .lunaix_ksymtable.S -o $@ diff --git a/lunaix-os/scripts/build-tools/lcfg/common.py b/lunaix-os/scripts/build-tools/lcfg/common.py index 25e8d1b..383d1ec 100644 --- a/lunaix-os/scripts/build-tools/lcfg/common.py +++ b/lunaix-os/scripts/build-tools/lcfg/common.py @@ -114,7 +114,7 @@ class LConfigEnvironment(Renderable): super().__init__() self.__ws_path = path.abspath(workspace) - self.__exec_globl = globals() + self.__exec_globl = {} self.__eval_stack = [] self.__lc_modules = [] self.__config_val = {} diff --git a/lunaix-os/scripts/build-tools/luna_build.py b/lunaix-os/scripts/build-tools/luna_build.py index f5893c6..e3c6908 100755 --- a/lunaix-os/scripts/build-tools/luna_build.py +++ b/lunaix-os/scripts/build-tools/luna_build.py @@ -97,6 +97,8 @@ def main(): do_config(opts, lcfg_env) else: print("No configuration file detected, skipping...") + + lcfg_env.update() lcfg_env.save(opts.config_save) lcfg_env.export() else: diff --git a/lunaix-os/scripts/gen_ksymtable.sh b/lunaix-os/scripts/gen_ksymtable.sh index 1f974bd..748678e 100755 --- a/lunaix-os/scripts/gen_ksymtable.sh +++ b/lunaix-os/scripts/gen_ksymtable.sh @@ -4,13 +4,13 @@ sym_types=$1 bin=$2 nm_out=$(nm -nfbsd "$bin") -class_info=$(readelf -h "$bin" | grep 'Class:' | awk '{print $2}') +# class_info=$(readelf -h "$bin" | grep 'Class:' | awk '{print $2}') allsyms=($nm_out) allsyms_len=${#allsyms[@]} dtype="4byte" -if [ "$class_info" == 'ELF64' ]; then +if [ "$ARCH" == 'x86_64' ]; then dtype="8byte" fi -- 2.27.0