Compare commits
2 Commits
8ba06f5382
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f21a46172f | |||
| 720a12374c |
46
build.sh
46
build.sh
@@ -21,6 +21,7 @@ BUSYBOX_DIR="${SCRIPT_DIR}/busybox"
|
||||
SYSROOT_DEFAULT="/home/stargazer/arm-uclinuxfdpiceabi/sysroot"
|
||||
SYSROOT="${1:-${SYSROOT:-$SYSROOT_DEFAULT}}"
|
||||
ENV_FILE="${ENV_FILE:-${SCRIPT_DIR}/env.sh}"
|
||||
CONFIG_TEMPLATE="${SCRIPT_DIR}/config/.config"
|
||||
|
||||
die() {
|
||||
echo "ERROR: $*" >&2
|
||||
@@ -55,19 +56,22 @@ echo "Strip: ${STRIP_BIN}"
|
||||
echo "SYSROOT: ${SYSROOT}"
|
||||
echo "Source dir: ${BUSYBOX_DIR}"
|
||||
echo "Install dir: ${INSTALL_DIR}"
|
||||
echo "Config template: ${CONFIG_TEMPLATE}"
|
||||
|
||||
if [ ! -f "${CONFIG_TEMPLATE}" ]; then
|
||||
die "Config template not found: ${CONFIG_TEMPLATE}"
|
||||
fi
|
||||
|
||||
cd "${BUSYBOX_DIR}"
|
||||
|
||||
if [ ! -f ".config" ]; then
|
||||
make defconfig
|
||||
fi
|
||||
cp "${CONFIG_TEMPLATE}" .config
|
||||
|
||||
# Force BusyBox shared library build profile.
|
||||
if [ -x "./scripts/config" ]; then
|
||||
./scripts/config \
|
||||
-e BUILD_LIBBUSYBOX \
|
||||
-e FEATURE_SHARED_BUSYBOX \
|
||||
-e FEATURE_INDIVIDUAL \
|
||||
-d FEATURE_INDIVIDUAL \
|
||||
-d STATIC \
|
||||
-d PIE \
|
||||
-d FEATURE_LIBBUSYBOX_STATIC
|
||||
@@ -84,11 +88,37 @@ make -j"${JOBS}" \
|
||||
EXTRA_LDFLAGS="--sysroot=${SYSROOT}"
|
||||
|
||||
make CONFIG_PREFIX="${INSTALL_DIR}" install
|
||||
if [ -f "busybox" ]; then
|
||||
"${STRIP_BIN}" busybox
|
||||
|
||||
# If FEATURE_SHARED_BUSYBOX/BUILD_LIBBUSYBOX are enabled, BusyBox also
|
||||
# produces a tiny launcher in 0_lib/ that links against libbusybox.
|
||||
# Install that pair instead of the monolithic ./busybox to actually save space.
|
||||
if [ -f "0_lib/busybox" ]; then
|
||||
install -D -m 0755 "0_lib/busybox" "${INSTALL_DIR}/bin/busybox"
|
||||
fi
|
||||
if [ -f "libbusybox.so" ]; then
|
||||
"${STRIP_BIN}" libbusybox.so
|
||||
|
||||
# Install the exact SONAME that the launcher needs (e.g. libbusybox.so.1.31.1)
|
||||
shopt -s nullglob
|
||||
libbusybox_candidates=(0_lib/libbusybox.so.*)
|
||||
shopt -u nullglob
|
||||
for f in "${libbusybox_candidates[@]}"; do
|
||||
case "${f}" in
|
||||
*_unstripped*|*.map|*.out) continue ;;
|
||||
esac
|
||||
install -D -m 0755 "${f}" "${INSTALL_DIR}/lib/$(basename "${f}")"
|
||||
# Optional convenience symlink (not required at runtime).
|
||||
ln -sf "$(basename "${f}")" "${INSTALL_DIR}/lib/libbusybox.so" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Compatibility layout: mirror sbin applet links into /bin
|
||||
# so environments expecting everything under /bin (like the target console)
|
||||
# can resolve applets such as /bin/watchdog.
|
||||
if [ -d "${INSTALL_DIR}/sbin" ] && [ -d "${INSTALL_DIR}/bin" ]; then
|
||||
shopt -s nullglob
|
||||
for s in "${INSTALL_DIR}/sbin"/*; do
|
||||
name="$(basename "${s}")"
|
||||
ln -sf "busybox" "${INSTALL_DIR}/bin/${name}"
|
||||
done
|
||||
shopt -u nullglob
|
||||
fi
|
||||
|
||||
echo "Build completed successfully."
|
||||
|
||||
1191
config/.config
Normal file
1191
config/.config
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user