Make a uimage with INITRD

Source: Internet
Author: User
Tags chmod mkdir



Export cross_compile= ... make arch=arm menuconfig

It is important to note here that the build BusyBox as a static binary (no shared libs) must be selected in the BusyBox Settings--> builds Options to indicate that BusyBox is compiled into a static library .

Other keep the default values, and then save

Make

Make Install

The _install folder will be generated

The generated _install directory has only directories such as Bin,sbin, so in order to build the Linux file system, we must create additional directories:

CD _install

mkdir proc sys etc Dev

Then create the console and null device files

CD Dev

sudo mknod console C 5 1

sudo mknod null C 1 3

Then create the related files under etc:

The init process is the first process created by the kernel, and he interprets the commands in/etc/inittab and executes the Init.d/rcs script file, in which we need to mount the file system, and as to which filesystem to mount, the Fstab file determines:

First create the Fstab file:

CDs etc

vim fstab, enter the following:

Then create the RCS script file:

CDs etc

mkdir INIT.D

CD INIT.D

vim RcS, enter the following:

chmod +x RcS This step don't forget.

Then create the Inittab file:

CDs etc

vim Inittab, enter the following:

And then:

Switch to the _install directory

RM LINUXRC

Enter the following command:

LN-SV Bin/busybox Init (as pictured)



>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>

The kernel is compiled below:

Make arch=-






Make Arch=arm uimage >>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>> transplant SD card driver for mini2440 & Linux2.6.30.4


Configure USB for mini2440 & Linux2.6.30.4

1 To ensure that the kernel supports hot-swappable
# CD linux-2.6.30.4# vi. config< Br>config_kallsyms=y
# Config_kallsyms_all is not set
# Config_kallsyms_extra_pass ' not set
# CONFIG_STRIP_ Asm_syms is not set
config_hotplug=y  //ensure this is y
config_printk=y
config_net=y      //Make sure this is also y
Make sure both are selected, or the/proc/sys/kernel/directory does not appear hotplug files.
2) Ensure that BusyBox support Mdev
Mdev is a compact version of the Udev device file system in BusyBox
# make Menuconfig
to ensure that the following items are selected:
Linux System Utilities   --->

Mdev support/etc/mdev.conf Support Sub Dirs/symlinks Support Regular Expressions substitutions when renaming dev Support c Ommand execution at device addition/removal Support loading of firmwares
3) Root file system
The contents of the Etc/fatab file are:
PROC/PROC proc Defaults 0 0
Sysfs/sys Sysfs Defaults 0 0
Tmpfs/var TMPFS Defaults 0 0
Tmpfs/tmp TMPFS Defaults 0 0
Tmpfs/dev TMPFS Defaults 0 0
Etc/init.d/rcs Add the following: Mount-a
Mkdir/dev/pts
Mount-t devpts devpts/dev/pts
Echo/sbin/mdev >/proc/sys/kernel/hotplug
Mdev-s
4) Analysis
Executive Mdev-s:
Call the Mdev in the/sbin directory with "-S" as the parameter (actually Mdev is a soft link that passes the argument to the BusyBox program in the/bin directory and calls it).
Mdev scans all class device directories in the/sys/class and/sys/block directories, and if a file named "Dev" is included in the class device directory, and the file contains a device number, Mdev uses this information to create the device node file for this device in the/dev directory.
A "Mdev-s" is typically performed only once at startup.
Hot-swappable Event:
The command was executed at startup: Echo/sbin/mdev >/proc/sys/kernel/hotplug,
Then when a hot plug event is generated, the kernel calls the Mdev located in the/sbin directory.
At this point, mdev through action and DEVPATH in the environment variable to determine the action of this hot-swappable event and the class device directory that affected the/sys.
Then take a look at this class of equipment directory is known as "dev" files, if there is the use of this information for this device in the/dev directory to create or delete device node files and perform appropriate action actions.
5 Add to the Hot Plug event response to achieve the USB disk and SD card automatic mount and unloading load
# vi/etc/mdev.conf
Content is:
SD[A-Z][0-9] 0:0 666 @/etc/hotplug/usb/udisk_insert
SD[A-Z] 0:0 666 $/etc/hotplug/usb/udisk_remove
MMCBLK[0-9]P[0-9] 0:0 666 @/etc/hotplug/sd/sd_insert
MMCBLK[0-9] 0:0 666 $/etc/hotplug/sd/sd_remove
# Vi/etc/hotplug/usb/udisk_insert
Content is:
#!/bin/sh
Mkdir-p/media/udisk
Mount/dev/sda/media/udisk
# Vi/etc/hotplug/usb/udisk_remove
Content is:
#!/bin/sh
Umount/media/udisk
Add executable permissions to the above two scripts:
# chmod +x/etc/hotplug/usb/udisk_insert
# chmod +x/etc/hotplug/usb/udisk_remove

Attach: Explain the system to start a better article link: http://blog.csdn.net/zhoudaxia/article/details/6666872 (link)


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.