2012年9月17日 星期一

Add Busybox into TI Android BSP

開發階段 , 很多東西都在 console 下進行一些 debug 的動作 , 有些小修改  , 卻沒有 vim 可以用 , 加上有些常用的 busybox command 都沒有 , 真的有點不方便 !!

之前有  lrz/lsz 的經驗 , 這次一樣如法泡製 , 將 busybox 移植到 TI 的 BSP 中 !!
一樣借用 linaro 這個組織的東西 網址 :

http://www.linaro.org/linux-on-arm

一樣修改一下 Android.mk file (格式和 debug message 修改 ) .

include $(CLEAR_VARS)

BUSYBOX_TOOLS := \
    ar \
    arp \
    ash \
    awk \
    base64 \
    basename \
    beep \
    blkid \
    blockdev \
    bunzip2 \
    bzcat \
    cal \
    catv \
    chat \
    chattr \
    chgrp \
    chpst \
    chroot \
    chrt \
    chvt \
    cksum \
    clear \
    comm \
    cp \
    cpio \
    cttyhack \
    cut \
    dc \
    deallocvt \
    depmod \
    devmem \
    diff \
    dirname \
    dnsd \
    dos2unix \
    dpkg \
    dpkg-deb \
    du \
    dumpkmap \
    echo \
    ed \
    egrep \
    envdir \
    envuidgid \
    expand \
    fakeidentd \
    false \
    fbset \
    fbsplash \
    fdflush \
    fdformat \
    fdisk \
    fgconsole \
    fgrep \
    find \
    findfs \
    flash_lock \
    flash_unlock \
    flashcp \
    flock \
    fold \
    freeramdisk \
    ftpd \
    ftpget \
    ftpput \
    fuser \
    getopt \
    grep \
    gunzip \
    halt \
    hdparm \
    head \
    hexdump \
    httpd \
    ifdown \
    ifup \
    inotifyd \
    install \
    iostat \
    ipaddr \
    ipcalc \
    iplink \
    iproute \
    iprule \
    iptunnel \
    klogd \
    linuxrc \
    loadkmap \
    losetup \
    lpd \
    lpq \
    lpr \
    lsattr \
    lspci \
    lsusb \
    lzcat \
    lzma \
    lzop \
    lzopcat \
    makedevs \
    makemime \
    man \
    md5sum \
    mesg \
    mkfifo \
    mknod \
    mkswap \
    mktemp \
    modinfo \
    modprobe \
    more \
    mpstat \
    nbd-client \
    nc \
    nice \
    nmeter \
    nohup \
    od \
    openvt \
    patch \
    pidof \
    pipe_progress \
    pmap \
    popmaildir \
    poweroff \
    printf \
    pscan \
    pstree \
    pwd \
    pwdx \
    raidautorun \
    rdev \
    readlink \
    readprofile \
    realpath \
    reformime \
    reset \
    resize \
    rev \
    rpm \
    rpm2cpio \
    rtcwake \
    run-parts \
    runsv \
    runsvdir \
    rx \
    script \
    scriptreplay \
    sed \
    sendmail \
    seq \
    setkeycodes \
    setlogcons \
    setserial \
    setsid \
    setuidgid \
    sha1sum \
    sha256sum \
    sha512sum \
    showkey \
    smemcap \
    softlimit \
    sort \
    split \
    start-stop-daemon \
    strings \
    stty \
    sum \
    sv \
    svlogd \
    sysctl \
    tac \
    tail \
    tar \
    tcpsvd \
    tee \
    telnet \
    telnetd \
    test \
    time \
    timeout \
    tr \
    traceroute \
    true \
    ttysize \
    tunctl \
    tune2fs \
    udhcpc \
    uname \
    uncompress \
    unexpand \
    uniq \
    unix2dos \
    unlzma \
    unlzop \
    unxz \
    unzip \
    uudecode \
    uuencode \
    vi \
    volname \
    watch \
    wc \
    wget \
    which \
    whoami \
    whois \
    xargs \
    xz \
    xzcat \
    yes \
    zcat

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../../$(BUILD_SYSTEM)/armelf.x'; fi),-dynamic-linker,/system/bin/linker,-z,nocopyreloc,--no-undefined ../../$(TARGET_CRTBEGIN_DYNAMIC_O) ../../$(TARGET_CRTEND_O) -L../../$(TARGET_OUT_STATIC_LIBRARIES)
# FIXME remove -fno-strict-aliasing once all aliasing violations are fixed
BB_COMPILER_FLAGS := $(subst -I ,-I../../,$(subst -include ,-include ../../,$(TARGET_GLOBAL_CFLAGS))) -I../../bionic/libc/include -I../../bionic/libc/kernel/common -I../../bionic/libc/arch-arm/include -I../../bionic/libc/kernel/arch-arm -I../../bionic/libm/include -fno-stack-protector -Wno-error=format-security -fno-strict-aliasing
BB_LDLIBS := dl m c gcc
ifneq ($(strip $(SHOW_COMMANDS)),)
BB_VERBOSE="V=1"
endif


.PHONY: build_busybox


FILE_BUSYBOX = $(PRODUCT_OUT)/system/bin/busybox

droid: build_busybox

systemtarball: symlinks
    @echo "==================== systemtarball done ...... "

build_busybox: $(TARGET_CRTBEGIN_DYNAMIC_O) $(TARGET_CRTEND_O) $(TARGET_OUT_STATIC_LIBRARIES)/libm.so $(TARGET_OUT_STATIC_LIBRARIES)/libc.so $(TARGET_OUT_STATIC_LIBRARIES)/libdl.so
    @if [ ! -e $(FILE_BUSYBOX) ];then  \
    echo "==================== Building Busybox ...... " ; \
        cd external/busybox && \
        sed -e "s|^CONFIG_CROSS_COMPILER_PREFIX=.*|CONFIG_CROSS_COMPILER_PREFIX=\"$(BB_TC_PREFIX)\"|;s|^CONFIG_EXTRA_CFLAGS=.*|CONFIG_EXTRA_CFLAGS=\"$(BB_COMPILER_FLAGS)\"|" configs/android_defconfig >.config && \
        export PATH=$(BB_TC_DIR):$(PATH) && \
        $(MAKE) -j1 oldconfig && \
        $(MAKE) -j1 $(BB_VERBOSE) EXTRA_LDFLAGS="$(BB_LDFLAGS)" LDLIBS="$(BB_LDLIBS)" && \
        mkdir -p ../../$(PRODUCT_OUT)/system/bin && \
        cp busybox ../../$(PRODUCT_OUT)/system/bin/ ; \
        cd - ; \
        for link in $(BUSYBOX_TOOLS); do\
        ln -sf busybox $(PRODUCT_OUT)/system/bin/$$link; done ; \
    fi

symlinks: build_busybox
    @echo "==================== Create busybox tools linking ...... " ;\
    for link in $(BUSYBOX_TOOLS); do\
        ln -sf busybox $(PRODUCT_OUT)/system/bin/$$link; done
  


最後可以在 out/target/product/am335xevm/system/bin/ 下看到 busybox 和一些 command 的 link .... 大功告成 ..
 

沒有留言:

張貼留言