diff --git a/.github/actions/phoenix-build/action.yml b/.github/actions/phoenix-build/action.yml index 3028c114..854325bf 100644 --- a/.github/actions/phoenix-build/action.yml +++ b/.github/actions/phoenix-build/action.yml @@ -33,7 +33,7 @@ inputs: # action runner runs: using: 'docker' - image: 'ghcr.io/phoenix-rtos/build' + image: 'docker://phoenixrtosbadochov/build-shared:squash_gcc-14.2' env: CONSOLE: 'serial' DEBUG: '1' diff --git a/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh b/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh index 7e2508a9..584f5d55 100644 --- a/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh +++ b/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh @@ -7,4 +7,5 @@ W /sbin/dummyfs -m /var -D W /sbin/dummyfs -m /tmp -D X /sbin/lwip enet:0x02188000:150:PHY:0.2:irq:-5:/dev/gpio5 enet:0x020b4000:152:no-mdio:PHY:0.1:irq:-6:/dev/gpio5 X /bin/posixsrv +W /bin/ldconfig X /bin/psh diff --git a/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh b/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh index 75ebe493..49b710ec 100755 --- a/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh +++ b/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh @@ -5,4 +5,5 @@ W /bin/bind devfs /dev W /sbin/dummyfs -m /tmp -D X /bin/posixsrv T /dev/console +W /bin/ldconfig X /linuxrc diff --git a/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh b/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh index 55b8f507..d225120d 100644 --- a/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh +++ b/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh @@ -4,4 +4,5 @@ export HOME=/root W /bin/bind devfs /dev W /sbin/dummyfs -m /tmp -D X /bin/posixsrv +W /bin/ldconfig X /bin/psh diff --git a/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh b/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh index 803b70d7..74237c7f 100755 --- a/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh +++ b/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh @@ -6,4 +6,5 @@ W /sbin/dummyfs -m /tmp -D X /bin/posixsrv X /sbin/lwip rtl:0x18:11 T /dev/console +W /bin/ldconfig X /bin/psh diff --git a/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh b/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh index 55b8f507..d225120d 100644 --- a/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh +++ b/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh @@ -4,4 +4,5 @@ export HOME=/root W /bin/bind devfs /dev W /sbin/dummyfs -m /tmp -D X /bin/posixsrv +W /bin/ldconfig X /bin/psh diff --git a/_projects/sparcv8leon3-generic-qemu/rootfs-overlay/etc/rc.psh b/_projects/sparcv8leon3-generic-qemu/rootfs-overlay/etc/rc.psh new file mode 100644 index 00000000..6a81cbd8 --- /dev/null +++ b/_projects/sparcv8leon3-generic-qemu/rootfs-overlay/etc/rc.psh @@ -0,0 +1,6 @@ +:{}: +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +export HOME=/root +W /bin/bind devfs /dev +X /bin/posixsrv +X /bin/psh diff --git a/_user/dlopen/Makefile b/_user/dlopen/Makefile new file mode 100644 index 00000000..90ccde7f --- /dev/null +++ b/_user/dlopen/Makefile @@ -0,0 +1,20 @@ +# +# Makefile for user application +# +# Copyright 2024 Phoenix Systems +# +ifeq ($(HAVE_SHLIB), y) + +NAME := libhello +LOCAL_HEADERS := hello.h +LOCAL_SRCS := hello.c + +include $(shared-lib.mk) + + +NAME := dlopen +LOCAL_SRCS := main.c + +include $(binary-dyn.mk) + +endif diff --git a/_user/dlopen/hello.c b/_user/dlopen/hello.c new file mode 100644 index 00000000..bd7767f0 --- /dev/null +++ b/_user/dlopen/hello.c @@ -0,0 +1,24 @@ +/* + * Phoenix-RTOS + * + * dlopen + * + * Example of user application using dlopen. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include "hello.h" + +#include + + +int hello(void) +{ + return printf("Hello shared world!\n"); +} diff --git a/_user/dlopen/hello.h b/_user/dlopen/hello.h new file mode 100644 index 00000000..7637be1f --- /dev/null +++ b/_user/dlopen/hello.h @@ -0,0 +1,21 @@ +/* + * Phoenix-RTOS + * + * dlopen + * + * Example of user application using dlopen. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#ifndef _USER_DLOPEN_DYN_H_ +#define _USER_DLOPEN_DYN_H_ + +int hello(void); + +#endif diff --git a/_user/dlopen/main.c b/_user/dlopen/main.c new file mode 100644 index 00000000..0b14f7c2 --- /dev/null +++ b/_user/dlopen/main.c @@ -0,0 +1,40 @@ +/* + * Phoenix-RTOS + * + * dlopen + * + * Example of user application using dlopen. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include +#include +#include +#include + +int main(void) +{ + void *handle = dlopen("/usr/lib/libhello.so", RTLD_LAZY); + if (handle == NULL) { + printf("%s\n", dlerror()); + return 1; + } + int (*hello)(void) = (int (*)(void))dlsym(handle, "hello"); + if (hello == NULL) { + printf("%s\n", dlerror()); + (void)dlclose(handle); + return 1; + } + + hello(); + + (void)dlclose(handle); + + return 0; +} diff --git a/_user/sharedlib/Makefile b/_user/sharedlib/Makefile new file mode 100644 index 00000000..8adb4b7f --- /dev/null +++ b/_user/sharedlib/Makefile @@ -0,0 +1,21 @@ +# +# Makefile for user application +# +# Copyright 2024 Phoenix Systems +# +ifeq ($(HAVE_SHLIB), y) + +NAME := libdyn +LOCAL_HEADERS := dyn.h +LOCAL_SRCS := dyn.c + +include $(shared-lib.mk) + + +NAME := sharedlib +LOCAL_SRCS := main.c +DEP_LIBS_SHARED := libdyn + +include $(binary-dyn.mk) + +endif diff --git a/_user/sharedlib/dyn.c b/_user/sharedlib/dyn.c new file mode 100644 index 00000000..281f0321 --- /dev/null +++ b/_user/sharedlib/dyn.c @@ -0,0 +1,25 @@ +/* + * Phoenix-RTOS + * + * sharedlib + * + * Example of user application using shared libraries. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include "dyn.h" + + +extern void *_DYNAMIC; + + +void *dyn(void) +{ + return &_DYNAMIC; +} diff --git a/_user/sharedlib/dyn.h b/_user/sharedlib/dyn.h new file mode 100644 index 00000000..02ce4ed7 --- /dev/null +++ b/_user/sharedlib/dyn.h @@ -0,0 +1,22 @@ +/* + * Phoenix-RTOS + * + * sharedlib + * + * Example of user application using shared libraries. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + + +#ifndef _USER_SHAREDLIB_DYN_H_ +#define _USER_SHAREDLIB_DYN_H_ + +void *dyn(void); + +#endif diff --git a/_user/sharedlib/main.c b/_user/sharedlib/main.c new file mode 100644 index 00000000..904214b4 --- /dev/null +++ b/_user/sharedlib/main.c @@ -0,0 +1,25 @@ +/* + * Phoenix-RTOS + * + * sharedlib + * + * Example of user application using shared libraries. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include + +#include "dyn.h" + +int main(void) +{ + printf("Dynamic section pointer %p\n", dyn()); + + return 0; +} diff --git a/docker-build.sh b/docker-build.sh index 78641450..ef284fae 100755 --- a/docker-build.sh +++ b/docker-build.sh @@ -1,6 +1,6 @@ #!/bin/bash -DOCKER_IMG_NAME=phoenixrtos/build +DOCKER_IMG_NAME=docker://phoenixrtosbadochov/build-shared:squash_gcc-14.2 if [ -e .docker_build_img ]; then DOCKER_IMG_NAME="$(cat .docker_build_img)" fi diff --git a/libphoenix b/libphoenix index 50733954..6f49a088 160000 --- a/libphoenix +++ b/libphoenix @@ -1 +1 @@ -Subproject commit 50733954825ed19e7b17380ee2990c33ee2859fa +Subproject commit 6f49a0880123fc1bb5de426426b8b7b7465c2aa9 diff --git a/phoenix-rtos-build b/phoenix-rtos-build index 4183f39e..a71f5a58 160000 --- a/phoenix-rtos-build +++ b/phoenix-rtos-build @@ -1 +1 @@ -Subproject commit 4183f39eed524f3845fe74a6458fbc24e1b17275 +Subproject commit a71f5a589baad2a06c0eedbc3c5ab91336aac277 diff --git a/phoenix-rtos-devices b/phoenix-rtos-devices index 10cca0a5..7a647e23 160000 --- a/phoenix-rtos-devices +++ b/phoenix-rtos-devices @@ -1 +1 @@ -Subproject commit 10cca0a5897756243886ad235ea7ef2daf8735dc +Subproject commit 7a647e23113eaf895f5bcd944008f540b124faea diff --git a/phoenix-rtos-filesystems b/phoenix-rtos-filesystems index 15331888..ffe6d596 160000 --- a/phoenix-rtos-filesystems +++ b/phoenix-rtos-filesystems @@ -1 +1 @@ -Subproject commit 153318889e476d3671738cd31fb42f4088cb7cc2 +Subproject commit ffe6d596549b46ae1e4c0d3ff75736dd8944a618 diff --git a/phoenix-rtos-kernel b/phoenix-rtos-kernel index a1a6787a..3caf5fd0 160000 --- a/phoenix-rtos-kernel +++ b/phoenix-rtos-kernel @@ -1 +1 @@ -Subproject commit a1a6787a399e6692f70180b2753a0de2737c1e35 +Subproject commit 3caf5fd00d1c9bee2b88fc159a88cefef107caf6 diff --git a/phoenix-rtos-lwip b/phoenix-rtos-lwip index 48966559..4d365cc3 160000 --- a/phoenix-rtos-lwip +++ b/phoenix-rtos-lwip @@ -1 +1 @@ -Subproject commit 4896655982ee778f98050c711b81ae9d891d27e4 +Subproject commit 4d365cc32982fa83c7fffdc136291edc7b89e3fa diff --git a/phoenix-rtos-ports b/phoenix-rtos-ports index 549e10bf..865ebe47 160000 --- a/phoenix-rtos-ports +++ b/phoenix-rtos-ports @@ -1 +1 @@ -Subproject commit 549e10bf865d4ee1e13b31a008ce3976a4c6ef37 +Subproject commit 865ebe4709ca0d7fab28943c47fd02304b0cdbc4 diff --git a/phoenix-rtos-tests b/phoenix-rtos-tests index c3b2ba69..783270b7 160000 --- a/phoenix-rtos-tests +++ b/phoenix-rtos-tests @@ -1 +1 @@ -Subproject commit c3b2ba6920a3d2425a8e501eaefc3ac7aabd8993 +Subproject commit 783270b74b96834d2aa3b2b9eed227151cb6d044 diff --git a/phoenix-rtos-utils b/phoenix-rtos-utils index 44743126..84e1f14b 160000 --- a/phoenix-rtos-utils +++ b/phoenix-rtos-utils @@ -1 +1 @@ -Subproject commit 447431265abb48079f8351f909cf64f88ad5d366 +Subproject commit 84e1f14b83c0e9bbaaef78661e9bfc82380e4a7b diff --git a/plo b/plo index 6bb5dd66..0f0e64b0 160000 --- a/plo +++ b/plo @@ -1 +1 @@ -Subproject commit 6bb5dd66d7a51156f36fe1d77c8a3360a68846db +Subproject commit 0f0e64b0a60af8d96213d0856aa309c61994099e