Wednesday, July 29, 2009

prepare new MMC and try Angstrom image

Let's prepare a new MMC from a Linux host.
I closely followed this. The goal is not to destroy anything on the flash of the BB, but to boot u-boot from MMC and have the Linux kernel as well as the root file system (rootfs) on the MMC. I have a 4G SanDisk, which already has the right geometry, so I don't need to play around with fdisk expert settings.

After plugging the MMC let's see where Linux sees it.
fdisk -l

...

Disk /dev/sdc: 4075 MB, 4075290624 bytes
255 heads, 63 sectors/track, 495 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x06a9d646

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 496 3979744+ c W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
phys=(494, 254, 63) logical=(495, 117, 6)

...

So in my case on /dev/sdc1.

In order to create a bootable SD/MMC card under Linux compatible with OMAP3 boot ROM, you have to set a special geometry in the partition table, which is done through the fdisk "Expert mode", which I will skip, since my MMC already has the right geometry.

First, lets clear the partition table:
sudo fdisk /dev/sdc

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): o
Building a new DOS disklabel with disk identifier 0xf9180393.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Let's see the partitions
Command (m for help): p

Disk /dev/sdc: 4075 MB, 4075290624 bytes
255 heads, 63 sectors/track, 495 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf9180393

Device Boot Start End Blocks Id System
I'm happy to have the right geometry (255 heads, 63 sectors/track), so I don't need to enter expert mode. In case you need to do so check here.

Create a DOS partition
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-495, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-495, default 495): +50

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l

0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris
1 FAT12 24 NEC DOS 81 Minix / old Lin c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 82 Linux swap / So c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec (FAT-
4 FAT16

Create a Linux (ext3) partition

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (52-495, default 52):
Using default value 52
Last cylinder, +cylinders or +size{K,M,G} (52-495, default 495):
Using default value 495

Print out our new partitions
Command (m for help): p

Disk /dev/sdc: 4075 MB, 4075290624 bytes
255 heads, 63 sectors/track, 495 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf9180393

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 51 409626 c W95 FAT32 (LBA)
/dev/sdc2 52 495 3566430 83 Linux
Write it to the MMC
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
Format the dos parition
sudo mkfs.msdos -F 32 /dev/sdc1 -n MMC_msdos
mkfs.msdos 3.0.1 (23 Nov 2008)
Format the ext3 partition
sudo mkfs.ext3 /dev/sdc2 -L MMC_ext3
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=MMC_ext3
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
223104 inodes, 891607 blocks
44580 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=914358272
28 block groups
32768 blocks per group, 32768 fragments per group
7968 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

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

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
mount the new partitons:
/dev/sdc1 on /media/MMC_msdos type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,
uid=1001,utf8,umask=077,flush)

/dev/sdc2 on /media/MMC_ext3 type ext3 (rw,nosuid,nodev,uhelper=hal)

Download Angstrom demo images from here.

Copy them to the MMC:
sudo cp MLO /media/MMC_msdos/
sudo cp u-boot.bin /media/MMC_msdos/
sudo cp uImage /media/MMC_msdos/
(Note that the link to the kernel on the website does not point to the latest image)
sudo cp Angstrom-Beagleboard-demo-image-glibc-ipk-2009.X-stable-20090612--beagleboard.rootfs.tar.bz2 /media/MMC_ext3/
untar the root file system on the card


cd /media/MMC_ext3/

sudo tar -jxvf Angstrom-Beagleboard-demo-image-glibc-ipk-2009.X-stable-20090612--beagleboard.rootfs.tar.bz2
remove the tarred root-fs from the card
sudo rm -f Angstrom-Beagleboard-demo-image-glibc-ipk-2009.X-stable-20090612--beagleboard.rootfs.tar.bz2 
Let's run it.
mmc init

fatload mmc 0 80000000 uImage

setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rw
rootfstype=ext3 rootwait omap-dss.def_display=dvi omapfb.vram=2M,4M
omapfb.video_mode=1280x720MR-24@60 omapfb.debug=y'
bootm 80000000


u-boot version: U-Boot 2009.06-rc2 (Jun 05 2009 - 10:19:13)

login from the serial console as root


uname -r
2.6.28-omap1

cat /etc/angstrom-version
Built from branch: stable/2009
Revision: 1679705e3c22180b39126fdfa8a39c02e550b450

What we've got now?
  • The beagle from u-boot is missing
  • u-boot syntax changed from mmcinit to mmc init
  • It's possible to log in to Angstrom now and after a successful log in you end up in a graphical environment
  • The screen resolution still shows only the top half of the monitor (and yes, I tried more screen resolutions than the one I showed here, but they did not show anything)
Let's be adventurous and try the latest demo kernel.

Let's run it.
mmc init

fatload mmc 0 80000000 uImage-2.6.29-r37

setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rw
rootfstype=ext3 rootwait omap-dss.def_display=dvi omapfb.vram=2M,4M
omapfb.video_mode=1280x720MR-24@60 omapfb.debug=y'

bootm 80000000

uname -r

2.6.29-omap1

cat /etc/angstrom-version

What we've got now?
  • a newer kernel
  • the same problems as above
  • no video output from the board
I guess like many others I will need to hunt for the right parameters and it's not obvious to me what I shall put.

No comments:

Post a Comment