Bering-uClibc 5.x - Developer Guide - Appendices - Hardware-Specific Guides
|Prev||Bering-uClibc 5.x - Developer Guide||Next|
- 1 Introduction
- 2 ARM CPU Architecture
- 2.1 Raspberry Pi Model B
- 2.2 Additional reading
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
Please note: The following instructions works only for Bering-uClibc 5.2 and above!
- 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
There is no Real-Time Clock so it is necessary to use an NTP or similar time source for accurate time keeping.
There is a USB interface (with 2 Type-A sockets) and also a 10/100 Ethernet interface, connected internally via the USB bus.
While there is no standard physical connector for an RS-232 serial interface, the GPIO header does support serial communications using 3.3V TTL signals. Something like a PL2303 adaptor can be used to convert these to USB for connection to a host computer running a terminal emulator.
Linux Kernel Source
Many of the device drivers for the on-board peripherals are currently (February 2015) not included in the mainstream Linux source tree.
Linux Kernel Configuration
SD Card Driver
Relevant device drivers and settings for the SD card interface as of linux kernel 3.14.x are:
CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_IO_ACCESSORS=y CONFIG_MMC_SDHCI_PLTFM=y # CONFIG_MMC_SDHCI_PXAV3 is not set # CONFIG_MMC_SDHCI_PXAV2 is not set CONFIG_MMC_SDHCI_BCM2708=y CONFIG_MMC_SDHCI_BCM2708_DMA=y
Note: More kernel options have to be set, to boot from SD Card, esp enabling USB storage (see below for a link to a complete kernel configuration).
The USB interface driver is the DWC OTG Controller:
The Ethernet interface chip is an SMC 91X-compatible device:
The Linux kernel 3.14.x configuration file for LEAF Bering-uClibc, which is known to boot, can be found in our git repository - at the time of writing Bering-3.14.33.config-bcmrpi.
Considerations about initrd
We use two files during boot, initrd.lrp, providing the basic stuff to boot, and initmod-bcmrpi.lrp with architecture specific modules.
While the bootloader of Raspberry Pi supports loading an initramfs (initrd) file to boot, it fails to load more than one file (initrd.lrp and initmod-bcmrpi.lrp), as other hardware does.
So we first have to concatenate the two files into one. This is done with the following commands:
mv initrd.lrp initrd.gz mv initmod-bcmrpi.lrp initmod-bcmrpi.gz cat initrd.gz initmod-bcmrpi.gz > initrd-rpi.gz mv initrd-rpi.gz initrd-rpi.lrp
A shorter version of the command above works also:
cat initrd.lrp initmod-bcmrpi.lrp > initrd-rpi.lrp
initrd-rpi.lrp then needs to declared in
as described at the eLinux Wiki.
initramfs initrd-rpi.lrp 0x00a00000
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):
- The first-stage bootloader, built into the very small on-chip ROM runs, and loads...
- A file called
bootcode.binwhich contains the second-stage bootloader. This runs, and loads...
- A file called
start.elfwhich contains the GPU binary driver code. If the optional configuration file
config.txtis present this is read and processed.
- The syntax for
config.txtis comprehensively documented at the eLinux Wiki.
- By default
start.elfloads a file called
kernel.img, passing it the command line specified in file
- The default name
kernel.imgcan be overriden by an entry like the following in
linuxis the (renamed) kernel build with the Bering-uClibc toolchain. The file
kernel.imgis typically a standard uncompressed Linux kernel
Imagefile. The kernel
linux-[version]-bcmrpi, as it has been build within the Bering-uClibc toolchain, is an uncompressed Linux kernel and shall be renamed to
linuxwhile copying to your Raspberry Pi.
- The initrd file
initrd.lrphas to be added to
initramfs initrd.lrp 0x00a00000
- The kernel command line is declared in
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline LEAFCFG=/dev/mmcblk0p1:vfat init=/linuxrc root=/dev/ram0 rw rootwait reboot=biosThe most important entry is
LEAFCFG=/dev/mmcblk0p1:vfatwhich points to the file
leaf.cfg, that loads the remaining files to be loaded during the boot process.
- The syntax for
Note that the Raspberry Pi references the first disk partition as
/dev/mmcblk0p1 and the second disk partition as
Install LEAF Bering-uClibc on a SD card side-by-side with raspbian
This section explains how to install LEAF Bering-uClibc side-by-side with raspbian, a debian based image for Raspberry Pi. You will be able to start either raspbian or LEAF-Bering-uClibc, so it is considered as a testbed for LEAF-Bering-uClibc for Raspberry Pi, while you still can double check your hardware with a setup known to work (raspbian).
- Flash a SD card with raspbian as described here. The SD card will afterwards have a boot partition and second partition containing the data files.
- Download the latest LEAF Bering-uClibc tarball for Raspbian Pi from the File Release System of leaf.sourceforge.net. The tarball is named Bering-uClibc_[version-nn]_bcmrpi.tar.gz (at the time of writing Bering-uClibc_5.1-alpha1_bcmrpi.tar.gz). And extract the tarball into a temporary directory.
- Mount the boot directory of your SD card. Copy the files
cmdline.txtfrom the extracted tarball to the boot partition of your SD card.
- Create a file
leaf.cfgwith the content:
# Uncomment for more verbose execution. # VERBOSE=1 LRP="root local iptables dropbear shorwall shorwall6 keyboard dnsmasq bbntpd libz dhcpcd ulogd nano" PKGPATH=/dev/mmcblk0p2:ext4 syst_size=42M log_size=16M zswap_size=50M
- Umount the boot partition and mount the second partition with the data.
- Copy the remaining Packages files onto the second partition. The minimum of Packages is:
root.lrp etc.lrp nano.lrp ncurses.lrp ulogd.lrp shorwall.lrp shorewall6.lrp iptables.lrp libnetfilter_log.lrp libnetfilter_cttimeout.lrp libnetfilter_conntrack.lrp libnetfilter_acct.lrp modules.lrp libnfnetlink.lrp liblzo.lrp dhcpcd.lrp dnsmasq.lrp keyboard.lrp dropbear.lrp perl.lrp libdigest-sha1-perl.lrp config.lrp local.lrp bbntpd.lrp
- Finally copy
moddb-bcmrpi.lrpfrom the extracted tarball to
moddb.lrpon your SD card.
- Umount the data partition, insert the SD card into your Raspberry Pi and reboot it.