Skip to contentSkip to conversation

STAGING_DIR does not contain executables found in TARGET_DIR

Buildroot Andreas Ziegler 2 participants 3 messages Feb 23, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi William,

Quoted 5 lines · William Tambe

Please help determining why STAGING_DIR does not contain executables found in TARGET_DIR ?

I am expecting to find debug version of all executables in TARGET_DIR, but executables such as /bin/busybox are missing from STAGING_DIR .

If you look at your packages' definition (.mk) files, you will find a few with *_INSTALL_STAGING = YES. This is responsible for the (additional) installation in STAGING_DIR. The reason for this is that some packages need to provide information during the build process, that is not needed later for operation on the target. To save space on the target system, a two-stage approach is used.

Example: your configuration includes zlib-ng: the library itself is present both in STAGING_DIR and in TARGET_DIR, header and ldconfig-related files will be found in STAGING_DIR only. On the other hand, Busybox is not referenced by other packages (it does not export any interfaces), so it does not have an installation in STAGING_DIR.

Your target binaries will be stripped of symbols, unless you prevent this via BR2_STRIP_EXCLUDE_{FILE, DIRS} ...

Remote debugging has less impact on your target installation. For this you would need BR2_PACKAGE_HOST_GDB and BR2_PACKAGE_GDB_SERVER [1].

Kind regards,
Andreas

Quoted 32 lines

I am using 2021.08.3

Full config is as follow

```
BR2_pu32=y
BR2_ENABLE_DEBUG=y
BR2_DEBUG_3=y
BR2_STATIC_LIBS=y
BR2_FORTIFY_SOURCE_NONE=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_PATH="/opt/pu32-toolchain/"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-elf"
BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_5=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_SSP is not set
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TARGET_GENERIC_ISSUE=""
BR2_ROOTFS_MERGED_USR=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_TERM="linux"
BR2_TARGET_GENERIC_GETTY_OPTIONS="-n -l /bin/-bash"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_GDB=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_ZLIB_NG=y
BR2_PACKAGE_DHCP=y
BR2_PACKAGE_DHCP_CLIENT=y
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_LRZSZ=y
BR2_PACKAGE_SOCAT=y
Quoted 8 lines
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_NANO=y
# BR2_PACKAGE_NANO_TINY is not set
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="64M"
# BR2_TARGET_ROOTFS_TAR is not set
```

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Server.html#Server
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 18 lines · Andreas Ziegler

Hi William,

Quoted 5 lines · William Tambe

Please help determining why STAGING_DIR does not contain executables found in TARGET_DIR ?

I am expecting to find debug version of all executables in TARGET_DIR, but executables such as /bin/busybox are missing from STAGING_DIR .

If you look at your packages' definition (.mk) files, you will find a few with *_INSTALL_STAGING = YES. This is responsible for the (additional) installation in STAGING_DIR. The reason for this is that some packages need to provide information during the build process, that is not needed later for operation on the target. To save space on the target system, a two-stage approach is used.

Quoted 6 lines

Example: your configuration includes zlib-ng: the library itself is present both in STAGING_DIR and in TARGET_DIR, header and ldconfig-related files will be found in STAGING_DIR only. On the other hand, Busybox is not referenced by other packages (it does not export any interfaces), so it does not have an installation in STAGING_DIR.

Is there a temporary hack I could use to have a bin/busybox in STAGING_DIR ?

Quoted 50 lines

Your target binaries will be stripped of symbols, unless you prevent this via BR2_STRIP_EXCLUDE_{FILE, DIRS} ...

Remote debugging has less impact on your target installation. For this you would need BR2_PACKAGE_HOST_GDB and BR2_PACKAGE_GDB_SERVER [1].

Kind regards,
Andreas

Quoted 32 lines

I am using 2021.08.3

Full config is as follow

```
BR2_pu32=y
BR2_ENABLE_DEBUG=y
BR2_DEBUG_3=y
BR2_STATIC_LIBS=y
BR2_FORTIFY_SOURCE_NONE=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_PATH="/opt/pu32-toolchain/"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-elf"
BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_5=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_SSP is not set
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TARGET_GENERIC_ISSUE=""
BR2_ROOTFS_MERGED_USR=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_TERM="linux"
BR2_TARGET_GENERIC_GETTY_OPTIONS="-n -l /bin/-bash"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_GDB=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_ZLIB_NG=y
BR2_PACKAGE_DHCP=y
BR2_PACKAGE_DHCP_CLIENT=y
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_LRZSZ=y
BR2_PACKAGE_SOCAT=y
Quoted 8 lines
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_NANO=y
# BR2_PACKAGE_NANO_TINY is not set
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="64M"
# BR2_TARGET_ROOTFS_TAR is not set
```
Quoted 1 line

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Server.html#Server

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 19 lines · William Tambe
Quoted 18 lines · Andreas Ziegler

Hi William,

Quoted 5 lines · William Tambe

Please help determining why STAGING_DIR does not contain executables found in TARGET_DIR ?

I am expecting to find debug version of all executables in TARGET_DIR, but executables such as /bin/busybox are missing from STAGING_DIR .

If you look at your packages' definition (.mk) files, you will find a few with *_INSTALL_STAGING = YES. This is responsible for the (additional) installation in STAGING_DIR. The reason for this is that some packages need to provide information during the build process, that is not needed later for operation on the target. To save space on the target system, a two-stage approach is used.

Quoted 8 lines
Quoted 6 lines

Example: your configuration includes zlib-ng: the library itself is present both in STAGING_DIR and in TARGET_DIR, header and ldconfig-related files will be found in STAGING_DIR only. On the other hand, Busybox is not referenced by other packages (it does not export any interfaces), so it does not have an installation in STAGING_DIR.

Is there a temporary hack I could use to have a bin/busybox in STAGING_DIR ?

You might try to just enable BUSYBOX_INSTALL_STAGING = YES, but it will probably also need definition of BUSYBOX_INSTALL_STAGING_CMDS. Another option would be a post-install hook:

define BUSYBOX_INSTALL_STAGING
$(INSTALL) -m 0755 &(@D)/busybox_unstripped $(STAGING_DIR)/bin/busybox
endef
BUSYBOX_POST_INSTALL_TARGET_HOOKS += BUSYBOX_INSTALL_STAGING

Quoted 50 lines
Quoted 50 lines

Your target binaries will be stripped of symbols, unless you prevent this via BR2_STRIP_EXCLUDE_{FILE, DIRS} ...

Remote debugging has less impact on your target installation. For this you would need BR2_PACKAGE_HOST_GDB and BR2_PACKAGE_GDB_SERVER [1].

Kind regards,
Andreas

Quoted 40 lines

I am using 2021.08.3

Full config is as follow

```
BR2_pu32=y
BR2_ENABLE_DEBUG=y
BR2_DEBUG_3=y
BR2_STATIC_LIBS=y
BR2_FORTIFY_SOURCE_NONE=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_PATH="/opt/pu32-toolchain/"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-elf"
BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_5=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_SSP is not set
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TARGET_GENERIC_ISSUE=""
BR2_ROOTFS_MERGED_USR=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_TERM="linux"
BR2_TARGET_GENERIC_GETTY_OPTIONS="-n -l /bin/-bash"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_GDB=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_ZLIB_NG=y
BR2_PACKAGE_DHCP=y
BR2_PACKAGE_DHCP_CLIENT=y
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_LRZSZ=y
BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_NANO=y
# BR2_PACKAGE_NANO_TINY is not set
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="64M"
# BR2_TARGET_ROOTFS_TAR is not set
```
Quoted 1 line
Quoted 1 line

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Server.html#Server

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot