Documentation:AVR32 Linux Development/Programming an SD card with the AVR32 Linux file system

From AVRFreaks Wiki

Jump to: navigation, search

A prebuilt AVR32 Linux image for the STK1000 can be found in the BSP CD at /BSP-CD/builds/stk1000/avr32-linux-image.img.gz. Building the AVR32 Linux file system for the STK1000 describes how to build your own file system image.

[edit] Linux users

  • Insert an SD card into an SD card reader, and use df to see how it is mounted
# df
Filesystem  1k-blocks  ...  Mounted on
/dev/hda1   ...        ...  ...
...         ...        ...  ...
/dev/sda1   ...        ...  /media/usbdisk-1

In this this example we will assume that /dev/sda1 is mounted on /media/usbdisk-1.

  • Format the SD card and create an ext2 file system
# sudo umount /media/usbdisk-1
# sudo /sbin/e2fsck /dev/sda1
# sudo /sbin/mkfs.ext2 /dev/sda1
# sudo mount /dev/sda1 /media/usbdisk-1
  • Unpack the AVR32 Linux file system included on the BSP CD
# mkdir /tmp/avr32_image_source
# cd /tmp/avr32_image_source
# cp /bsp-cd/builds/avr32-linux-image.img.gz .
# gunzip avr32-linux-image.img.gz
  • Mount the AVR32 Linux file system image
# mkdir /tmp/avr32_image
# sudo mount -o loop /tmp/avr32_image_source/avr32-linux-image.img /tmp/avr32_image
  • Copy file system content to SD card
# sudo cp -a /tmp/avr32_image/* /media/usbdisk-1
  • Unmount SD card to ensure that the SD-card write procedure is completed
# sudo umount /dev/sda1
  • (optional) unmount the temporary avr32 source folder
# sudo umount /tmp/avr32-image


[edit] Troubleshooting

PROBLEM: Does the console show u-boot messages, but no longer shows the Linux output?

Answer: The name for the serial port has changed between BSP1.0 and BSP2.0. In your u-boot environment variables, change "ttyUS0" to "ttyS0", leaving the rest of the line unchanged. This should show you the output in Linux now!


PROBLEM: Did you receive the following error message after following the above procedure - "Unsupported Architecture 0x11"?

...
## Booting image at 90400000 ...
   Image Name:   Linux-2.6.18-at1
   Image Type:   Unknown Architecture Linux Kernel Image (gzip compressed)
   Data Size:    879298 Bytes = 858.7 kB
   Load Address: 10000000
   Entry Point:  90000000
   Verifying Checksum ... OK
Unsupported Architecture 0x11

Answer: The version of u-boot is outdated. Use the u-boot.bin file found on the BSP-CD/builds/stk1000/ and follow this guide to upgrade your u-boot. Information gathered from the following AVR32 Linux Forum thread.

PROBLEM: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

...
VFS: Cannot open root device "mmcblk0p1" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00        128 mtdblock0 (driver?)
1f01       8000 mtdblock1 (driver?)
1f02         64 mtdblock2 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

Answer: The bootargs need to be updated with the 'rootwait' option. See AVR32 Linux Patches. Get to the 'Uboot' prompt by hitting the space key on the serial console immediately after reset. Use the 'printenv', 'askenv', and 'saveenv' commands to check, update, and save the bootargs. Kernel version Linux-2.6.23 booted fine with these bootargs:

bootargs=console=ttyS0 root=/dev/mmcblk0p1 fbmem=600k rootwait

Personal tools