Create a RAM disk

Source: Internet
Author: User

1. Create an image file

Generate a file that can be virtualized into a device. The file name is init. IMG.

# Dd If =/dev/Zero of = init. img bs = 102 COUNT = 500

Note: BS * count indicates the block device size (byte)

Format a block Device

# Mke2fs-M0-F init. img

2. configure root FS (root file system)

Load init. IMG and romfs to the host file system.

A. The current directory uClinux-DIST has two empty directories: Ram and Rom. Copy romfs. IMG from images/to uClinux-Dist /.

# Mount init. img ram/-o loop

# Mount romfs. img rom/-o loop

B. Create a directory required by ramfs, that is, create a subdirectory In the ram directory.

# Mkdir RAM/bin

# Mkdir RAM/dev

# Mkdir RAM/etc

# Mkdir RAM/var

C. Copy the required files from the ROM directory to the ram directory (ramfs)

# Cp-a ROM/etc/* RAM/etc/

# Cp-a ROM/bin/sh RAM/bin

# Cp-a ROM/bin/init RAM/bin/init

D. Create device Node)

# Mknod RAM/dev/ttys0 C 4 64

# Mknod RAM/dev/console C 5 1

3. Uninstall init. IMG and romfs. IMG to save init. IMG.

# Umount Ram

# Umount Rom

 

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.