Changes between Version 3 and Version 4 of newport/ubuntu


Ignore:
Timestamp:
12/15/2017 09:59:42 PM (6 years ago)
Author:
Tim Harvey
Comment:

removed kernel installation from debootstrap steps and add steps for creating images

Legend:

Unmodified
Added
Removed
Modified
  • newport/ubuntu

    v3 v4  
    176176 * Note that by default root ssh access is disabled for security. See [#ssh below] for info on enabling it
    177177
    178 10. install Gateworks pre-built kernel:
    179 {{{#!bash
    180 apt-get install wget
    181 cd /
    182 wget http://svn.gateworks.com/newport/images/gateworks-linux-arm64-4.14.tar.bz2
    183 tar -xvf gateworks-linux-arm64-4.14.tar.bz2
    184 }}}
    185 
    186 11. exit the chroot shell and remove files we no longer need
     17810. exit the chroot shell and remove files we no longer need
    187179{{{
    188180#!bash
     
    191183}}}
    192184
    193 12. install to bootable media:
    194  * 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:
    195 {{{
    196 #!bash
    197 DEVICE=/dev/sdc
    198 # unmount all auto-mounted partitions for this device
    199 sudo umount ${DEVICE}?
    200 # partition disk - single ext partition
    201 printf ",,L,,\n" | sudo sfdisk -uS ${DEVICE}
     185At this point you have a directory containing a root filesystem (without kernel) and likely want to install it onto removable storage or the on-board FLASH of a target board. Some intermediate formats that are useful to keep around would be a tarball, perhaps an ext4 filesystem image, or a compressed disk image suitable for flashing in the U-Boot bootloader.
     186
     187To create a tarball which is the most flexible storage format and can be used for a variety of future installation uses:
     188{{{#!bash
     189sudo tar --numeric-owner -cvJf xenial-newport.tar.xz rootfs/ .
     190}}}
     191
     192To create a 'Compressed Disk Image' using this tarball see [#disk-images above] and to install this onto a board's embedded FLASH see [wiki:newport#serial-ethernet here].
     193
     194
     195=== ext4 filesystem ===
     196If desired you can create an ext4 filesystem from the directory or tarball. This requires you choose a size for the filesystem. This size can be increased at runtime using {{{resize2fs}}} as long as the partition table has room for it to grow. The advantage of using an as small as possible size is that the time necessary to flash it onto storage is reduced to a minimum (when flashing you have to write the entire ext4 fs but when formatting or resizing it only has to write periodic markers to FLASH).
     197
     198For a given size (see SIZEMB variable below) you can create a rootfs with:
     199{{{#!bash
     200SIZEMB=1536 # 1.5GB - expandable later with resize2fs
     201OUT=xenial-newport.ext4
     202# create a file of specific size
     203truncate -s ${SIZEMB}M ${OUT}
     204# format it as an ext4 filesystem
     205mkfs.ext4 -q -F -L rootfs ${OUT}
     206# mount it to a temporary mount point
     207tmp_mnt=$(mktemp -d -p/tmp)
     208mount ${OUT} ${tmp_mnt}
     209# copy files to it
     210cp -rup rootfs/* ${tmp_mnt}
     211# and/or extract files from a tarball
     212tar -C ${tmp_mnt} -xf linux-newport.tar.xz
     213# unmount temporary mount point
     214umount ${tmp_mnt}
    202215sync
    203 sudo mkfs.ext4 -L rootfs ${DEVICE}1
    204 # mount partition (will mount to /media/rootfs/)
    205 sudo udisks --mount ${DEVICE}1
    206 # copy the root filesystem
    207 sudo cp -rupv $target/*  /media/rootfs/
    208 # unmount the disk
    209 sudo udisks --unmount ${DEVICE}1
    210 }}}
     216# compress it
     217gzip -k -f ${OUT}
     218}}}