Friday, March 05, 2010

Embedded PowerPC

CFE (Common Firmware Environment) from broadcom. U-boot from DENX. There are bootloaders, just like grub, lilo. They are used to boot linux kernels.

uImage: a container of linux kernel and maybe ramdisk. U-boot and CFE both support this format. The uImage has 64 bytes file header which describe the images it contains followed by the images.

FDT: Flat Device Tree. This is a standard format to describe hardware of the embedded system. The bootloader passes FDT to linux kernel to help him boot. Usually, you need a DTS file and use DTC to convert it into DTB file. The the bootloader will parse the file and give it the the kernel. For CFE and MPC8548 device, the FDT is hardcoded in CFE. Here are details of FDT. “A Symphony of Flavours: Using the device tree to describe embedded hardware”.

Usually to boot a embedded ppc system. You need:

  1. bootloader. I use CFE as it is already on the system.
  2. uImage. I get kernel source from web and use ELDK 4.1 to compile it.
  3. rootfs. The root filesystem can contain init files, kernel modules and applications. I get two, one from ELDK and another from an existing uImage.

Besides, you may also setup tftp server and nfsd server. TFTP server is used to store uImage and nfsd server can be the rootfs.

Here is some tips to get ramdisk from uImage.

  1. use mkimage to get size of ramdisk. mkimage –l uImage
  2. calcaluate the offset of ramdisk. Suppose the ramdisk is the last image in uImage. Its offset is the (total length of uImage) - (length of ramdisk)
  3. Use dd to get ramdisk. dd if=uImage –bs=offset skip=1 =of=ramdisk.gz
  4. The rest can be found here. To note, not all ramdisk can be mounted. Some ramdisk is cpio archive. You need to use cpio –i –no-absolute-filenames < ramdisk to extract its content.

No comments: