Build Instructions for Ubuntu

= Build Instructions for Ubuntu =

Reference: Ubuntu 15.04 Vivid Vervet

= Build Pre-requisites =

sudo apt-get install build-essential git

Useful for building or troubleshooting older builds: sudo apt-get install u-boot-tools sunxi-tools

= Getting the Cross-Toolchain = See also: Toolchain

sudo dpkg --add-architecture armhf
 * Add the ArmHF architecture

sudo sed 's~\(\(deb\(-src\)*\) \([^\[]\)\)~\2 [arch=i386,amd64] \4~' /etc/apt/sources.list | sudo tee /etc/apt/sources.list sudo sed 's~\(\(deb\(-src\)*\) \([^\[]\)\)~\2 [arch=i386,amd64] \4~' /etc/apt/sources.list.d/*.list
 * Modify existing sources, restricting to appropriate architectures (i.e. all i386 and amd64 package sources are prefixed as "deb [arch=i386,amd64]")
 * 1) Manually configure third party sources

sudo bash -c 'cat > /etc/apt/sources.list.d/armhf-ports.list <<EOT deb [arch=armhf] http://ports.ubuntu.com/ `lsb_release -cs` main universe multiverse restricted deb [arch=armhf] http://ports.ubuntu.com/ `lsb_release -cs`-updates main universe multiverse restricted deb [arch=armhf] http://ports.ubuntu.com/ `lsb_release -cs`-security main universe multiverse restricted EOT'
 * Create source list for the port architecture(s) (this adds the armhf port sources to apt)

sudo apt-get update sudo apt-get install crossbuild-essential-armhf
 * Update apt and install crossbuild tools for armhf

= Building u-boot = Mainline u-boot works fine: git clone -b v2015.04 git://git.denx.de/u-boot.git cd u-boot make CROSS_COMPILE=arm-linux-gnueabihf- Mele_A1000_defconfig make -j4 CROSS_COMPILE=arm-linux-gnueabihf-

search in the directory configs/ for your board, the file name looks like _defconfig

(Also refer to Mainline_U-boot)

= Setting up the sd card =

Enter an interactive superuser sudo shell sudo su -

${card} is the SD device (ie /dev/sdc). ${partition} is the partition number (ie. 1). Warning: This will delete the content. dd if=/dev/zero of=${card} bs=1M count=1 dd if=u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8 Create partition(s). ie one big partition beginning with sector 2048, type 83 (Linux) fdisk ${card}

mkfs.ext4 ${card}${partition} mount ${card}${partition} /mnt

This will first clean the card (at least the first 1M), install the u-boot bootloader you compiled in the step before, and then you can create -for example- one partition, format it, and mount it to /mnt/ for use in the next steps.

(Also refer to Bootable_SD_card)

= Ubuntu Core = https://wiki.ubuntu.com/Core

Link to Ubuntu Core download: Ubuntu 15.04 (Vivid Vervet) - http://cdimage.ubuntu.com/ubuntu-core/releases/vivid/release/
 * Download Ubuntu Core filesystem

apt-get download linux-generic:armhf flash-kernel:armhf linux-base linux-image-generic:armhf linux-headers-generic:armhf devio:armhf
 * Download the Linux Kernel

cd /mnt sudo tar zxvf $path_to_root_fs
 * Extract Ubuntu Core filesystem to the mounted SD card

cp $path_to_kernel/*deb /mnt/tmp
 * Copy the kernel and any dependencies to the target root filesystem, e.g.

sudo apt-get install qemu-user-static
 * Install qemu-arm-static

cp /usr/bin/qemu-arm-static /mnt/usr/bin/ mount chproc /mnt/proc -t proc mount chsys /mnt/sys -t sysfs
 * Prepare chroot environment


 * Open a chroot session into the target root filesystem. This will allow you to install packages and configure the target system before it is bootable.

sudo LC_ALL=C LANGUAGE=C LANG=C chroot /mnt

dpkg -i devio_1.2-1build2_armhf.deb
 * Install flash-kernel

# dpkg -i /tmp/$dependencies # dpkg -i /tmp/$kernel
 * Install the kernel: