How To Build Your Own Image For Raspberry PI 4 - Home Connected Device Innovation - Confluence For Orange
How To Build Your Own Image For Raspberry PI 4 - Home Connected Device Innovation - Confluence For Orange
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.
Build command
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.
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
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
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
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
make kernel_menuconfig
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":
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 device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
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