[Clfs-dev] Raspberry Pi embedded adventures

William Harrington kb0iic at berzerkula.org
Fri Dec 6 09:58:48 PST 2013


Greetings,

Ahoy mateys. Been using the Raspberry Pi model B, which Andrew  
Bradford sent to me.

I followed the embedded book, but with these changes:

GCC 4.8.2 (same configure options, straight forward)
Binutils 2.24 (don't need musl patch anymore and texinfo changes are  
in there for bdf)
Musl-libc patch from Gregor for Gcc-4.8.1 (applies to gcc-4.8.2 except  
one hunk which needs to be edited out as it isn't needed anymore).

For iptables, I ran into a snag and couldn't find any help for  
building it with musl-libc.

CLFS_TARGET I set to armv6l-unknown-linux-musleabihf
CLFS_FLOAT=hard
CLFS_FPU=vfp
CLFS_ARM_ARCH=armv6

For the kernel headers, I did the following:

Grab the kernel source and tools

git clone https://github.com/raspberrypi/tools.git
git clone https://github.com/raspberrypi/linux.git

Install the headers as normal from the download linux.git repository.

For building the kernel and creating the kernel.img:
cd linux  (then do the book commands for the kernel)
bcmrpi_cutdown_defconfig for a default config, or bcmrpi_defconfig or  
use your raspberry pi's host OS config.

After the kernel is built do the following for the kernel.img:

cd ../tools/mkimage/
./imagetool-uncompressed.py ../../linux/arch/arm/boot/Image

I installed RiscOS, Arch, and Debian from the NOOB set, and I replaced  
the Arch config to boot CLFS.
I also used a hard drive rather than the flash drive for the OS. But  
it doesn't matter where it is.
Edit the cmdline.txt at the filesystem you want changed for the  
raspberry pi bootloader.

You can change the icon (icon.png) for the boot menu.

Here is my setup:

Installed Os's for the boot menu are at partition 3 of my sdcard: /dev/ 
mmcblk0p3

installed_os.json is as follows:
=======================
[
  {
   "description" : "RISC OS is a very fast and compact system",
   "folder" : "/settings/os/RISC_OS",
   "icon" : "/settings/os/RISC_OS/icon.png",
   "name" : "RISC OS",
   "partitions" : [
"/dev/mmcblk0p5",
"/dev/mmcblk0p6"
   ],
   "release_date" : "2013-07-10"
  },
  {
   "description" : "Cross-LFS Embedded GIT build for ARM devices",
   "folder" : "/settings/os/Arch",
   "icon" : "/settings/os/Arch/icon.png",
   "name" : "CLFS-Embedded",
   "partitions" : [
"/dev/mmcblk0p7",
"/dev/mmcblk0p8"
   ],
   "release_date" : "2013-10-24"
  },
  {
   "description" : "Adds an empty 512MB ext4 format partition to the  
partition layout.",
   "folder" : "/settings/os/Data_Partition",
   "icon" : "/settings/os/Data_Partition/icon.png",
   "name" : "Data Partition",
   "partitions" : [
"/dev/mmcblk0p9"
   ],
   "release_date" : null
  },
  {
   "description" : "A Debian wheezy port, optimised for the Raspberry  
Pi",
   "folder" : "/settings/os/Raspbian",
   "icon" : "/settings/os/Raspbian/icon.png",
   "name" : "Raspbian",
   "partitions" : [
"/dev/mmcblk0p10",
"/dev/mmcblk0p11"
   ],
   "release_date" : "2013-09-25"
  }
]


Make note of description, folder, icon, name settings. I still have  
remnants of Arch because I was testing. CLFS is in Arch's place.
The icon to change is at os/Arch/icon.png  (needs to be png).

You can unmount the filesystem for editing the boot menu items.

Now to mount the partition which has the information for booting the OS.
Arch was installed at /dev/mmcblk0p7 and there is the cmdline.txt,  
config.txt

Since I have CLFS at my hard drive via usb, I edit cmdline.txt (some  
settings left from arch install):

ipv6.disable=1 avoid_safe_mode=1 selinux=0 plymouth.enable=0  
smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda3  
rootdelay=5 rootfstype=ext4 elevator=noop loglevel=5 printk.time=0

Copy the kernel.img from above to the current location where  
kernel.img is right now.

Unmount the filesystem, and reboot. You should then see the newly  
edited entry at the boot menu and it should boot into your new system.

Also, disable fsck for rootfs in the startup script at /etc/rc.d (I  
think that is where it is) otherwise it'll keep rebooting on you.

I created bootscripts for udhcpc and ntpd. You'll want the date set at  
boot as there is no hardware clock with the Raspberry Pi.

Sincerely,

William Harrington



More information about the Clfs-dev mailing list