User Tools

Site Tools


start:edison

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Intel Edison ====== {{:details:x86:edison-setup_miniboard_1.jpg?200 }} By default the Edison board uses [[https://www.yoctoproject.org/|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 [[http://gentoo.org|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 ( [[https://www.sparkfun.com/products/13025|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 [[http://www.emutexlabs.com/ubilinux|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: - create a new directory for your Gentoo-root: <code> mkdir gentoo_root </code> - download and extract i686-stage3 <code> #check http://distfiles.gentoo.org/releases/x86/autobuilds/ for latest filename wget http://distfiles.gentoo.org/releases/x86/autobuilds/current-stage3-i686/stage3-i686-20150303.tar.bz2 tar -vjxf *.tar.bz2 -C gentoo_root </code> - change make.conf <code> # 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. CHOST="i686-pc-linux-gnu" CFLAGS="-march=i686 -mtune=atom -O2 -fomit-frame-pointer -pipe" CXXFLAGS="${CFLAGS}" # WARNING: Changing your CHOST is not something that should be done lightly. # Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing. CHOST="i686-pc-linux-gnu" # 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" FEATURES="buildpkg" PYTHON_TARGETS="python2_7" USE_PYTHON="2.7" PORTDIR="/usr/portage" DISTDIR="${PORTDIR}/distfiles" </code> - compile everything you need, also do <code> emerge --update --newuse --deep --with-bdeps=y @world emerge --depclean </code> - prepare portage for squashfs (we'll use a compressed portage, which is only about 90MB: <code> #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 </code> - download [[http://www.emutexlabs.com/ubilinux|ubilinux]] <code> wget http://www.emutexlabs.com/files/ubilinux/ubilinux_0.9_quark-live_usb_install.zip unzip ubilinux_0.9_quark-live_usb_install.zip </code> - create copy for new gentoo image: <code> mkdir toFlash/ext4_img cp -r toFlash toFlash_gentoo </code> - mount image files, we need the original to copy some files later on<code> mount toFlash/edison-image-edison.ext4 toFlash/ext4_img -o loop mount toFlash_gentoo/edison-image-edison.ext4 toFlash_gentoo/ext4_img -o loop </code> - update ext4-image content: <code> rsync -av --delete gentoo_root/ toFlash_gentoo/ext4_img/ </code> - copy important stuff from old ext4-image to loop_mountpoint <code> 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 passwd </code> - update modules <code> chroot toFlash_gentoo/ext4_img/ depmod -a exit </code> - add agetty for serial interface (toFlash_gentoo/ext4_img/etc/inittab) <code> # SERIAL CONSOLES #s0:12345:respawn:/sbin/agetty 38400 ttyS0 vt100 #s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100 s0:12345:respawn:/sbin/agetty 115200 ttyMFD2 vt100 </code> - unmount image and check for errors <code> unmount toFlash/ext4_img unmount toFlash_gentoo/ext4_img e2fsck -f toFlash_gentoo/edison-image-edison.ext4 </code> - flash gentoo (see [[http://www.emutexlabs.com/ubilinux/29-ubilinux/205-ubilinux-installation-instructions|ubilinux]] for details)<code> cd toFlash_gentoo/ ./flashall.sh </code> As an alternative you could simply use [[http://gentoo.ed-solutions.de/images/edison-20150308/edison-image-edison.ext4|my ext4]] image and replace the one from ubilinux. The flashing takes quite a while, about 1h for me. ==== Misc ==== For wifi you should probably create a config-file for the mac on the board: <code> Eddi ~ # cat /config/wifi/mac.txt 02:00:86:db:6e:54 </code> For portage on the board, you've to do some mounts: <code> mkdir /mnt/root mount /dev/mmcblk0p8 /mnt/root mount /portage.squash /usr/portage </code> ==== Bigger root ==== <code> Eddi ~ # parted /dev/mmcblk0 GNU Parted 3.2 Using /dev/mmcblk0 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) unit B del 10 del 9 resize 8 3909074431 q 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 </code>

start/edison.1425897596.txt.gz · Last modified: 2015.03.09 - 10:39 by alexander.krause