Build from sources - comick/tonio GitHub Wiki
Preparing your rootfs customization
When developing, you may want to customize network to directly connect to your home network or add ssh key pre-installed during development.
Look into rootfs_overlay
folder of your board of choice. Anything changed there, will override the root file system content.
Convenient changes for development are:
- setup interfaces and wpa to connect your home wireless network
- copy
$TONIO_SRC/board/$BOARD_NAME/rootfs_overlay/etc/interfaces.sample
and$TONIO_SRC/board/$BOARD_NAME/rootfs_overlay/etc/wpa_supplicant.conf.sample
removing the trailing.sample
- change content according to your home network settings
- copy
- disable hostapd which may make problems on some setups
- just rename
$TONIO_SRC/board/$BOARD_NAME/rootfs_overlay/etc/SXXhostapd
to something which is not picked up by init
- just rename
- install your ssh public key for faster access
- create a new file at
$TONIO_SRC/board/$BOARD_NAME/rootfs_overlay/root/.ssh/authorized_keys
and add your public key there
- create a new file at
Building the root file system
Download Buildroot and extract into some folder, say $HOME/buildroot-2022.08.1
. The project tries to keep current with latest LTS version of Buildroot. When uncertain, please refer to the version in use by actions.
Clone this project in your favorite folder, say $HOME/tonio
.
$ cd $HOME/buildroot-2022.08.1
$ make BR2_EXTERNAL=$HOME/tonio tonio_raspberrypi3_defconfig
$ make
HINT: while
raspberry3
is used in this example, other boards might be supported. See theboard
folder for the full list.
Time to wait... Buildroot is building both toolchain and root image from the ground up, it will take some time. Kind half an hour or more.
After a while you should see your command prompt again, preceded by few lines resembling this:
...
INFO: hdimage(sdcard.img): adding partition 'boot' (in MBR) from 'boot.vfat' ...
INFO: hdimage(sdcard.img): adding partition 'rootfs' (in MBR) from 'rootfs.ext4' ...
INFO: hdimage(sdcard.img): adding partition 'library' (in MBR) from 'library.vfat' ...
INFO: hdimage(sdcard.img): writing MBR
That means your build is done and an image is ready for flashing you SD card.
Writing image to an SD card
Make sure you have parted with fatresize installed, then flash your SD card with:
$ make flash dev=/dev/sdX
NOTE: different boards may have different assumptions on SD layouts. That is why the
flash.sh
script is kept board-specific.
that will write the image on your SD card and extend the FAT data partition till the end.
This may take some time (specially if you made an image with non-empty library). During development you may just want to flash the root partition with:
$ make flash-root dev=/dev/sdX
which will only flash the much smaller root file system.
Plug you SD card into the board and switch the device on.