Cross-compile busybox

Source: Internet
Author: User
Cross-compiler: 3.3.2
# Wget-C http://www.busybox.net/downloads/busybox-1.7.0.tar.bz2
# Tar jxvf busybox-1.7.0.tar.bz2
Modify source code, configuration, and compilation
-----------------------------------------------
# Cd busybox-1.7.0
# Vi makefile + 176
Arch? = Arm
Cross_compile? =/Usr/local/ARM/3.3.2/bin/ARM-Linux-
# Make menuconfig
Busybox settings --->
Build options --->

  • Build busybox as a static binary (no shared libs) // (1)
    Installation Options --->
  • Don't use/usr // (2)
    Linux system utilities --->
  • Mdev // (3)
  • Support/etc/mdev. conf
  • Support Command Execution At device addition/removal

    Shells --->
    Choose your default shell (MSH) ---> // (4)

    (1) This option must be selected so that busybox can be compiled into an executable file with static links, and the runtime is independent of other function libraries. otherwise, other library files must be required to run and cannot work properly on a single Linux kernel.
    (2) This option must also be selected. Otherwise, after make install, busybox will be installed under/usr of the original system, which will overwrite the original command of the system. after this option is selected, make install will generate a directory named _ install under the busybox Directory, which contains busybox and its link.
    (3) If not started
    Udev
    , Causing no device files under/dev. That is to say, all devices are not mounted. The latest busybox contains the simplified udev version, namely mdev, which is very easy to use. To use mdev, you also need to configure it in rootfs.
    VI rootfs/etc/init. d/RCS
    ---------------------------
    Mount-T tmpfs mdev/dev
    Mkdir/dev/PTS
    Mount-T devpts/dev/PTS
    Mount-T sysfs/sys
    Mount-
    Echo/sbin/mdev>/proc/sys/kernel/hotplug
    Mdev-S
    Configure Linux Kernel
    -----------------------------------------------
    Mdev needs to rewrite the/Dev and/sys directories. Therefore, ensure that these two directories are writable (sysfs and tmpfs are generally used. So re-compile the kernel ). Then add/sbin/mdev-s to your startup script file.
    Linux-2.6.19 -- make menuconfig
    File systems --->
    Pseudo filesystems --->

  • Sysfs File System Support
  • Virtual Memory File System Support (former shm fs)
  • Tmpfs POSIX access control lists



  • (4) Because Ash is not powerful enough, it cannot support advanced functions such as Tab filling and history record, so MSH in busybox is used to replace ash.
    Busybox is mainly used in embedded systems with very strict spatial requirements. Therefore, we recommend that you use uclibc instead of glibc. If you have not installed uclibc, in build options, you have also selected build busybox as a static binary (no shared libs), which cannot be compiled, of course, if you selected dynamic compilation for the previous build options, this problem will not occur. Suppose you are in the first case. We can solve this problem by commenting out the lines of warning starting with applets/applets. C.
    # Vi applets/applets. c
    /*
    # If enable_static & defined (_ glibc __)&&! Defined (_ uclibc __)
    # Warning static linking against glibc produces buggy executables
    # Warning (glibc does not well with LD -- GC-sections ).
    # Warning see sources.redhat.com/bugzilla/show_bug.cgi? Id = 3400
    # Warning note that glibc is unsuitable for static linking anyway.
    # Warning if you still want to do it, remove-wl, -- GC-Sections
    # Warning from top-level makefile and remove this warning.
    # Error aborting compilation.
    # Endif
    */
    # Make
    # Make install
    In this case, a _ install directory is generated under your compilation directory, which contains all the generated files and directory structures.

    Problems encountered during compilation (1 ):
    -----------------------------------------------
    If busybox is compiled into static linking
    Busybox settings --->
    Build options --->

  • Build busybox as a static binary (no shared libs)
    # Make
    You will encounter the following problems:
    Applets/applets. C: 20: 2: Error: # warning static linking against glibc produces buggy executables
    Applets/applets. C: 21: 2: Error: # warning (glibc does not well with LD -- GC-sections ).
    Applets/applets. C: 22: 2: Error: # warning see sources.redhat.com/bugzilla/show_bug.cgi? Id = 3400
    Applets/applets. C: 23: 2: Error: # warning note that glibc is unsuitable for static linking anyway.
    Applets/applets. C: 24: 2: Error: # warning if you still want to do it, remove-wl, -- GC-Sections
    Applets/applets. C: 25: 2: Error: # warning from top-level makefile and remove this warning.
    Make [1]: *** [applets/applets. O] Error 1
    This warning is defined in applets/applets. C. Comment out this warning.This warning tells you that it is best to use uclibc for compilation, instead of using glibc because glibc is large, busybox is used in many embedded systems, so there are such requirements.
    # Vi/busybox-1.7.0/applets. C + 20
    Comment out 20-28 lines of content.
    Miscutils/taskset. C: 17: Error: Parse error before '*' token
    -----------------------------------------------
    The most fundamental solution is to change the libc library, but I don't know which database is the most suitable yet. I only need to temporarily disable the problematic command.
    Miscellaneous utilities --->
    [] Taskset
    [

















    ] Various

    Runit/runsv. C: In function 'gettimeofday _ ns ':
    -----------------------------------------------

    Runit utilities --->
    [] Runsv
    Problems encountered during kernel startup:
    -----------------------------------------------
    "Cocould not run '/bin/Sh': no such file or directory"
    Solution:
    To do this, configure:
    Shells --->
    Choose your default shell (Ash) --->
    If it is configured in this way, you can generate ash but cannot generate Sh. the above problem will occur during kernel startup:
    Shells --->
    Choose your default shell (none) --->

  • Ash
  • This article is from the chinaunix blog. If you want to view the original text, click:Http://blog.chinaunix.net/u2/78225/showart_1299803.html

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.