IGEPv5 Ubuntu Distro

From IGEP - ISEE Wiki

Revision as of 16:22, 17 March 2014 by Manel Caro (talk | contribs) (Install your image in a MicroSD Card)

Jump to: navigation, search

Ubuntu 12.04.4 LTS (Hard Float) is the default IGEPv5 base distribution (it's included in IGEPv5 Full and Lite).

We will learn about install, use, generate packages, upgrade ...

Overview

What we learn in this chapter? Install, play and fun with Ubuntu distro ...

Host Enviroment

We suggest use Ubuntu 12.04.4 LTS (32 bits) in your host, you can download it from our server using this link or directly from Ubuntu (Canonical) website. You can install it in a Virtual Machine enviroment using any Virtualization software or directly in your PC.

After install is recommended update the package list with:

sudo apt-get update

Install Development packages

Now is time to install some packages.

GCC, G++, libc Cross Compiler

You can install the cross compiler if you want to build u-boot, linux kernel or applications using your host PC and compile for IGEPv5 as target.

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-armel-cross libc6-armel-armhf-cross

Build Ubuntu packages

if you're idea is build ubuntu packages then you need install other packages

sudo apt-get install build-essential devscripts dh-make quilt autogen autoconf dh-autoreconf dh-buildinfo dh-make pkg-config

Pbuilder

A pbuilder environment is a chrooted environment which can have a different distroseries or architecture than your host system.

sudo apt-get install pbuilder pbuilder-scripts

What can I do?

pbuilder is used for create your own ubuntu/debian based distribution or build your own debian/ubuntu packages.

Setup, the basic setup is create in your home base directory a new file called .pbuilderrc inside you should copy this content:

BINDMOUNTS="${BINDMOUNTS} /home/<your_user>/Projects"

EXTRAPACKAGES="${EXTRAPACKAGES} pbuilder devscripts gnupg patchutils vim-tiny openssh-client"

And just remember create the directory Projects before start. Now if you want to create a new rootfs, you can try to build with

cd ~/Projects
pcreate -a armhf -d precise precise-armhf

The first time the program will ask you about install some dependencies

Installing qemu-user-static for armhf-on-x86 support (natty or later)
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
binfmt-support
The following NEW packages will be installed:
binfmt-support qemu-user-static
0 upgraded, 2 newly installed, 0 to remove and 23 not upgraded.
Need to get 12.9 MB of archives.
After this operation, 33.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? 

You should say, Y (yes) After build (it can take some time) you will get your rootfs (ARM Hard float) in /var/cache/pbuilder/ directory

Now it time to test your new rootfs

First create a new directory in your home:

$ mkdir -p rootfs/armhf_12.04.4

Now untar the generated file:

$ cd ~/rootfs/armhf_12.04.4

$ sudo tar xvfz /var/cache/pbuilder/precise-armhf.tgz

Now copy the qemu-arm-static file into usr/bin directory

$ sudo cp /usr/bin/qemu-arm-static usr/bin

And now chroot it as

$ cd ..

$ sudo chroot armhf_12.04.4

Check if all is ok with:

$ arch

armv7l

Now you've in a chroot armhf emulation your rootfs ...  

Install Ubuntu 12.04.4 LTS (HF) in the IGEPv5

Ubuntu 12.04.4 LTS can be installed in MicroSD Card, the internal eMMC Flash or in a SSD Flash card, the minimum suggested capacity will be 8 GiB available.

This tutorial will show you install step by step and customize the distribution base.

Download Ubuntu 12.04.4 LTS (HF)

Ubuntu 12.04.4 LTS can be downloaded from our server at this location. This distribution is based on Ubuntu Core

Initial Setup

As we explain before we will create a chroot environment using the downloaded image:

mkdir -p ~/rootfs/armhf-ubuntu-core-12.04.4
cd ~/root
wget http://downloads.isee.biz/pub/igepv5_ce/arm-ubuntu/images/ubuntu-12.04.4-LTS-hf/ubuntu-core-12.04.4-core-armhf.tar.gz 
cd armhf-ubuntu-core-12.04.4 
sudo tar xvfz ../ubuntu-core-12.04.4-core-armhf.tar.gz
sudo cp /usr/bin/qemu-arm-static usr/bin
for m in `echo 'sys dev proc'`; do sudo mount /$m ./$m -o bind; done
sudo LC_ALL=C chroot . 

Note: remember remove the qemu-arm-static file after all. 
Note: remember unmount (outside chroot) the sys proc and dev with: for m in `echo 'sys dev proc'`; do sudo umount ./$m; done

Now if you execute the command ls -al you should see a similar directory listing like this:

drwxr-xr-x  2 root root 4096 Feb  3 16:42 bin
drwxr-xr-x  2 root root 4096 Apr 19  2012 boot
drwxr-xr-x  3 root root 4096 Feb  3 16:41 dev
drwxr-xr-x 41 root root 4096 Feb  3 16:42 etc
drwxr-xr-x  2 root root 4096 Apr 19  2012 home
drwxr-xr-x 11 root root 4096 Feb  3 16:41 lib
drwxr-xr-x  2 root root 4096 Feb  3 16:39 media
drwxr-xr-x  2 root root 4096 Apr 19  2012 mnt
drwxr-xr-x  2 root root 4096 Feb  3 16:39 opt
drwxr-xr-x  2 root root 4096 Apr 19  2012 proc
drwx------  2 root root 4096 Feb  3 16:42 root
drwxr-xr-x  5 root root 4096 Feb  3 16:41 run
drwxr-xr-x  2 root root 4096 Feb  3 16:42 sbin
drwxr-xr-x  2 root root 4096 Mar  5  2012 selinux
drwxr-xr-x  2 root root 4096 Feb  3 16:39 srv
drwxr-xr-x  2 root root 4096 Apr 14  2012 sys
drwxrwxrwt  2 root root 4096 Feb  3 16:41 tmp
drwxr-xr-x 10 root root 4096 Feb  3 16:39 usr
drwxr-xr-x 11 root root 4096 Feb  3 16:39 var

Ubuntu core not have any user created and we need to create one:

$ adduser igep

Adding user `igep' ...

Adding new group `igep' (1000) ...

Adding new user `igep' (1000) with group `igep' ...

Creating home directory `/home/igep' ...

Copying files from `/etc/skel' ...

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

Now it's necessary to add this user into the groups adm and sudo.

addgroup igep adm

addgroup igep sudo

it's a good idea to install any necessary package on your rootfs for do that you should do

apt-get update

and install the package (ex: nano editor)

apt-get install nano

Now we can edit the files and tunning the setup

Tunning your rootfs

We will share some interesting tricks that can be useful for your new rootfs.

Login in "root" without need of a password

You can edit the file /etc/shadow it should have a similar content like this

root:*:16104:0:99999:7:::

if you want eliminate the need of a password you must remove the * as

root::16104:0:99999:7:::

Network configuration files for 'DHCP' client

A few files on your target filesystem need to be taken care of.
Steps are as follow:

  • Edit your /etc/network/interfaces file and add the bottom 2 lines:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
  • If you are behind a firewall inside a 'Corporate Network', the following 2 files may need to be edited to according to your Coporate settings:
  • Edit your /etc/resolv.conf file and have something similar to this:

Remove the "<>" symbols and replace by your own corporate DHCP and DNS servers adresses.

domain <something.dhcp.mycompany.com>
search <something.dhcp.mycompany.com>
nameserver <IP address of your DNS server 1>
nameserver <IP address of your DNS server 2>
  • Add the proxy settings:

In your /etc/environment file, add something similar to this using your own corporate proxy server address and port number:

http_proxy="http://myproxy.ext.mycompany.com:80"
https_proxy="http://myproxy.ext.mycompany.com:80"
ftp_proxy="http://myproxy.ext.mycompany.com:80"
no_proxy="localhost,.mycompany.com"

In your /etc/apt/apt.conf.d/proxy, add similar to this using your own corporate proxy server address and port number:

Acquire
{
http {
  Proxy <corporate apps address>:<port number>;
  Proxy::<ubuntu corporate address> "DIRECT";
}
}

Packages

Comming soon

Install your image in a MicroSD Card

Prepare your disk (microsd, eMMC or SSD disk)

First we need to prepare the microsd card, download this script

Prerequisites: you must install these two packages before execute the script:

sudo apt-get install bc dosfstools

This script will create in your disk (mmc) two new partitions, first one named boot and the second one named rootfs.

Check your microsd card:

Insert the microsd card in your PC and after that execute lsblk as:

lsblk

sdb      8:16   1   3.8G  0 disk 
├─sdb1   8:17   1  70.6M  0 part /media/boot
└─sdb2   8:18   1   3.7G  0 part /media/rootfs

or is possible to look like this:

root@localhost:~# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0  29.8G  0 disk
|-sda1         8:1    0   100M  0 part
`-sda2         8:2    0  29.7G  0 part /
mmcblk0boot0 179:8    0     2M  1 disk
mmcblk0boot1 179:16   0     2M  1 disk
mmcblk0      179:0    0   7.3G  0 disk
|-mmcblk0p1  179:1    0  70.6M  0 part
`-mmcblk0p2  179:2    0   7.2G  0 part

Execute the script as root:

sudo ./prepare_disk.sh

root@localhost:~# ./prepare-disk.sh
sda            8:0    0  29.8G  0 disk
mmcblk0boot0 179:8    0     2M  1 disk
mmcblk0boot1 179:16   0     2M  1 disk
mmcblk0      179:0    0   7.3G  0 disk
Select the disk: [sdx or mmcblkx]

In the first case you should use sdb and in the second case you should use mmcblk0, write the appropiate disk name ...

After that it will ask you if you are sure !!!

After the script execution you will found two new partitions

mmcblk0      179:0    0   7.3G  0 disk
|-mmcblk0p1  179:1    0  70.6M  0 part
`-mmcblk0p2  179:2    0   7.2G  0 part

In this case p1 (boot) and p2 (rootfs).

Install your image in a MicroSD Card

Install your image in a SATA SSD Disk

Comming soon


Install your image in the eMMC flash

Comming soon


References

http://www.omappedia.com/wiki/OMAP_Ubuntu_Core#Chroot.27ing_into_the_Ubuntu_Core_Filesystem

https://wiki.ubuntu.com/Core

http://cdimage.ubuntu.com/ubuntu-core/

https://github.com/DavidBercovitz/ubuntu-core

https://wiki.ubuntu.com/Core/InstallationExample

http://www.mattfischer.com/blog/?p=514

https://wiki.ubuntu.com/PbuilderHowto

http://manpages.ubuntu.com/manpages/lucid/man8/pbuilder.8.html