aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2014-05-22 15:26:41 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2014-05-22 22:20:43 +0800
commita626dff6b643af744065a82be5549d82d9781e16 (patch)
treea8ae42c6a49c373d0de4f43f07b10c333bb4397f
parente39fa9e604bdf73a188b68dbcc4be0cf5b996ab8 (diff)
downloadbusybox-a626dff6b643af744065a82be5549d82d9781e16.tar.gz
busybox: modify to compile with aosp master 20140515 snapshort
change busybox to compile into PIE format, so that it can be run on the android system. otherwise we will get problem: error: only position independent executables (PIE) are supported. when we run it on device. Change-Id: I6953c0067cd5ceeee26b9d219754c63b6ef45b1d Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--Android.mk17
-rw-r--r--applets/Kbuild.src4
-rw-r--r--configs/android_defconfig2
-rw-r--r--scripts/Makefile.build6
4 files changed, 12 insertions, 17 deletions
diff --git a/Android.mk b/Android.mk
index a83452c1d..7f7a74116 100644
--- a/Android.mk
+++ b/Android.mk
@@ -2,9 +2,14 @@ BB_PATH := $(call my-dir)
include $(CLEAR_VARS)
+ifeq ($(TARGET_IS_64_BIT),true)
+ LINKER_BIN := /system/bin/linker64
+else
+ LINKER_BIN := /system/bin/linker
+endif
BB_TC_DIR := $(realpath $(shell dirname $(TARGET_TOOLS_PREFIX)))
BB_TC_PREFIX := $(shell basename $(TARGET_TOOLS_PREFIX))
-BB_LDFLAGS := -nostdlib -Bdynamic -Wl,-z,muldefs$(shell if test $(PLATFORM_SDK_VERSION) -lt 16; then echo -ne ',-T$(CURDIR)/$(BUILD_SYSTEM)/armelf.x'; fi),-dynamic-linker,/system/bin/linker,-z,nocopyreloc,--no-undefined $(CURDIR)/$(TARGET_CRTBEGIN_DYNAMIC_O) $(CURDIR)/$(TARGET_CRTEND_O) -L$(CURDIR)/$(TARGET_OUT_STATIC_LIBRARIES) -L$(CURDIR)/$(TARGET_OUT_SHARED_LIBRARIES)
+BB_LDFLAGS := -nostdlib -Bdynamic -Wl,-z,muldefs$(shell if test $(PLATFORM_SDK_VERSION) -lt 16; then echo -ne ',-T$(CURDIR)/$(BUILD_SYSTEM)/armelf.x'; fi),-dynamic-linker,$(LINKER_BIN),-z,nocopyreloc,--no-undefined $(CURDIR)/$(TARGET_CRTBEGIN_DYNAMIC_O) $(CURDIR)/$(TARGET_CRTEND_O) $(CURDIR)/$(TARGET_OUT_SHARED_LIBRARIES)/libc.so -L$(CURDIR)/$(TARGET_OUT_SHARED_LIBRARIES)
# FIXME remove -fno-strict-aliasing once all aliasing violations are fixed
BB_COMPILER_FLAGS := $(subst -I ,-I$(CURDIR)/,$(subst -include ,-include $(CURDIR)/,$(TARGET_GLOBAL_CFLAGS))) $(foreach d,$(TARGET_C_INCLUDES),-I$(CURDIR)/$(d)) -fno-stack-protector -Wno-error=format-security -fno-strict-aliasing
BB_LDLIBS := dl m c gcc
@@ -43,23 +48,19 @@ BUSYBOX_TOOLS := \
base64 \
basename \
beep \
- blkid \
blockdev \
bunzip2 \
bzcat \
cal \
catv \
chat \
- chattr \
chgrp \
chpst \
chroot \
chrt \
chvt \
cksum \
- clear \
comm \
- cp \
cpio \
cttyhack \
cut \
@@ -73,7 +74,6 @@ BUSYBOX_TOOLS := \
dos2unix \
dpkg \
dpkg-deb \
- du \
dumpkmap \
echo \
ed \
@@ -103,7 +103,6 @@ BUSYBOX_TOOLS := \
ftpput \
fuser \
getopt \
- grep \
gunzip \
halt \
hdparm \
@@ -129,7 +128,6 @@ BUSYBOX_TOOLS := \
lpd \
lpq \
lpr \
- lsattr \
lspci \
lsusb \
lzcat \
@@ -143,7 +141,6 @@ BUSYBOX_TOOLS := \
mesg \
mkfifo \
mknod \
- mkswap \
mktemp \
modinfo \
modprobe \
@@ -169,7 +166,6 @@ BUSYBOX_TOOLS := \
pwdx \
raidautorun \
rdev \
- readlink \
readprofile \
realpath \
reformime \
@@ -224,7 +220,6 @@ BUSYBOX_TOOLS := \
true \
ttysize \
tunctl \
- tune2fs \
udhcpc \
uname \
uncompress \
diff --git a/applets/Kbuild.src b/applets/Kbuild.src
index b61239948..fa1dfad16 100644
--- a/applets/Kbuild.src
+++ b/applets/Kbuild.src
@@ -4,8 +4,8 @@
#
# Licensed under GPLv2, see file LICENSE in this source tree.
-obj-y :=
-obj-y += applets.o
+lib-y :=
+lib-y += applets.o
hostprogs-y:=
hostprogs-y += usage usage_pod applet_tables
diff --git a/configs/android_defconfig b/configs/android_defconfig
index 3753610d1..e7c98feab 100644
--- a/configs/android_defconfig
+++ b/configs/android_defconfig
@@ -55,7 +55,7 @@ CONFIG_FEATURE_SYSLOG=y
# Build Options
#
# CONFIG_STATIC is not set
-# CONFIG_PIE is not set
+CONFIG_PIE=y
# CONFIG_NOMMU is not set
# CONFIG_BUILD_LIBBUSYBOX is not set
# CONFIG_FEATURE_INDIVIDUAL is not set
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5685b5bcc..476532b62 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -174,7 +174,7 @@ cmd_modversions = \
| $(GENKSYMS) -a $(ARCH) \
> $(@D)/.tmp_$(@F:.o=.ver); \
\
- $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
+ $(LD) $(LDFLAGS) -o $@ $(@D)/.tmp_$(@F) \
-T $(@D)/.tmp_$(@F:.o=.ver); \
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
else \
@@ -256,7 +256,7 @@ ifdef builtin-target
quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty built-in.o
cmd_link_o_target = $(if $(strip $(obj-y)),\
- $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
+ $(LD) $(ld_flags) -o $@ $(filter $(obj-y), $^),\
rm -f $@; $(AR) rcs $@)
$(builtin-target): $(obj-y) FORCE
@@ -291,7 +291,7 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y)))), $^)
quiet_cmd_link_multi-y = LD $@
-cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
+cmd_link_multi-y = $(LD) $(ld_flags) -o $@ $(link_multi_deps)
quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps)