Bering-uClibc 5.x - Developer Guide - Appendices - Hardware-Specific Guides

From bering-uClibc
Revision as of 19:15, 3 July 2012 by Davidmbrooke (Talk | contribs) (Boot Disk Layout: Correct boot sequence details based on info from http://kernelnomicon.org/)

Jump to: navigation, search
Hardware-Specific Guides
Prev Bering-uClibc 5.x - Developer Guide

Introduction

This page provides guidelines for Bering-uClibc 5.x developers targeting specific hardware devices.

See also the equivalent page in the User Guide for hardware-specific information relevant to Users as well as Developers.


ARM CPU Architecture

Raspberry Pi Model B

Overview

The Raspberry Pi Model B has a Broadcom BCM2835 "system on a chip" integrated circuit containing an ARM1176JZF-S CPU which implements the ARMv6 CPU architecture standard.

  • As described here, the ARM1176JZF-S is an ARM1176JZ-S with the addition of a Vector Floating-Point (VFP) coprocessor. This means it can execute floating-point arithmetic in hardware rather than (only) in software.

A PDF data sheet for the BCM2835 can be downloaded from here. The BCM2835 contains a variety of devices and many of these seem to be identified with the string BCM2708 rather than BCM2835, judging by the example boot log from an Alpha board here

Linux Kernel Source

Many of the device drivers for the on-board peripherals are not currently (July 2012) included in the mainstream Linux source tree. The Raspberry Pi foundation have forked the Linux 3.1.9 kernel source and added the necessary drivers and a specific bcm2708 "platform". See the Raspberry Pi Git Hub repository

Another Git repository has these modifications merged with the latest Linux 3.2.x kernel. See Chris Boot's page here and his "bootc" Git Hub repository

TODO: Need to decide how to include the necessary drivers within the Bering-uClibc 5.x build system.

Linux Kernel Configuration

TODO - Which configuration settings are required / desirable.

Based on this post the relevant device drivers for the SD card interface are:

CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_BCM2708=y
CONFIG_MMC_SDHCI_BCM2708_DMA=y
# CONFIG_MMC_BCM2708 is not set

There does not seem to be any standard provision for loading an initramfs (initrd) file when booting the Raspberry Pi. That means we need to embed the Bering-uClibc 5.x initrd into the kernel using the CONFIG_INITRAMFS_SOURCE configuration variable.

Davidmbrooke 10:50, 1 July 2012 (UTC): Actually that's not (or no longer) the case: config.txt can contain an entry like the following:
ramfsfile initrd.cpio.gz

as described at the eLinux Wiki.

Boot Disk Layout

The Raspberry Pi must boot from its SD card and some vital files must be present in the root directory of the boot partition.

The latest versions of these files can be downloaded from the raspberrypi/firmware page on GitHub.

The first disk partition on the SD card must be formatted as a VFAT filesystem. It works OK if the partition type is 0xb (W95 FAT32). This partition does not have to to be marked as "bootable".

The boot sequence is as follows (based on content here):

  1. The first-stage bootloader, built into the very small on-chip ROM runs, and loads...
  2. A file called bootcode.bin which contains the second-stage bootloader. This runs, and loads...
  3. A file called loader.bin which contains the third-stage bootloader. This understands the ELF file format and loads...
  4. A file called start.elf which contains the GPU binary driver code. If the optional configuration file config.txt is present this is read and processed.
    • The syntax for config.txt is comprehensively documented at the eLinux Wiki.
    • By default start.elf loads a file called kernel.img, passing it the command line specified in file cmdline.txt
    • The default name kernel.img can be overriden by an entry like the following in config.txt
      kernel=u-boot.bin
    • Rather than having a separate cmdline.txt the kernel command line can also be specified by an entry like the following in config.txt
      cmdline=LEAFCFG=/dev/mmcblk0p1:vfat
  5. The file kernel.img is typically a standard uncompressed Linux kernel Image file
    • Old versions of the Raspberry Pi firmware demanded a special prefix to be added to the kernel file. As of June 2012 this is no longer the case.

Note that the Raspberry Pi references the first disk partition as /dev/mmcblk0p1 and the second disk partition as /dev/mmcblk0p2.



Prev Up