SBC8530 FAQ

1.Creating 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;


 * 1) cd ramdisk.gz
 * 2) gunzip ramdisk.gz

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

3. Unmount the image file;
 * 1) cd ramdisk
 * 2) umount /mnt/loop

4. Create a compressed file by using the altered file system;


 * 1) gzip –v9 ramdisk

Q2: How to create a new Root File System?

(Approach one)

1. Create a temporary mounting point for loop devices;


 * 1) mkdir /mnt/loop

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

3. Associate device file with the temporary file; 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;
 * 1) losetup /dev/loop0 /tmp/loop_tmp
 * 1) mke2fs –m 0 /dev/loop0

5. Mount the virtual disk on the mounting point /mnt/loop;
 * 1) 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; The file at /tmp/loop_tmp is the image of file system.
 * 1) cd /xx （xx means any directories except /mnt/loop）
 * 2) umount /mnt/loop

8. Compress the image file to create a file system; or
 * 1) gzip –v9 /tmp/loop_tmp >/tftpboot/ramdisk.gz
 * 1) gzip –v9 /tmp/loop_tmp

(Approach two) 1. Create a temporary mounting point for loop devices;
 * 1) mkdir /mnt/loop

2. Create a 15M temporary file;


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

3. Format loop_tmp as ext2 file system;


 * 1) mke2fs –F –v –m 0 /tmp/loop_tmp

4. Mount the formatted temporary file;


 * 1) 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;
 * 1) umount /mnt/loop

7. Compress the image file to create a file system;
 * 1) gzip –v9 /tmp/loop_tmp