Bootstrapping A Distro For C.H.I.P

From www.chip-community.org
Jump to: navigation, search


The CHIP OS distribution given to us from NTC is great, but sometimes we have personal preferences and wish to use something we are comfortable and familiar with.

Short Guide

On your C.H.I.P do the following

  1. Create rootfs folder by bootstrapping the distribution of your choice
  2. Copy /boot and /lib/modules into your newly created rootfs
  3. Install mtd-utils
  4. Create filesystem rootfs.ubifs with mkfs.ubifs
  5. Create ubi image rootfs.ubi with ubinize
  6. Copy the ubi image to another computer and reflash your C.H.I.P with this image

Common Steps for C.H.I.P distributions (step 3 to 5 above)

Copy /boot and /lib/modules

If you created your rootfs in a folder named rootfs then do the following

cp -r /boot        rootfs/boot
cp -r /lib/modules rootfs/lib/modulus

Installing mtd-utils

This steps depends highly on your current setup, but if you have one of the debian images for C.H.I.P you can install it with

$ sudo apt-get install mtd-utils

Creating your filesystem (mkfs.ubifs)

mkfs.ubifs                             \
  -d PATH/TO/ROOTFS/DIRECTORY          \
  -o rootfs.ubifs                      \
  -e 0x1f8000 -c 2000 -m 0x4000 -x lzo

See mkfs.ubifs --help for details about the arguments.

Creating your ubi image (ubinize)

Create a file called ubinize.cfg with the following contents.

[ubifs]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_flags=autoresize
image=PATH/TO/rootfs.ubifs

Now you are finally ready to create your rootfs.ubi file.

ubinize                             \
  -o rootfs.ubi                     \
  -m 0x4000 -p 0x200000 -s 16384    \
  ubinize.cfg


Bootstrappers