Using BusyBox to make Iniramfs

Source: Internet
Author: User
One of the ways to start Linux kernel is Initramfs + kernel. Where INIRAMFS can be made using BusyBox. This example uses BusyBox v1.22.1 to make Iniramfs in Ubuntu 16.04 64bit.

# # Download BusyBox
[BusyBox]: https://busybox.net/

# # Configure, compile
1. Configure
"Shell
$ make Menuconfig
```
> If ' Make Menuconfig ' encounters errors, consider installing Libcurses5-dev

Busybox Settings-> Build Options-> build Busybox as a static binary (no shared libs)
Busybox Settings-> Build Options-> Cross Compiler Prefix # arm-linux-gnueabi-

2. Compile
"Shell
$ make-j5 Arch=arm Install
```
Notice the Echo
> would probably need to make your busybox binary
Setuid root to ensure all configured applets would
Work properly.

The results of the compilation are stored in _install/.
"Shell
# in _install/bin
$ chmod +s BusyBox
# in _install
$ find. | Cpio-o--FORMAT=NEWC >. /rootfs.img
$ cd ...
$ gzip-c rootfs.img > rootfs.img.gz
```
Thus, ' rootfs.img.gz ' is Iniramfs.

# # Use
If you have previously compiled a completed Linux kernel (zimage), you can use it in a manner similar to the following
"Shell
$./qemu-system-arm-m versatilepb-m 128m-kernel zimage-initrd rootfs.img.gz-append "Root=/dev/ram rdinit=/bin/sh cons Ole=ttyama0 "-nographic
```
The current situation is to stay in the Ramfs file system, the observed warning is "/bin/sh:can ' t access tty;" Job control turned off.

# # Refenrece
[BusyBox for Arm on QEMU]: https://balau82.wordpress.com/2010/03/27/busybox-for-arm-on-qemu/

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.