Difference between revisions of "DevKit8600 FAQ"

From eLinux.org
Jump to: navigation, search
Line 5: Line 5:
 
Let’s assume there is a compressed file system named ramdisk.gz. We could realize alteration on it by the following steps:
 
Let’s assume there is a compressed file system named ramdisk.gz. We could realize alteration on it by the following steps:
  
<nowiki>1. Uncompress the file into an image file;
+
1. Uncompress the file into an image file;
 
+
<nowiki>#cd ramdisk.gz</nowiki>
#cd ramdisk.gz
+
<nowiki>#gunzip ramdisk.gz</nowiki>
 
 
#gunzip ramdisk.gz
 
  
 
2. Mount the uncompressed image file to realize alteration;
 
2. Mount the uncompressed image file to realize alteration;
 
+
<nowiki>
#mkdir /mnt/loop
+
<nowiki>#mkdir /mnt/loop</nowiki>
 
+
<nowiki>#mount –o loop ramdisk /mnt/loop</nowiki></nowiki>
#mount –o loop ramdisk /mnt/loop
+
<nowiki>#cd /mnt/loop</nowiki>
 
 
#cd /mnt/loop
 
 
 
 
Now the contents of the file system can be added, removed, or modified as required.
 
Now the contents of the file system can be added, removed, or modified as required.
  
 
3. Unmount the image file;
 
3. Unmount the image file;
 
+
<nowiki>#cd ramdisk</nowiki>
#cd ramdisk
+
<nowiki>#umount /mnt/loop</nowiki>
 
 
#umount /mnt/loop
 
  
 
4. Create a compressed file by using the altered file system;
 
4. Create a compressed file by using the altered file system;
 +
<nowiki>#gzip –v9 ramdisk</nowiki>
  
#gzip –v9 ramdisk
+
Q2: '''How to create a new Root File System?'''
 
 
Q2: How to create a new Root File System?
 
 
 
 
(Approach one)
 
(Approach one)
  
1. Create a temporary mounting point for loop devices;
+
<nowiki>1. Create a temporary mounting point for loop devices;</nowiki>
 
+
<nowiki>#mkdir /mnt/loop</nowiki>
#mkdir /mnt/loop
 
 
 
2. Create a 15M temporary file;
 
 
 
#dd if=/dev/zero of=/tmp/loop_tmp bs=1k count=15360
 
  
 +
<nowiki>2. Create a 15M temporary file;</nowiki>
 +
<nowiki>#dd if=/dev/zero of=/tmp/loop_tmp bs=1k count=15360</nowiki>
 
The size of the temporary file could be changed by adjusting the value of the parameter count;
 
The size of the temporary file could be changed by adjusting the value of the parameter count;
  
3. Associate device file with the temporary file;
+
<nowiki>3. Associate device file with the temporary file;</nowiki>
 
+
<nowiki>#losetup /dev/loop0 /tmp/loop_tmp</nowiki>
#losetup /dev/loop0 /tmp/loop_tmp  
 
 
 
 
If a message ‘ioctl:LOOP_SET_FD: device is busy’ appears, it indicates that the device /dev/loop0 is still associated with another file. Command losetup /dev/loop0 can be used to view the device, and remove it with parameter -d;
 
If a message ‘ioctl:LOOP_SET_FD: device is busy’ appears, it indicates that the device /dev/loop0 is still associated with another file. Command losetup /dev/loop0 can be used to view the device, and remove it with parameter -d;
  
 
4. Format /dev/loop0 as ext2 file system;
 
4. Format /dev/loop0 as ext2 file system;
 
+
<nowiki>
#mke2fs –m 0 /dev/loop0
+
#mke2fs –m 0 /dev/loop0</nowiki>
  
 
5. Mount the virtual disk on the mounting point /mnt/loop;
 
5. Mount the virtual disk on the mounting point /mnt/loop;
 
+
<nowiki>#mount –t ext2 /dev/loop0 /mnt/loop;</nowiki>
#mount –t ext2 /dev/loop0 /mnt/loop;
 
  
 
6. Copy all the required files to the virtual disk by the command cp -af;
 
6. Copy all the required files to the virtual disk by the command cp -af;
  
7. Move from current directory /mnt/loop to another directory by the command cd, and then unmount the file system;
+
<nowiki>7. Move from current directory /mnt/loop to another directory by the command cd, and then unmount the file system;</nowiki>
 
+
<nowiki>#cd /xx (xx means any directories except /mnt/loop)</nowiki>
#cd /xx (xx means any directories except /mnt/loop)
 
 
 
 
#umount /mnt/loop  
 
#umount /mnt/loop  
  
Line 80: Line 63:
 
1. Create a temporary mounting point for loop devices;
 
1. Create a temporary mounting point for loop devices;
  
#mkdir /mnt/loop
+
<nowiki>#mkdir /mnt/loop</nowiki>
  
 
2. Create a 15M temporary file;
 
2. Create a 15M temporary file;
  
#dd if=/dev/zero of=/tmp/loop_tmp bs=1k count=15360
+
<nowiki>#dd if=/dev/zero of=/tmp/loop_tmp bs=1k count=15360</nowiki>
  
 
3. Format loop_tmp as ext2 file system;
 
3. Format loop_tmp as ext2 file system;
  
mke2fs –F –v –m 0 /tmp/loop_tmp  
+
<nowiki>#mke2fs –F –v –m 0 /tmp/loop_tmp</nowiki>
  
 
4. Mount the formatted temporary file;
 
4. Mount the formatted temporary file;
  
#munt –o loop /tmp/loop_tmp /mnt/loop  
+
<nowiki>#munt –o loop /tmp/loop_tmp /mnt/loop</nowiki>
  
5. Copy all the required files to the temporary file by the command cp –af to create an image file;
+
<nowiki>5. Copy all the required files to the temporary file by the command cp –af to create an image file;</nowiki>
  
 
6. Unmount the created image file;
 
6. Unmount the created image file;
  
#umount /mnt/loop  
+
<nowiki>#umount /mnt/loop</nowiki>
  
 
7. Compress the image file to create a file system;
 
7. Compress the image file to create a file system;
  
#gzip –v9 /tmp/loop_tmp</nowiki>
+
<nowiki>#gzip –v9 /tmp/loop_tmp</nowiki>

Revision as of 03:27, 6 November 2012

How to create ramdisk under Linux

Q1: How to alter an existing Root File System?

Let’s assume there is a compressed file system named ramdisk.gz. We could realize alteration on it by the following steps:

1. Uncompress the file into an image file; #cd ramdisk.gz #gunzip ramdisk.gz

2. Mount the uncompressed image file to realize alteration; <nowiki>#mkdir /mnt/loop #mount –o loop ramdisk /mnt/loop</nowiki> #cd /mnt/loop Now the contents of the file system can be added, removed, or modified as required.

3. Unmount the image file; #cd ramdisk #umount /mnt/loop

4. Create a compressed file by using the altered file system; #gzip –v9 ramdisk

Q2: How to create a new Root File System? (Approach one)

1. Create a temporary mounting point for loop devices; #mkdir /mnt/loop

2. Create a 15M temporary file; #dd if=/dev/zero of=/tmp/loop_tmp bs=1k count=15360 The size of the temporary file could be changed by adjusting the value of the parameter count;

3. Associate device file with the temporary file; #losetup /dev/loop0 /tmp/loop_tmp If a message ‘ioctl:LOOP_SET_FD: device is busy’ appears, it indicates that the device /dev/loop0 is still associated with another file. Command losetup /dev/loop0 can be used to view the device, and remove it with parameter -d;

4. Format /dev/loop0 as ext2 file system; #mke2fs –m 0 /dev/loop0

5. Mount the virtual disk on the mounting point /mnt/loop; #mount –t ext2 /dev/loop0 /mnt/loop;

6. Copy all the required files to the virtual disk by the command cp -af;

7. Move from current directory /mnt/loop to another directory by the command cd, and then unmount the file system; #cd /xx (xx means any directories except /mnt/loop)

  1. umount /mnt/loop

The file at /tmp/loop_tmp is the image of file system.

8. Compress the image file to create a file system;

  1. gzip –v9 /tmp/loop_tmp >/tftpboot/ramdisk.gz

or

  1. gzip –v9 /tmp/loop_tmp

(Approach two)

1. Create a temporary mounting point for loop devices;

#mkdir /mnt/loop

2. Create a 15M temporary file;

#dd if=/dev/zero of=/tmp/loop_tmp bs=1k count=15360

3. Format loop_tmp as ext2 file system;

#mke2fs –F –v –m 0 /tmp/loop_tmp

4. Mount the formatted temporary file;

#munt –o loop /tmp/loop_tmp /mnt/loop

5. Copy all the required files to the temporary file by the command cp –af to create an image file;

6. Unmount the created image file;

#umount /mnt/loop

7. Compress the image file to create a file system;

#gzip –v9 /tmp/loop_tmp