Changes between Initial Version and Version 1 of newport/ubuntu


Ignore:
Timestamp:
12/13/2017 01:49:57 AM (5 years ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • newport/ubuntu

    v1 v1  
     1[[PageOutline]]
     2
     3= Ubuntu on Newport =
     4This page is dedicated details regarding running Ubuntu on an Gateworks Newport Board.
     5
     6See also:
     7 * the Gateworks Ventana [wiki:ventana#third_party_linux third party linux] page for more details on how to use other linux distro on Ventana.
     8 * [wiki:ubuntu Gateworks Ubuntu Page for general notes] 
     9
     10See also:
     11 * [wiki:ubuntu Gateworks Ubuntu page]
     12
     13
     14[=#debootstrap]
     15== Root filesystem ==
     16A popular way to create an Ubuntu root filesystem is to use the {{{deboostrap}}} utility on a Debian or Ubuntu host. This tool provides a 2-stage install where the second stage is within a chroot environment using qemu.
     17
     18Requirements:
     19- Linux Ubuntu or Debian System with network connection and sudo permissions
     20
     21Important notes:
     22 * we set and use '''target''' and '''distro''' env variables in step 2 and use those env variables in the remaining steps to make this tutorial more version-agnostic. Please be aware of this and do not deviate from the steps unless or until you completely understand what you are doing.
     23
     24Steps:
     251. Install pre-requisites:
     26{{{
     27#!bash
     28sudo apt-get install qemu-user-static debootstrap binfmt-support
     29}}}
     30
     312. Perform first stage install of minimal filesystem for {{{arm64}}} architecture:
     32{{{
     33#!bash
     34target=rootfs
     35distro=xenial
     36sudo debootstrap --arch=arm64 --foreign $distro $target
     37# copy qemu-arm-static binary for the binfmt packages to find it and copy in resolv.conf from host
     38sudo cp /usr/bin/qemu-aarch64-static $target/usr/bin
     39}}}
     40 * See http://ports.ubuntu.com/ubuntu-ports/dists/ for a list of current Ubuntu releases: 16.10=yakkety (latest), 16.04=xenial (latest LTS), 15.04=vivid, 14.10=utopic (LTS), 14.04=trusty (LTS), 12.04=precise (LTS), 10.04=lucid (LTS).
     41 * this minimal rootfs can be considered about the same as an Ubuntu-core downloaded rootfs however it is still missing some core packages and configuration before it can be booted. These steps are taken care of in a 2nd stage install within a chroot shell
     42 * the chroot shell below will provide network support (inherited from the host)
     43
     443. we now have a minimal Ubuntu rootfs - chroot to it and perform the 2nd stage install:
     45{{{
     46#!bash
     47sudo chroot $target
     48# now we are in the chroot
     49distro=xenial
     50export LANG=C
     51# setup second stage
     52/debootstrap/debootstrap --second-stage
     53}}}
     54 * this is the most minimal rootfs we would recommend
     55
     564. (optional) add additional apt package repos:
     57{{{
     58#!bash
     59cat <<EOT > /etc/apt/sources.list
     60deb http://ports.ubuntu.com/ubuntu-ports $distro main restricted universe multiverse
     61deb http://ports.ubuntu.com/ubuntu-ports $distro-updates main restricted universe multiverse
     62deb http://ports.ubuntu.com/ubuntu-ports $distro-security main restricted universe multiverse
     63EOT
     64}}}
     65 * you may want to customize the above list, depending on your needs. See [#packages below] for more detail on Ubuntu package feeds
     66
     675. (optional) update package database and setup locales (do not skip this step if you are needing to install any packages for the steps below or otherwise)
     68{{{
     69#!bash
     70apt-get update
     71apt-get -f install # fixup missing package dependencies
     72apt-get install locales dialog
     73dpkg-reconfigure locales
     74}}}
     75
     766. set hostname:
     77{{{
     78#!bash
     79echo ${distro}-$(uname -m) > /etc/hostname
     80}}}
     81
     827. set a root passwd so you can login
     83{{{
     84#!bash
     85passwd
     86}}}
     87 - or consider adding a user via {{{adduser}}}:
     88{{{
     89#!bash
     90adduser myuser
     91usermod -a -G tty myuser # add to tty group for tty access
     92usermod -a -G dialout myuser # add to dialout group for UART access
     93usermod -a -G sudo myuser # add to sudo group for root access
     94}}}
     95
     968. (optional) configure networking:
     97 - wired ethernet with DHCP on eth0
     98{{{
     99#!bash
     100cat <<EOF >> /etc/network/interfaces
     101allow-hotplug eth0
     102auto eth0
     103iface eth0 inet dhcp
     104
     105EOF
     106}}}
     107 - or static IP:
     108{{{
     109#!bash
     110cat <<EOF >> /etc/network/interfaces
     111allow-hotplug eth0
     112auto eth0
     113iface eth0 inet static
     114address 192.168.1.1
     115netmask 255.255.255.0
     116gateway 192.168.1.254
     117
     118EOF
     119}}}
     120 - or wireless (requires ~3MB of additional packages):
     121{{{
     122#!bash
     123apt-get install wpasupplicant iw
     124cat << EOF >> /etc/network/interfaces
     125# Wireless interface
     126auto wlan0
     127iface wlan0 inet dhcp
     128        wireless_mode managed
     129        wireless_essid any
     130        wpa-driver nl80211
     131        wpa-conf /etc/wpa_supplicant.conf
     132
     133EOF
     134wpa_passphrase <myssid> <mypass> >> /etc/wpa_supplicant.conf
     135}}}
     136
     1379. (optional) install some useful packages
     138{{{
     139#!bash
     140apt-get install openssh-server # ssh server for remote access
     141apt-get install can-utils i2c-tools usbutils pciutils # cmdline tools for various hardware support
     142}}}
     143 * Note that by default root ssh access is disabled for security. See [#ssh below] for info on enabling it
     144
     14510. install Gateworks pre-built kernel:
     146{{{#!bash
     147apt-get install wget
     148cd /
     149wget http://svn.gateworks.com/newport/images/gateworks-linux-arm64-4.14.tar.bz2
     150tar -xvf gateworks-linux-arm64-4.14.tar.bz2
     151}}}
     152
     15311. exit the chroot shell and remove files we no longer need
     154{{{
     155#!bash
     156exit
     157sudo rm $target/usr/bin/qemu-arm-static
     158}}}
     159
     16012. install to bootable media:
     161 * For a removable block storage device supported by your board such as a USB Mass Storage device, a microSD, an mSATA SSD the example below will create a single ext4 rootfs partition on a removable block storage device. Ensure you set DEVICE properly for your system. We use the 'udisks' application for mount/unmount so that the mount-point is obvious - if you know what your doing you could use standard mount/unmount as well:
     162{{{
     163#!bash
     164DEVICE=/dev/sdc
     165# unmount all auto-mounted partitions for this device
     166sudo umount ${DEVICE}?
     167# partition disk - single ext partition
     168printf ",,L,,\n" | sudo sfdisk -uS ${DEVICE}
     169sync
     170sudo mkfs.ext4 -L rootfs ${DEVICE}1
     171# mount partition (will mount to /media/rootfs/)
     172sudo udisks --mount ${DEVICE}1
     173# copy the root filesystem
     174sudo cp -rupv $target/*  /media/rootfs/
     175# unmount the disk
     176sudo udisks --unmount ${DEVICE}1
     177}}}