日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

busybox记录

發(fā)布時間:2025/3/15 编程问答 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 busybox记录 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

查看字節(jié)電腦的 /dev/console和/dev/null發(fā)現(xiàn)是字符型設備

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

自己可以使用  如下步驟創(chuàng)建相同的文件

進入busybox生成的含有   bin sbin linuxrc usr等文件的文件夾 然后執(zhí)行 mkdir dev cd dev sudo mknod console c 5 1 //含義是創(chuàng)建字符型設備  console 主設備號是5 從設備號是1 sudo mknod null c 1 3

若是在使用命令的時候提示沒有/proc文件

可以使用: mkdir proc 然后在使用掛載,其實內核的應用程序都在虛擬的proc文件系統(tǒng)中進行,要想其運行需要將其進行掛載; mount -t proc none /proc #就可以執(zhí)行相應的程序了

其中的proc就是內核提供的一個虛擬的文件系統(tǒng),需要將其掛載到/proc目錄上才能正常使用相應的命令
在自己的設備上可以看到文件如下:

在自己的linux上,進入/proc/1 目錄然后在執(zhí)行  ls -l fd 命令就可以查看相應進程文件的信息:

andrew@andrew-Thurley:/proc/1$ sudo ls -l fd [sudo] andrew 的密碼: 總用量 0 lrwx------ 1 root root 64 10月 15 23:06 0 -> /dev/null lrwx------ 1 root root 64 10月 15 23:06 1 -> /dev/null lr-x------ 1 root root 64 10月 15 23:28 10 -> /proc/1/mountinfo lrwx------ 1 root root 64 10月 15 23:28 100 -> socket:[39070] lrwx------ 1 root root 64 10月 15 23:31 101 -> socket:[56345] lrwx------ 1 root root 64 10月 15 23:31 102 -> socket:[56346] lr-x------ 1 root root 64 10月 15 23:28 11 -> anon_inode:inotify lr-x------ 1 root root 64 10月 15 23:28 12 -> /proc/swaps lrwx------ 1 root root 64 10月 15 23:28 13 -> socket:[462] lrwx------ 1 root root 64 10月 15 23:28 14 -> socket:[463] lrwx------ 1 root root 64 10月 15 23:28 15 -> anon_inode:[timerfd] lrwx------ 1 root root 64 10月 15 23:28 16 -> socket:[34608] lrwx------ 1 root root 64 10月 15 23:28 17 -> socket:[34829] lrwx------ 1 root root 64 10月 15 23:28 18 -> socket:[34830] lrwx------ 1 root root 64 10月 15 23:28 19 -> socket:[34609] lrwx------ 1 root root 64 10月 15 23:06 2 -> /dev/null lrwx------ 1 root root 64 10月 15 23:28 20 -> socket:[467] lrwx------ 1 root root 64 10月 15 23:28 21 -> socket:[33481] lr-x------ 1 root root 64 10月 15 23:28 22 -> anon_inode:inotify lrwx------ 1 root root 64 10月 15 23:28 23 -> /run/systemd/initctl/fifo lrwx------ 1 root root 64 10月 15 23:28 24 -> socket:[468] lrwx------ 1 root root 64 10月 15 23:28 25 -> socket:[469] lr-x------ 1 root root 64 10月 15 23:28 26 -> anon_inode:inotify lr-x------ 1 root root 64 10月 15 23:28 27 -> /dev/autofs lr-x------ 1 root root 64 10月 15 23:28 28 -> pipe:[473] lrwx------ 1 root root 64 10月 15 23:28 29 -> socket:[475] l-wx------ 1 root root 64 10月 15 23:06 3 -> /dev/kmsg lrwx------ 1 root root 64 10月 15 23:28 30 -> socket:[478] lrwx------ 1 root root 64 10月 15 23:28 31 -> socket:[479] lrwx------ 1 root root 64 10月 15 23:28 32 -> socket:[480] lrwx------ 1 root root 64 10月 15 23:28 33 -> socket:[528] lrwx------ 1 root root 64 10月 15 23:28 34 -> socket:[535] lrwx------ 1 root root 64 10月 15 23:28 35 -> socket:[14207] lrwx------ 1 root root 64 10月 15 23:28 36 -> socket:[17750] lr-x------ 1 root root 64 10月 15 23:28 37 -> anon_inode:inotify lrwx------ 1 root root 64 10月 15 23:28 38 -> /dev/rfkill lrwx------ 1 root root 64 10月 15 23:28 39 -> socket:[893] lrwx------ 1 root root 64 10月 15 23:28 4 -> anon_inode:[eventpoll] lrwx------ 1 root root 64 10月 15 23:28 40 -> socket:[24615] lrwx------ 1 root root 64 10月 15 23:28 41 -> socket:[23312] lr-x------ 1 root root 64 10月 15 23:28 42 -> anon_inode:inotify lrwx------ 1 root root 64 10月 15 23:28 43 -> socket:[23291] lrwx------ 1 root root 64 10月 15 23:28 44 -> socket:[23292] lr-x------ 1 root root 64 10月 15 23:28 45 -> anon_inode:inotify lrwx------ 1 root root 64 10月 15 23:28 46 -> socket:[23293] lrwx------ 1 root root 64 10月 15 23:28 47 -> socket:[23294] lrwx------ 1 root root 64 10月 15 23:28 48 -> socket:[23295] lrwx------ 1 root root 64 10月 15 23:28 49 -> socket:[23296] lrwx------ 1 root root 64 10月 15 23:28 5 -> anon_inode:[signalfd] lrwx------ 1 root root 64 10月 15 23:28 50 -> socket:[23297] lrwx------ 1 root root 64 10月 15 23:28 51 -> socket:[23298] lrwx------ 1 root root 64 10月 15 23:28 52 -> anon_inode:[timerfd] lrwx------ 1 root root 64 10月 15 23:28 53 -> socket:[33482] lrwx------ 1 root root 64 10月 15 23:28 54 -> socket:[34488] lrwx------ 1 root root 64 10月 15 23:28 55 -> socket:[27031] lrwx------ 1 root root 64 10月 15 23:28 56 -> socket:[24582] lrwx------ 1 root root 64 10月 15 23:28 57 -> socket:[21803] lrwx------ 1 root root 64 10月 15 23:28 58 -> socket:[23311] lrwx------ 1 root root 64 10月 15 23:28 59 -> socket:[23329] lr-x------ 1 root root 64 10月 15 23:28 6 -> /sys/fs/cgroup/systemd lrwx------ 1 root root 64 10月 15 23:28 60 -> socket:[35600] lrwx------ 1 root root 64 10月 15 23:28 61 -> socket:[24014] lrwx------ 1 root root 64 10月 15 23:28 62 -> socket:[24073] lrwx------ 1 root root 64 10月 15 23:28 63 -> socket:[24546] lrwx------ 1 root root 64 10月 15 23:28 64 -> socket:[20786] lrwx------ 1 root root 64 10月 15 23:28 65 -> socket:[35614] lrwx------ 1 root root 64 10月 15 23:28 66 -> socket:[23452] lrwx------ 1 root root 64 10月 15 23:28 67 -> socket:[35615] lrwx------ 1 root root 64 10月 15 23:28 68 -> socket:[22012] lrwx------ 1 root root 64 10月 15 23:28 69 -> socket:[39020] lrwx------ 1 root root 64 10月 15 23:28 7 -> anon_inode:[timerfd] lrwx------ 1 root root 64 10月 15 23:28 70 -> socket:[39021] lrwx------ 1 root root 64 10月 15 23:28 71 -> socket:[22356] lrwx------ 1 root root 64 10月 15 23:28 72 -> socket:[38132] lrwx------ 1 root root 64 10月 15 23:28 73 -> socket:[35662] lrwx------ 1 root root 64 10月 15 23:28 74 -> socket:[21236] lrwx------ 1 root root 64 10月 15 23:28 75 -> socket:[35663] lrwx------ 1 root root 64 10月 15 23:28 76 -> socket:[36201] lrwx------ 1 root root 64 10月 15 23:28 77 -> socket:[36202] lrwx------ 1 root root 64 10月 15 23:28 78 -> socket:[36910] lrwx------ 1 root root 64 10月 15 23:28 79 -> socket:[36911] lrwx------ 1 root root 64 10月 15 23:28 8 -> socket:[460] lrwx------ 1 root root 64 10月 15 23:28 80 -> socket:[26868] lrwx------ 1 root root 64 10月 15 23:28 81 -> socket:[26869] lrwx------ 1 root root 64 10月 15 23:28 82 -> socket:[29716] lrwx------ 1 root root 64 10月 15 23:28 83 -> socket:[28808] lrwx------ 1 root root 64 10月 15 23:28 84 -> socket:[37897] lrwx------ 1 root root 64 10月 15 23:28 85 -> socket:[27960] lrwx------ 1 root root 64 10月 15 23:28 86 -> socket:[37898] lrwx------ 1 root root 64 10月 15 23:28 87 -> socket:[37939] lrwx------ 1 root root 64 10月 15 23:28 88 -> socket:[37940] lrwx------ 1 root root 64 10月 15 23:28 89 -> socket:[36961] lrwx------ 1 root root 64 10月 15 23:28 9 -> anon_inode:[eventpoll] lrwx------ 1 root root 64 10月 15 23:28 90 -> socket:[36962] lrwx------ 1 root root 64 10月 15 23:28 91 -> socket:[36971] lrwx------ 1 root root 64 10月 15 23:28 92 -> socket:[36972] lrwx------ 1 root root 64 10月 15 23:28 93 -> socket:[36538] lrwx------ 1 root root 64 10月 15 23:28 94 -> socket:[36539] lrwx------ 1 root root 64 10月 15 23:28 95 -> socket:[38133] lrwx------ 1 root root 64 10月 15 23:28 96 -> socket:[39069] lrwx------ 1 root root 64 10月 15 23:28 97 -> socket:[37955] lrwx------ 1 root root 64 10月 15 23:28 98 -> socket:[36491] lrwx------ 1 root root 64 10月 15 23:28 99 -> socket:[36492]

在使用自己搭配的嵌入式開發(fā)環(huán)境進行嵌入式學習的時候,編譯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而兼容的問題只需要按照下圖將紅色的地方去掉就可以正常執(zhí)行了;

然后后在運行 make menuconfig就會出現(xiàn)配置界面

編譯busybox的步驟是;
make menuconfig
make
make install //執(zhí)行此步一定確認好你已經將安裝路徑重定向,否則你的系統(tǒng)中的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.

但是在執(zhí)行make命令的時候還是會出現(xiàn)錯誤,要是你認為這種錯誤對你的編譯結果影響不大的話可以直接使用 make -i將忽略編譯過程中的錯誤提示


總結

以上是生活随笔為你收集整理的busybox记录的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。