Changes between Version 44 and Version 45 of newport


Ignore:
Timestamp:
02/12/2018 01:42:44 PM (8 months ago)
Author:
Tim Harvey
Comment:

updated instructions regarding updating Boot Firmware to account for preparing image with custom kernel/script/env

Legend:

Unmodified
Added
Removed
Modified
  • newport

    v44 v45  
    160160[=#serial-ethernet-uboot]
    161161=== Update Firmware via Serial Console and Ethernet from Bootloader ===
    162 If using U-Boot (recommended) you need to setup a TFTP server to host the files for transfer. Alternatively you could load firmware files from removable storage (microSD, mSATA, or USB for example) however the transfer rate is typically very slow compared to Gigabit Ethernet. For details on setting up a TFTP server see [wiki:tftpserver here].
     162If updating firmware via Bootloader/Serial/Ethernet (recommended for speed) you need to setup a TFTP server to host the files for transfer. Alternatively you could load firmware files from removable storage (microSD, mSATA, or USB for example) however the transfer rate is typically very slow compared to Gigabit Ethernet. For details on setting up a TFTP server see [wiki:tftpserver here].
    163163
    164164The following instructions assume your board target IP address is 192.168.1.1 and you have a TFTP server at 192.168.1.146. Adjust environment according to your network via 'setenv ipaddr <ipaddr>' and 'setenv serverip <serverip>'.
     
    169169 * use {{{mmc list}}} to see how they are configured
    170170
    171 Examples:
    172  * Update just the '[wiki:newport/boot boot firmware]' (everything up to and including the Bootloader) ([https://github.com/Gateworks/images-newport/raw/master/firmware-newport.img firmware image]):
    173 {{{#!bash
    174 setenv dev 0 # use 'mmc list' to show which device to use for eMMC vs microSD
    175 tftpboot ${loadaddr} firmware-newport.img && mmc write ${loadaddr} 0 8000 # update first 16MB
    176 }}}
    177  * Update the entire device from a Compressed Disk Image ('[wiki:newport/boot boot firmware]' as well as OS):
     171The methods you use to update the firmware depends on what specifically you are trying to update.
     172
     173Update the entire device from a Compressed Disk Image ('[wiki:newport/boot boot firmware]' as well as OS):
    178174{{{#!bash
    179175setenv dev 0 # use 'mmc list' to show which device to use for eMMC vs microSD
    180176tftpboot ${loadaddr} xenial-newport.img.gz && gzwrite mmc ${dev} ${loadaddr} ${filesize}
    181177}}}
    182   - If using Ubuntu you will want to run {{{resize2fs /dev/mmcblk0p2}}} to resize the partition to expand to the available anytime after the first. This is because {{{xenial-newport.img.gz}}} is a compressed disk image created with a minimal root filesystem to keep flashing time down to a minimum for fast updates.
     178  - If the image was created using a minimally sized filesystem you will want to resize it after booting to take advantage of the full partition space. For an {{{ext4}}} root filesystem on the primary MMC device run {{{resize2fs /dev/mmcblk0p2}}}.
     179
     180Updating just the kernel can be done with {{{tftpboot}}} and {{{fatwrite}}}:
     181{{{#!bash
     182# kernel
     183tftpboot $loadaddr kernel.itb && fatwrite mmc $dev:1 $loadaddr kernel.itb $filesize
     184# bootscript
     185tftpboot $loadaddr newport.scr && fatwrite mmc $dev:1 $loadaddr newport.scr $filesize
     186}}}
     187
     188Updating the [wiki:newport/boot 'Boot firmware'] (everything up to and including the Bootloader) requires preparing a boot image that contains your desired partition table, boot firmware, kernel, bootscript and U-Boot environment:
     189 * on Linux development host with the Newport BSP in a shell that has the env setup:
     190{{{#!bash
     191IMG=myimage.img
     192KERNEL=linux/arch/arm64/boot/Image
     193cp firmware-newport.img $(IMG)
     194# create kernel.itb with compressed kernel image
     195cp $(KERNEL) vmlinux
     196gzip -f vmlinux
     197./newport/mkits.sh -o kernel.its -k ${PWD}/vmlinux.gz -C gzip -v "Newport Kenrel"
     198mkimage -f kernel.its kernel.itb
     199# copy kernel.itb into FAT12 filesystem
     200fatfs-tool -i $(IMG) cp kernel.itb /
     201# create bootscript (customize ubuntu.scr as needed)
     202mkimage -A arm64 -T script -C none -d newport/ubuntu.scr ./newport.scr
     203# copy newport.scrinto FAT12 filesystem
     204fatfs-tool -i $(IMG) cp newport.scr /
     205}}}
     206 * on a Newport booted to the bootloader:
     207{{{#!bash
     208setenv dev 0 # use 'mmc list' to show which device to use for eMMC vs microSD
     209tftpboot ${loadaddr} myimage.img && mmc write ${loadaddr} 0 8000 # update first 16MB
     210mmc rescan # re-scan the mmc devices in case the partition table changed
     211}}}
    183212
    184213
    185214[=#serial-ethernet-linux]
    186215=== Update Firmware via Serial Console and Ethernet from Linux ===
    187 If booted to Linux on a board you can easily update the [wiki:newport/boot 'Boot Firmware']:
     216If booted to Linux on a board you can also update the kernel and bootscript fairly easily by mounting the FAT12 filesystem and copying the file(s):
     217{{{#!bash
     218mount /dev/mmcblk0p1 /mnt
     219cp kernel.itb /mnt
     220cp newport.scr /mnt
     221}}}
     222
     223You can also easily update the [wiki:newport/boot 'Boot Firmware']. First prepare a boot image that contains your desired partition table, boot firmware, kernel, bootscript and U-Boot environment (see example above). Then on a booted Newport:
    188224{{{#!bash
    189225cd /tmp
    190 wget http://dev.gateworks.com/newport/firmware-newport.img
    191 dd if=firmware-newport.img of=/dev/mmcblk0
     226wget http://dev.gateworks.com/newport/myimage.img
     227dd if=myimage.img of=/dev/mmcblk0
    192228}}}
    193229 * Note above we are writing to {{{/dev/mmcblk0}}} and not a partition
    194230 * Use {{{/dev/mmcblk1}}} for the secondary MMC device (ie microSD)
    195231 * Note that Newport boards only supports MMC based boot devices
    196 
    197 If booted to Linux on a board you can also update the kernel and bootscript fairly easily by mounting the FAT12 filesystem and copying the file(s):
    198 {{{#!bash
    199 mount /dev/mmcblk0p1 /mnt
    200 cp kernel.itb /mnt
    201 cp newport.scr /mnt
    202 }}}
     232 *  **Note that this overwrites the partition-table, the U-Boot environment, and the FAT12 filesystem which are things you might have customizations in.**
    203233
    204234Note that if you want to update the root filesystem itself from within Linux you can only do this by either: