0% found this document useful (0 votes)
158 views

How To Build Your Own Image For Raspberry PI 4 - Home Connected Device Innovation - Confluence For Orange

installation de Rasbian sur Raspberry 4

Uploaded by

Ramparany
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views

How To Build Your Own Image For Raspberry PI 4 - Home Connected Device Innovation - Confluence For Orange

installation de Rasbian sur Raspberry 4

Uploaded by

Ramparany
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Pages / … / prplOS

How to build your own image for Raspberry PI 4


Créée par GUELEC Stephane, dernière modification par MARCHE Mikael IMT/OLPS le janv. 04, 2023

based on the Howto page written by Gwendal Bretagne on the prplfoundation confluence space

Materials
Environment
1°) Create your own docker image to compile prplOS
Get the prplOS code
Build peplos
Prepare src
Configure src
Compile the kernel to support USB-Ethernet adaptor (OPTIONAL)
Flashing your micmake kernel_menuconfigro-SD card
with img.gz
with iso
Networking
Troubleshooting
Depedences
This document describes how I managed to build and flash prplOS on a Raspberry PI 4B. I assume that there is multiple other ways to do it or to improve the process. Feel free to add comment to
help the community and improve this document.

Materials
You can find : https://sharingspace.tech.orange/s/m2PbZ9jReAzrQ25 (mdp : M@tt3r-Thr3@d)
prebuild images and config files associated working with LXC
docker file referenced in this document

Environment
Raspberry pi 4B,
Ubuntu with docker engine (install docker ce : https://docs.docker.com/engine/install/ubuntu/) and git (sudo apt install git) installed.

1°) Create your own docker image to compile prplOS


prpl is based on openWRT. OpenWRT has already an image builder docker image ready to use (https://hub.docker.com/r/openwrtorg/imagebuilder). So we'll start by installing this image. I used
BERNHARD Raphaël Docker file :

Dockerfile Développer la source


It will permit to simplify a lot the process. In my case, I created a directory named prpl under my home directory named prpl (you can place it wherever you want). In this document, we'll asume
that the directory you created is located at "/path/to/your/created/directory/"
I placed the Dockerfile named "Dockerfile" in this directory containing the content above. Then I created my own image by executing :

Build command

docker build -t TheNameYouWant .

Then, we'll start the docker image in interactive mode :

Start the docker

docker run -it --rm -v /path/to/your/created/directory/:/src TheNameYouWant

You can remove "–rm" from the command line if you want to keep this image instance for further tests / purposes.
Now, the open prompt is in the docker image you just built. It is the one you will use to compile your code.

Get the prplOS code


Once the docker image is running, you can open another prompt in which you will download prplOS source code. You need first to be located at "/path/to/your/created/directory/". Then, execute
these commands :

Cloning Développer la source

Nota : the option -b prplos allow to clone from another branch of prplos with the support of OpenWRT 22.03, which include the support of rpi4B

Build peplos
Steps and commands are available on the git README (https://gitlab.com/prpl-foundation/prplos/prplos).

Prepare src
You need to go in the first prompt you openned (the prompt where you are in the docker image)
Run these commands :

Feeds + menuconfig

1 cd /src/prplos/
2 ./scripts/feeds update -a
3 ./scripts/feeds install -a
make menuconfig

You are now in the configuring tool to build the image.

Configure src
If you use prebuild images or use configuration that working with LXC here : https://sharingspace.tech.orange/s/m2PbZ9jReAzrQ25 (mdp : M@tt3r-Thr3@d)
If you want to have custom, image, here is a sample configuration (not working with LXC). For lxc requirements see : https://wiki.gentoo.org/wiki/LXC#Limitations_of_LXC
According the plateform you want to install prpl OS on, you'll need to adapt next steps. A lot of things can be needed to be add to the build image depending of your plateform.
For minimal default installation, 3 mains parameter needs to be change :
Is the general target system. In our case, you'll need to change it to be "Broadcom BCM27XX" since it is this chipset family used on PI4B
Is the system subtarget. Here, you need to change it to "BCM2711 boards 64bit".
The third thing to change is the target profile. You just have to select "Raspberry Pi 4b" option.
Firmware
brcmfmac-* (pour tous les pi)
brcmfmac-firmware-43455-sdio-rpi-4b
brcmfmac-firmware-usb
brcmsmac-firmware
cypress-firmware-43455-*
Network Support
kmod-tun
kmod-veth
kmod-vxlan
Kernel Modules -
-- USB Support
= kmod-usb-hid
vxlan= kmod-usb-net
= kmod-usb-net-asix (for USB-Eth adaptor)
= kmod-usb-net-asix-ax88179 (for USB-Eth adaptor)
= kmod-usb2
= kmod-usb3
(Network Support) :
kmod-veth
(other modules)
kmod-ikconfig
kmod-rtc-ds1307
(I2C support)
kmod-i2c-bcm2835
(GPIO support)
kmod-gpio-cascade
(Hardware Monitoring Support)
kmod-hwmon-gpiofan
kmod-hwmon-raspberrypi
kmod-hwmon-rpi-poe-fan
Libraries -- libssh -- libssh2
LUCI - -- Collections - = luci = luci-ssl-openssl

Save & Exit

The build is now configured with a minimal set of things, with the support of Luci + Usb-eth adaptor.
You can explore available options. There is plenty of it and some of the options can be needed in your use cases.
Note : If you select a module/package/feature, you have 2 options :
M for module => The package is compiled but is not included in the firmware
* for included => The package is compiled AND is included in the firmware

To start the compilation, run :

make

make -j5 -d

Notice that "-j5" is customable. It depends on how much cores you have on your machine (https://linux.die.net/man/1/make). The more j is high, the faster will be the compilation. Nethertheless, in
my case, using just "-j" option crashed my ubuntu each time.
docker run -it --rm -v /path/to/your/created/directory/:/src TheNameYouWant
You can remove "–rm" from the command line if

Compile the kernel to support USB-Ethernet adaptor (OPTIONAL)

make kernel_menuconfig

Add support to the USB-Ethernet adapter by adding

Then, rebuild the image with the kernel source

make -j9 defconfig download clean world


Flashing your micmake kernel_menuconfigro-SD card
Once the process is completed, you will have the iso files at "/path/to/your/created/directory/prplos/bin/targets"

with img.gz
you can flash the factory.img.gz. Example of commands with "openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz" file on SDCard in "/dev/mmcblk0"

$ gunzip openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz
$ sudo dd if=openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img of=/dev/mmcblk0 bs=1M

After you flash the image to SD, you have to resize the root partition, exemple with SDCard in "/dev/mmcblk0":

$ sudo parted -s /dev/mmcblk0 resizepart 2 100%


$ sudo e2fsck -f /dev/mmcblk0p2

info :
https://openwrt.org/docs/guide-user/installation/openwrt_x86#resizing_filesystem
https://openwrt.org/docs/guide-user/installation/installation_methods/sd_card
https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi#how_to_flash_openwrt_to_an_sd_card

with iso
There is multiple files depending on the file system type you want. I chose to use ext4 factory iso.

I personaly use rufus to flash iso (https://rufus.ie/en/). It is simple to use and really reliable.
Pick your device (eq. micro-SD card) , the previously created ISO and click on start button.

Networking
Info : you can configure default network with menuconfig
https://openwrt.org/docs/guide-user/base-system/basic-networking
Sample of file to add in "/etc/config/network"

config interface 'loopback'


option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'


option ula_prefix 'fd37:fd04:6d97::/48'

config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'

config interface 'lan'


option device 'br-lan'
option netmask '255.255.255.0'
option ip6assign '60'
option proto 'dhcp'

Troubleshooting
This section will be updated of some of you encounter problems following this "how to" document.

Depedences
In some cases, dependences are missing. I solved this problem installing missing packages on my docker instance.

Aucune étiquette

You might also like