| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | = Ubuntu on Newport = |
| | 4 | This page is dedicated details regarding running Ubuntu on an Gateworks Newport Board. |
| | 5 | |
| | 6 | See 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 | |
| | 10 | See also: |
| | 11 | * [wiki:ubuntu Gateworks Ubuntu page] |
| | 12 | |
| | 13 | |
| | 14 | [=#debootstrap] |
| | 15 | == Root filesystem == |
| | 16 | A 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 | |
| | 18 | Requirements: |
| | 19 | - Linux Ubuntu or Debian System with network connection and sudo permissions |
| | 20 | |
| | 21 | Important 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 | |
| | 24 | Steps: |
| | 25 | 1. Install pre-requisites: |
| | 26 | {{{ |
| | 27 | #!bash |
| | 28 | sudo apt-get install qemu-user-static debootstrap binfmt-support |
| | 29 | }}} |
| | 30 | |
| | 31 | 2. Perform first stage install of minimal filesystem for {{{arm64}}} architecture: |
| | 32 | {{{ |
| | 33 | #!bash |
| | 34 | target=rootfs |
| | 35 | distro=xenial |
| | 36 | sudo 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 |
| | 38 | sudo 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 | |
| | 44 | 3. we now have a minimal Ubuntu rootfs - chroot to it and perform the 2nd stage install: |
| | 45 | {{{ |
| | 46 | #!bash |
| | 47 | sudo chroot $target |
| | 48 | # now we are in the chroot |
| | 49 | distro=xenial |
| | 50 | export LANG=C |
| | 51 | # setup second stage |
| | 52 | /debootstrap/debootstrap --second-stage |
| | 53 | }}} |
| | 54 | * this is the most minimal rootfs we would recommend |
| | 55 | |
| | 56 | 4. (optional) add additional apt package repos: |
| | 57 | {{{ |
| | 58 | #!bash |
| | 59 | cat <<EOT > /etc/apt/sources.list |
| | 60 | deb http://ports.ubuntu.com/ubuntu-ports $distro main restricted universe multiverse |
| | 61 | deb http://ports.ubuntu.com/ubuntu-ports $distro-updates main restricted universe multiverse |
| | 62 | deb http://ports.ubuntu.com/ubuntu-ports $distro-security main restricted universe multiverse |
| | 63 | EOT |
| | 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 | |
| | 67 | 5. (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 |
| | 70 | apt-get update |
| | 71 | apt-get -f install # fixup missing package dependencies |
| | 72 | apt-get install locales dialog |
| | 73 | dpkg-reconfigure locales |
| | 74 | }}} |
| | 75 | |
| | 76 | 6. set hostname: |
| | 77 | {{{ |
| | 78 | #!bash |
| | 79 | echo ${distro}-$(uname -m) > /etc/hostname |
| | 80 | }}} |
| | 81 | |
| | 82 | 7. set a root passwd so you can login |
| | 83 | {{{ |
| | 84 | #!bash |
| | 85 | passwd |
| | 86 | }}} |
| | 87 | - or consider adding a user via {{{adduser}}}: |
| | 88 | {{{ |
| | 89 | #!bash |
| | 90 | adduser myuser |
| | 91 | usermod -a -G tty myuser # add to tty group for tty access |
| | 92 | usermod -a -G dialout myuser # add to dialout group for UART access |
| | 93 | usermod -a -G sudo myuser # add to sudo group for root access |
| | 94 | }}} |
| | 95 | |
| | 96 | 8. (optional) configure networking: |
| | 97 | - wired ethernet with DHCP on eth0 |
| | 98 | {{{ |
| | 99 | #!bash |
| | 100 | cat <<EOF >> /etc/network/interfaces |
| | 101 | allow-hotplug eth0 |
| | 102 | auto eth0 |
| | 103 | iface eth0 inet dhcp |
| | 104 | |
| | 105 | EOF |
| | 106 | }}} |
| | 107 | - or static IP: |
| | 108 | {{{ |
| | 109 | #!bash |
| | 110 | cat <<EOF >> /etc/network/interfaces |
| | 111 | allow-hotplug eth0 |
| | 112 | auto eth0 |
| | 113 | iface eth0 inet static |
| | 114 | address 192.168.1.1 |
| | 115 | netmask 255.255.255.0 |
| | 116 | gateway 192.168.1.254 |
| | 117 | |
| | 118 | EOF |
| | 119 | }}} |
| | 120 | - or wireless (requires ~3MB of additional packages): |
| | 121 | {{{ |
| | 122 | #!bash |
| | 123 | apt-get install wpasupplicant iw |
| | 124 | cat << EOF >> /etc/network/interfaces |
| | 125 | # Wireless interface |
| | 126 | auto wlan0 |
| | 127 | iface wlan0 inet dhcp |
| | 128 | wireless_mode managed |
| | 129 | wireless_essid any |
| | 130 | wpa-driver nl80211 |
| | 131 | wpa-conf /etc/wpa_supplicant.conf |
| | 132 | |
| | 133 | EOF |
| | 134 | wpa_passphrase <myssid> <mypass> >> /etc/wpa_supplicant.conf |
| | 135 | }}} |
| | 136 | |
| | 137 | 9. (optional) install some useful packages |
| | 138 | {{{ |
| | 139 | #!bash |
| | 140 | apt-get install openssh-server # ssh server for remote access |
| | 141 | apt-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 | |
| | 145 | 10. install Gateworks pre-built kernel: |
| | 146 | {{{#!bash |
| | 147 | apt-get install wget |
| | 148 | cd / |
| | 149 | wget http://svn.gateworks.com/newport/images/gateworks-linux-arm64-4.14.tar.bz2 |
| | 150 | tar -xvf gateworks-linux-arm64-4.14.tar.bz2 |
| | 151 | }}} |
| | 152 | |
| | 153 | 11. exit the chroot shell and remove files we no longer need |
| | 154 | {{{ |
| | 155 | #!bash |
| | 156 | exit |
| | 157 | sudo rm $target/usr/bin/qemu-arm-static |
| | 158 | }}} |
| | 159 | |
| | 160 | 12. 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 |
| | 164 | DEVICE=/dev/sdc |
| | 165 | # unmount all auto-mounted partitions for this device |
| | 166 | sudo umount ${DEVICE}? |
| | 167 | # partition disk - single ext partition |
| | 168 | printf ",,L,,\n" | sudo sfdisk -uS ${DEVICE} |
| | 169 | sync |
| | 170 | sudo mkfs.ext4 -L rootfs ${DEVICE}1 |
| | 171 | # mount partition (will mount to /media/rootfs/) |
| | 172 | sudo udisks --mount ${DEVICE}1 |
| | 173 | # copy the root filesystem |
| | 174 | sudo cp -rupv $target/* /media/rootfs/ |
| | 175 | # unmount the disk |
| | 176 | sudo udisks --unmount ${DEVICE}1 |
| | 177 | }}} |