User Tools

Site Tools


Table of Contents

Intel Edison


By default the Edison board uses Yocto Linux which really doesn't interest me. I'm not into this Arduino stuff, I normally write direct in C and don't want to have some kind of pre-build Linux.

So,the best way would be to put Gentoo Linux on the Edison (which I'm also using for lots of ARM boards).

I keep things short here for now. The Edison has an integrated eMMC and it's not that easy to write/partition it. Normally I've a removable SD-Card which I attach to my PC, create the partitions, compile u-boot, write u-boot, format partitions, build Gentoo, put Gentoo on root, build Kernel and finally put Kernel on /boot and insert the SD-Card to the board.

Access to the integrated eMMC is possible via DFU which makes things difficult. Another way would be an boot-able SD-Card. Problem for me, my break-out-board ( Intel® Edison and Mini Breakout Kit) has no external MMC-Card and I don't want to solder anything at this point.

Then I found ubilinux where you can download some scripts and a prebuild Ubuntu-like image. The image (*.ext4) can be mounted via '-o loop' and that's where I started. The most important part is to keep your gentoo as small as possible. A good way is to put portage into a squashfs image and so I came up with a 800MB gentoo.

More or less I did these things:

  1. create a new directory for your Gentoo-root:
    mkdir gentoo_root
  2. download and extract i686-stage3
    #check for latest filename
    tar -vjxf *.tar.bz2 -C gentoo_root
  3. change make.conf
    # These settings were set by the catalyst build script that automatically
    # built this stage.
    # Please consult /usr/share/portage/config/make.conf.example for a more
    # detailed example.
    CFLAGS="-march=i686 -mtune=atom -O2 -fomit-frame-pointer -pipe"
    # WARNING: Changing your CHOST is not something that should be done lightly.
    # Please consult before changing.
    # These are the USE flags that were used in addition to what is provided by the
    # profile used for building.
    USE="-X -alsa -ipv6 -doc -debug -gdbm -gmp mmx wifi bindist -systemd -nls -berkdb"
  4. compile everything you need, also do
    emerge --update --newuse --deep --with-bdeps=y @world
    emerge --depclean
  5. prepare portage for squashfs (we'll use a compressed portage, which is only about 90MB:
    #create links for writeable folders
    rm -rf /usr/portage/distfiles
    rm -rf /usr/portage/packages
    ln -fs /mnt/root/usr/portage/packages /usr/portage/packages 
    ln -fs /mnt/root/usr/portage/distfiles /usr/portage/distfiles 
    #compress portage
    mksquashfs /usr/portage/ portage.squash -noappend -e /usr/portage/packages/ -e /usr/portage/distfiles/
    #remove portage
    rm -rf /usr/portage*
    #create rw-folders
    mkdir /usr/portage/packages
    mkdir /usr/portage/distfiles
  6. download ubilinux
  7. create copy for new gentoo image:
    mkdir toFlash/ext4_img
    cp -r toFlash toFlash_gentoo
  8. mount image files, we need the original to copy some files later on
    mount toFlash/edison-image-edison.ext4 toFlash/ext4_img -o loop
    mount toFlash_gentoo/edison-image-edison.ext4 toFlash_gentoo/ext4_img -o loop
  9. update ext4-image content:
    rsync -av --delete gentoo_root/ toFlash_gentoo/ext4_img/
  10. copy important stuff from old ext4-image to loop_mountpoint
    cp toFlash/ext4_img/boot toFlash_gentoo/ext4_img/boot 
    cp toFlash/ext4_img/lib/firmware toFlash_gentoo/ext4_img/lib/firmware 
    cp toFlash/ext4_img/etc/modprobe.d/ toFlash_gentoo/ext4_img/etc/modprobe.d/
    echo -e '#!/bin/sh\n\necho 1 >/sys/devices/virtual/misc/watchdog/disable\n" > toFlash_gentoo/ext4_img/etc/local.d/no_watchdog.start
    echo -e 'chmod +x toFlash_gentoo/ext4_img/etc/local.d/no_watchdog.start' >> toFlash_gentoo/ext4_img/etc/local.d/no_watchdog.start
    #set a password
  11. update modules
    chroot toFlash_gentoo/ext4_img/
    depmod -a
  12. add agetty for serial interface (toFlash_gentoo/ext4_img/etc/inittab)
    #s0:12345:respawn:/sbin/agetty 38400 ttyS0 vt100
    #s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100
    s0:12345:respawn:/sbin/agetty 115200 ttyMFD2 vt100
  13. unmount image and check for errors
    unmount toFlash/ext4_img
    unmount toFlash_gentoo/ext4_img
    e2fsck -f toFlash_gentoo/edison-image-edison.ext4
  14. flash gentoo (see ubilinux for details)
    cd toFlash_gentoo/

As an alternative you could simply use my ext4 image and replace the one from ubilinux. The flashing takes quite a while, about 1h for me.


For wifi you should probably create a config-file for the mac on the board:

Eddi ~ # cat /config/wifi/mac.txt 

For portage on the board, you've to do some mounts (requires kernel with squashfs support):

mkdir /mnt/root
mount /dev/mmcblk0p8 /mnt/root
mount /portage.squash /usr/portage

Bigger root

Eddi ~ # parted /dev/mmcblk0
GNU Parted 3.2
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
del 10
del 9

Eddi ~ # resize2fs /dev/mmcblk0p8
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/mmcblk0p8 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p8 is now 937979 (4k) blocks long.

Eddi ~ # df
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/root        3481284 765668   2533436  24% /
devtmpfs           10240      0     10240   0% /dev
tmpfs              98408    416     97992   1% /run
cgroup_root        10240      0     10240   0% /sys/fs/cgroup
shm               492024      0    492024   0% /dev/shm
start/edison.txt · Last modified: 2015.03.09 - 10:41 by alexander.krause