Chinaunix首页 | 论坛 | 博客
  • 博客访问: 842048
  • 博文数量: 244
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 2420
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-29 09:07
文章分类

全部博文(244)

文章存档

2011年(4)

2010年(3)

2009年(72)

2008年(119)

2007年(46)

我的朋友

分类: LINUX

2009-05-31 10:06:11

LinuxBootDiskFormat  
How to create a dual-partition card for BeagleBoard to boot Linux from first partition and have root file system at second partition.

Determine which device the SD Card Reader is on your system

Plug the SD Card into the SD Card Reader and then plug the SD Card Reader into your system. After doing that, do the following to determine which device it is on your system.

$ [dmesg | tail]
...
[ 6854.215650] sd 7:0:0:0: [sdc] Mode Sense: 0b 00 00 08
[ 6854.215653] sd 7:0:0:0: [sdc] Assuming drive cache: write through
[ 6854.215659]  sdc: sdc1
[ 6854.218079] sd 7:0:0:0: [sdc] Attached SCSI removable disk
[ 6854.218135] sd 7:0:0:0: Attached scsi generic sg2 type 0
...

In this case, it shows up as /dev/sdc (note sdc inside the square brackets above).

$ [df -h]
Filesystem            Size  Used Avail Use% Mounted on
...
/dev/sdc1             400M   94M  307M  24% /media/disk
...

Be sure to choose the whole device (/dev/sdc), not a single partition (/dev/sdc1).

$ [sudo fdisk /dev/sdc]

Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         246     1974240+   c  W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
     phys
=(244, 254, 63) logical=(245, 200, 19)

Expert Command (m for help): [c]
Number of cylinders (1-256, default xxx): [enter the number you calculated]

Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   
Device Boot      Start         End      Blocks   Id  System

Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          51      409626    c  W95 FAT32 (LBA)
/dev/sdc2              52         245     1558305   83  Linux

$ [sudo mkfs.msdos -F 32 /dev/sdc1 -n LABEL1]
mkfs
.msdos 2.11 (12 Mar 2005)

$
[sudo mkfs.ext3 -L LABEL2 /dev/sdc2]
mke2fs
1.40-WIP (14-Nov-2006)
Filesystem label=
OS type
: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
195072 inodes, 389576 blocks
19478 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=402653184
12 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
       
32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information:

console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1

Comment by , Aug 12, 2008

Typical usage with uImage in 1st partition and rootfs in 2nd partition:

setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1' setenv bootcmd 'mmcinit;fatload mmc 0 80300000 uImage;bootm 80300000'

Comment by , Nov 13, 2008

When I used the FAT32 partition and it worked fine for me.

Comment by , Mar 04, 2009

when I followed the above procedure, sometimes I can have two partitions when I plug the SD card again. sometime only the first partition appears, what about the problem?

Comment by , Mar 12, 2009

Be careful not to type 't' '1' 'c' - if you follow the above to the letter, you don't need to specify the partition number to change the type for. You know you have done it wrong if the partition type for partition 1 is now set to 'FAT12'. The spurious 'c' will then toggle some compatibility flags that may affect your system.

阅读(798) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~