busybox记录
查看字節電腦的 /dev/console和/dev/null發現是字符型設備
andrew@andrew-Thurley:/work/svn_linux/busybox$ ls -l /dev/console /dev/null crw------- 1 root root 5, 1 10月 14 07:51 /dev/console 其中的root 5, 1 后面的 5 1代表的是主設備是 5從設備是1 crw------- 中的c代表的是 字符型設備 crw-rw-rw- 1 root root 1, 3 10月 14 07:51 /dev/null自己可以使用 如下步驟創建相同的文件
進入busybox生成的含有 bin sbin linuxrc usr等文件的文件夾 然后執行 mkdir dev cd dev sudo mknod console c 5 1 //含義是創建字符型設備 console 主設備號是5 從設備號是1 sudo mknod null c 1 3若是在使用命令的時候提示沒有/proc文件
可以使用: mkdir proc 然后在使用掛載,其實內核的應用程序都在虛擬的proc文件系統中進行,要想其運行需要將其進行掛載; mount -t proc none /proc #就可以執行相應的程序了其中的proc就是內核提供的一個虛擬的文件系統,需要將其掛載到/proc目錄上才能正常使用相應的命令
在自己的設備上可以看到文件如下:
在自己的linux上,進入/proc/1 目錄然后在執行 ls -l fd 命令就可以查看相應進程文件的信息:
在使用自己搭配的嵌入式開發環境進行嵌入式學習的時候,編譯busybox遇到了一下錯誤提示:
andrew@andrew-Thurley:/work/svn_linux/busybox$ make menuconfig Makefile:405: *** mixed implicit and normal rules: deprecated syntax Makefile:1242: *** mixed implicit and normal rules: deprecated syntax make: *** No rule to make target 'menuconfig'。 停止。這是因為新版本的make 與老版本的make而兼容的問題只需要按照下圖將紅色的地方去掉就可以正常執行了;
然后后在運行 make menuconfig就會出現配置界面
編譯busybox的步驟是;
make menuconfig
make
make install //執行此步一定確認好你已經將安裝路徑重定向,否則你的系統中的busybox文件將會被替換
更多的信息請參考 busybox中的INSTALL文件
編譯: =========busybox的編譯過程與linux內核的編譯過程相似:make menuconfig # This creates a file called ".config"make # This creates the "busybox" executablemake install # or make CONFIG_PREFIX=/path/from/root installThe full list of configuration and install options is available by typing:make helpQuick Start: ============The easy way to try out BusyBox for the first time, without having to install it, is to enable all features and then use "standalone shell" mode with a blank command $PATH.To enable all features, use "make defconfig", which produces the largest general-purpose configuration. (It's allyesconfig minus debugging options, optional packaging choices, and a few special-purpose features requiring extra configuration to use.)make defconfigmakePATH= ./busybox ashStandalone shell mode causes busybox's built-in command shell to run any built-in busybox applets directly, without looking for external programs by that name. Supplying an empty command path (as above) means the only commands busybox can find are the built-in ones.Note that the standalone shell requires CONFIG_BUSYBOX_EXEC_PATH to be set appropriately, depending on whether or not /proc/self/exe is available or not. If you do not have /proc, then point that config option to the location of your busybox binary, usually /bin/busybox.Configuring Busybox: ====================Busybox is optimized for size, but enabling the full set of functionality still results in a fairly large executable -- more than 1 megabyte when statically linked. To save space, busybox can be configured with only the set of applets needed for each environment. The minimal configuration, with all applets disabled, produces a 4k executable. (It's useless, but very small.)The manual configurator "make menuconfig" modifies the existing configuration. (For systems without ncurses, try "make config" instead.) The two most interesting starting configurations are "make allnoconfig" (to start with everything disabled and add just what you need), and "make defconfig" (to start with everything enabled and remove what you don't need). If menuconfig is run without an existing configuration, make defconfig will run first to create a known starting point.Other starting configurations (mostly used for testing purposes) include "make allbareconfig" (enables all applets but disables all optional features), "make allyesconfig" (enables absolutely everything including debug features), and "make randconfig" (produce a random configuration).Configuring BusyBox produces a file ".config", which can be saved for future use. Run "make oldconfig" to bring a .config file from an older version of busybox up to date.Installing Busybox: ===================Busybox is a single executable that can behave like many different commands, and BusyBox uses the name it was invoked under to determine the desired behavior. (Try "mv busybox ls" and then "./ls -l".)Installing busybox consists of creating symlinks (or hardlinks) to the busybox binary for each applet enabled in busybox, and making sure these symlinks are in the shell's command $PATH. Running "make install" creates these symlinks, or "make install-hardlinks" creates hardlinks instead (useful on systems with a limited number of inodes). This install process uses the file "busybox.links" (created by make), which contains the list of enabled applets and the path at which to install them.Installing links to busybox is not always necessary. The special applet name "busybox" (or with any optional suffix, such as "busybox-static") uses the first argument to determine which applet to behave as, for example "./busybox cat LICENSE". (Running the busybox applet with no arguments gives a list of all enabled applets.) The standalone shell can also call busybox applets without links to busybox under other names in the filesystem. You can also configure a standaone install capability into the busybox base applet, and then install such links at runtime with one of "busybox --install" (for hardlinks) or "busybox --install -s" (for symlinks).If you enabled the busybox shared library feature (libbusybox.so) and want to run tests without installing, set your LD_LIBRARY_PATH accordingly when running the executable:LD_LIBRARY_PATH=`pwd` ./busyboxBuilding out-of-tree: =====================By default, the BusyBox build puts its temporary files in the source tree. Building from a read-only source tree, or building multiple configurations from the same source directory, requires the ability to put the temporary files somewhere else.To build out of tree, cd to an empty directory and configure busybox from there:make -f /path/to/source/Makefile defconfigmakemake installAlternately, use the O=$BUILDPATH option (with an absolute path) during the configuration step, as in:make O=/some/empty/directory allyesconfigcd /some/empty/directorymakemake CONFIG_PREFIX=. installMore Information: =================Se also the busybox FAQ, under the questions "How can I get started using BusyBox" and "How do I build a BusyBox-based system?" The BusyBox FAQ is available from http://www.busybox.net/FAQ.html or as the file docs/busybox.net/FAQ.html in this tarball.但是在執行make命令的時候還是會出現錯誤,要是你認為這種錯誤對你的編譯結果影響不大的話可以直接使用 make -i將忽略編譯過程中的錯誤提示
總結
- 上一篇: 专题导读:大数据创新实践
- 下一篇: 作者:司恩哲(1985-),男,就职于中