Skip to content

Instantly share code, notes, and snippets.

@bessalahAmar
Created November 21, 2019 09:23
Show Gist options
  • Save bessalahAmar/d814bd51f159fead35fdb9c14531d6c3 to your computer and use it in GitHub Desktop.
Save bessalahAmar/d814bd51f159fead35fdb9c14531d6c3 to your computer and use it in GitHub Desktop.
steps to create minimalistic os for raspberrypi
global objectif ( create minimalistic os for raspberrypi ) :
download lite version of raspbian OS.
remove the rootfs partition and replace it with busybox root-fs
to do so you need to cross-compile busyBox for the raspberryPi
once done you just replace partition 2 with the busybox binary.
steps for installing raspbianOS standard edition in sdcard:
# 1 ) enjoy life
# 2 ) download lite version raspbianOS:
https://raspberry-pi.fr/telechargements/
# 3 ) insert sd card in computer
# 4 ) lsblk -p ## to print connected storage in computer ( disk , .. )
# 5 ) mount -l | grep "sdb1\|sdb2" # to check if they are mounted
# 5.1 ) unmount /dev/sdb*
# 6 ) copying the image to the sd card: ( try with 1M ( MByte ) if not working )
sudo dd bs=4M if=*.img of=/dev/sdb1 conv=fsync
steps for cross compiling :
# 1 ) enjoy life
# 2 ) set up environnement variables for crossCompilation
ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf-
PATH=$PATH:$HOME/gcc-linaro-*version*-x86_64_arm-linux-gnueabihf/bin
export ARCH CROSS_COMPILE PATH
# 3 ) install gcc-arm-...
sudo apt-get install gcc-arm*
# 4 ) cross compilation busyBox
git clone https://github.com/mirror/busybox.git
git checkout
make defconfig
make -j4
make install CONFIG_PREFIX=<path>/rootfs_rpi
# 4) installation libs manquant:
Arm-linux-gnueabihf-readelf -a /bin/busybox | grep ‘\.so’
steps for current root-fs with the one we just created ( busyBox )
# 1 ) enjoy life much more
# 2 ) unmount /dev/sdb2
# 3 ) sudo mkfs.ext4 -L rootfs /dev/sdb2 ( on format la 2eme partition)
# 4 ) on ejecte puis on reinsert la sd card
# 5 ) sudo cp -a -v <path>/rootfs_rpi/* //media/$USER/rootfs
step for testing :
just launch your raspberryPi
#useful links :
CoursBDRT.pdf : support du cour
https://www.raspberrypi.org/documentation/installation/installing-images/linux.md
https://books.google.fr/books?id=o9tBDwAAQBAJ&pg=PA76&lpg=PA76&dq=Make+install+CONFIG_PREFIX%3D%3Cpath%3E/rootfs_rpi&source=bl&ots=_utJYbV0ep&sig=ACfU3U1fms6Kw1NLswIN9wWPG6zrPBHlNA&hl=fr&sa=X&ved=2ahUKEwiqg-aOl_nlAhUJzoUKHaoTBOAQ6AEwAHoECAcQAQ#v=onepage&q&f=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment