From 19f74d36c96a9b7c378790305ff828486e678214 Mon Sep 17 00:00:00 2001 From: Andrey Miroshnikov Date: Sun, 10 Sep 2023 17:59:10 +0000 Subject: [PATCH] pypowersim_wrapper_common.h: Home path no longer hard-coded. chacha20/Makefile: Create bin dir if doesn't exist. --- crypto/chacha20/Makefile | 5 ++++- media/pypowersim_wrapper/pypowersim_wrapper_common.h | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crypto/chacha20/Makefile b/crypto/chacha20/Makefile index 0598b1cd..fa320be9 100644 --- a/crypto/chacha20/Makefile +++ b/crypto/chacha20/Makefile @@ -34,7 +34,10 @@ $(BINDIR)/%.bin: $(BINDIR)/%.elf $(CROSSOBJCOPY) -I elf64-little -O binary $< $@ .PHONY: all clean remove -all: ${TARGET} +all: ${BINDIR} ${TARGET} + +$(BINDIR): + mkdir -p ${BINDIR} $(TARGET): $(OBJECTS) $(SVP64OBJECTS) $(ELFFILES) $(BINFILES) $(CC) -o $@ $(OBJECTS) $(LDFLAGS) diff --git a/media/pypowersim_wrapper/pypowersim_wrapper_common.h b/media/pypowersim_wrapper/pypowersim_wrapper_common.h index e32c1eb5..0eaa861c 100644 --- a/media/pypowersim_wrapper/pypowersim_wrapper_common.h +++ b/media/pypowersim_wrapper/pypowersim_wrapper_common.h @@ -1,6 +1,8 @@ #include #include #include +#include +#include static const char* PLUGIN_NAME = "pypowersim"; static int python_initialized = 0; @@ -39,8 +41,15 @@ static pypowersim_state_t *pypowersim_prepare(void) { // Initialize Python C API Py_Initialize(); + // To construct directory based on username, need $HOME + char homeIsaDir[100]; + const char *homeDir = getenv("HOME"); // user specific - /home/[USER NAME] + strcat(homeIsaDir, homeDir); + strcat(homeIsaDir, "/src/openpower-isa/src/openpower/decoder/isa/"); + printf(homeIsaDir); + PyObject* sysPath = PySys_GetObject((char*)"path"); - PyObject* curDir = PyUnicode_FromString("/home/markos/src/openpower-isa/src/openpower/decoder/isa/"); + PyObject* curDir = PyUnicode_FromString(homeIsaDir); PyList_Append(sysPath, curDir); Py_DECREF(curDir); -- 2.30.2