Convert PiLFS to work with BerryBoot / Raspberry Pi

Convert PiLFS to work with BerryBoot / Raspberry Pi

raspberry pi berryboot PiLFSThe Linux from scratch (LFS) project has been around for quite a while now, but how about LFS for the Raspberry Pi ?

Well you’re in luck, there is a project and a manual for doing just that. PiLFS project

They even provide you with a complete base image file that will work just fine with the Raspberry Pi, but I wanted it to work with the berryboot setup. So here is how to convert the PiLFS image file into something that the Berryboot system can work with.

Download Image file PiLFS img

Using a linuxbox, I used Ubuntu running in virtualbox to complete this part but you can use whatever flavour your prefer.

sudo apt-get update
sudo apt-get install kpartx
sudo apt-get install squashfs-tools

sudo kpartx -av pilfs_image_file.img
add map loop0p1 (252:5): 0 117187 linear /dev/loop0 1
add map loop0p2 (252:6): 0 3493888 linear /dev/loop0 118784
sudo mkdir /mnt/tmp
sudo mount /dev/mapper/loop0p2 /mnt
sudo sed -i 's/^/dev/mmcblk/#�/g' /mnt/tmp/etc/fstab
sudo mksquashfs /mnt/tmp new_pilfs_image_file.img -comp lzo -e lib/modules
sudo umount /mnt
sudo kpartx -d pilfs_image_file.img

Copy the output img file to a USB drive, Plug it into your raspberry pi, reboot, at your berryboot menu choose, edit, click and hold add os, choose from usb source, select your new image file.

When the file has been copied you will be able to bootup PiLFS 🙂

Simple and easy as that, PiLFS does come with ssh server installed so you can ssh into it over the network from the get go.

To configure your wifi use the command wpa_passphrase

wpa_passphrase your_SSID your_password > /etc/sysconfig/wpa_supplicant-wlan0.conf

Remember this is just a base system for you to build on and learn.

Happy Hacking! 🙂

Leave a Reply

Be the First to Comment!

Notify of