We're no longer updating This wiki!!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:c1_ubuntu_minimal [2015/08/10 00:41]
mdrjr
en:c1_ubuntu_minimal [2016/11/04 03:02]
mdrjr
Line 1: Line 1:
 +Changelog:
 +
 +20150121: ​
 +  - Initial version
 +20150131:
 +  - Added the missing automount of /media/boot
 +  - Fixed the date (image was 20140121)
 +  - Added optional step to allow root login via ssh (included on the image)
 +20161102:
 +  - Updated to Ubuntu 16.04
 +----
 +
 +To this you'll need:
 +      * PC running Linux Ubuntu 16.04 64 Bits
 +      * MicroSD or eMMC to write the new image
 +
 +
 +This guide will cover the process to recreate the official Ubuntu Minimal image.
 +Tested and written on a Ubuntu 16.04 64Bits x86 Machine.
 +
 +  - Tools: \\ Basic set of tools that we will need to create our image. <​code>​
 +sudo apt-get install debootstrap qemu-user-static</​code>​
 +  - Work folder\\ Create a workspace<​code>​
 +mkdir ~/ubuntu
 +cd ubuntu
 +export ubuntu=`pwd`</​code>​
 +  - Empty image (4GB) \\ Create a image with 4096 1Mbyte blocks (4Gbyte image) <​code>​
 +dd if=/​dev/​zero of=./​image.img bs=1M count=4096
 +</​code>​
 +  - Image partitioning \\ Create the two needed partitions, one fat32 for kernel+initramfs+boot script and another ext4 for the OS <​code>​
 +fdisk image.img
 +n
 +p
 +1
 +<​return>​
 ++128M
 +t
 +c
 +n
 +p
 +2
 +<​return>​
 +<​return>​
 +w
 +</​code>​
 +  - Formatting and setting up partitions \\ Setup loopback and format the partitions. \\ Also change the UUID and disable journaling. <​code>​
 +sudo losetup /dev/loop0 ./image.img
 +sudo partprobe /dev/loop0
 +sudo mkfs.vfat -n boot /​dev/​loop0p1
 +sudo mkfs.ext4 -L rootfs /​dev/​loop0p2
 +sudo tune2fs /​dev/​loop0p2 -U e139ce78-9841-40fe-8823-96a304a09859
 +sudo tune2fs -O ^has_journal /​dev/​loop0p2
 +</​code>​
 +  - Bootloaders \\ Download a pre-built version of U-Boot for C1 and fuse to our image. <​code>​
 +wget https://​raw.githubusercontent.com/​mdrjr/​c1_uboot_binaries/​master/​bl1.bin.hardkernel
 +wget https://​raw.githubusercontent.com/​mdrjr/​c1_uboot_binaries/​master/​u-boot.bin
 +wget https://​raw.githubusercontent.com/​mdrjr/​c1_uboot_binaries/​master/​sd_fusing.sh
 +chmod +x sd_fusing.sh
 +sudo ./​sd_fusing.sh /dev/loop0
 +</​code>​
 +  - Deboostrap \\ Mount the partitions, copy qemu to enable chroot to arm and start debootstrap <​code>​
 +mkdir -p target
 +sudo mount /​dev/​loop0p2 target
 +sudo mkdir -p target/​media/​boot
 +sudo mount /​dev/​loop0p1 target/​media/​boot
 +sudo mkdir -p target/​usr/​bin
 +sudo cp /​usr/​bin/​qemu-arm-static target/​usr/​bin
 +sudo debootstrap --variant=buildd --arch armhf xenial target http://​ports.ubuntu.com
 +</​code>​
 +  - Preparations via chroot \\ Will add hardkernel keys and repositories,​ fix ubuntu respository list and install the basic set of tools for a minimal image <​code>​
 +sudo chroot target
 +cat << EOF > /​etc/​apt/​sources.list
 +deb http://​ports.ubuntu.com/​ubuntu-ports/​ xenial main universe restricted
 +deb-src http://​ports.ubuntu.com/​ubuntu-ports/​ xenial main universe restricted
 +
 +deb http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-updates main universe restricted
 +deb-src http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-updates main universe restricted
 +
 +deb http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-backports main restricted
 +deb-src http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-backports main restricted
 +
 +deb http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-security main restricted
 +deb-src http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-security main restricted
 +deb http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-security universe
 +deb-src http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-security universe
 +deb http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-security multiverse  ​
 +deb-src http://​ports.ubuntu.com/​ubuntu-ports/​ xenial-security multiverse
 +EOF
 +
 +apt-get update
 +apt-get install software-properties-common u-boot-tools isc-dhcp-client ubuntu-minimal ssh
 +
 +apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D986B59D
 +echo "deb http://​deb.odroid.in/​c1/​ xenial main" > /​etc/​apt/​sources.list.d/​odroid.list
 +apt-get update
 +
 +apt-get install linux-image-c1 bootini
 +</​code>​At this point.. You'll have several errors, That's fine. \\ You can ignore it right now.<​code>​
 +cp /​boot/​uImage* /​media/​boot/​uImage
 +</​code>​
 +  - Setup ethernet as DHCP and create the loopback interface <​code>​
 +cat << EOF > /​etc/​network/​interfaces.d/​lo
 +auto lo
 +iface lo inet loopback
 +EOF
 +
 +cat << EOF > /​etc/​network/​interfaces.d/​eth0
 +auto eth0
 +iface eth0 inet dhcp
 +EOF
 +</​code>​
 +  - Setup fstab <​code>​echo "​LABEL=boot /media/boot vfat defaults 0 0" >> /etc/fstab
 +echo "​UUID=e139ce78-9841-40fe-8823-96a304a09859 / ext4 errors=remount-ro,​noatime 0 1" >> /​etc/​fstab</​code>​
 +  - Setting a root password <​code>​
 +passwd root
 +</​code>​
 +  - (Optional) Allow root login via ssh <​code>​sed -i s/"​PermitRootLogin without-password"/"​PermitRootLogin yes"/g /​etc/​ssh/​sshd_config</​code>​
 +  - Clean ups and preparation to test the image. <​code>​exit
 +sudo umount target/​media/​boot
 +sudo umount target
 +sudo sync
 +sudo losetup -d /dev/loop0
 +</​code>​
 +  - Flashing your image <​code>​
 +dd if=image.img of=/dev/sdX bs=1M
 +</​code>​
 +  - After your first boot, install the u-boot package to get updates. <​code>​sudo apt-get install u-boot</​code>​
  
en/c1_ubuntu_minimal.txt ยท Last modified: 2016/11/04 03:02 by mdrjr
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0