[[PageOutline]] = OpenWrt on Ventana = Gateworks Provides an OpenWrt BSP supporting the Ventana product family. For more info on OpenWrt see: [[TitleIndex(OpenWrt)]] [=#building] == Building == Please refer to the [wiki:OpenWrt/building OpenWrt/building page] for instructions on building OpenWrt for the Gateworks products. [=#prebuilt] == Prebuilt binaries == You can find pre-built binaries for Ventana OpenWrt here: * [http://dev.gateworks.com/openwrt/latest/imx6/ Latest build] * [http://dev.gateworks.com/ventana/images/ Stable well tested releases] * Which ubi size to use, normal or large, has to do with the flash geometry size (see [wiki:/linux/ubi/#flashgeometry here] to determine your flash geometry) [=#install] == Installing == As Ventana boards have a variety of storage and boot devices there are several options to choose from. [=#jtag] === Installing via JTAG - Easiest Option === If you have a Gateworks USB JTAG programmer you can install firmware images using the {{{jtag_usbv4}}} software running on a Linux host. Note that the serial/ethernet method ([#serial_enet below]) is much faster if you have serial console access and network access to a TFTP server. This method does not require anything other than a Gateworks USB JTAG programmer, a Linux PC, and the {{{jtag_usbv4}}} application. '''NOTE: Ventana JTAG only works on Linux and with {{{jtag_usbv4}}}''' found [http://dev.gateworks.com/jtag/jtag_usbv4 here]. Please see [wiki:jtag_instructions JTAG instructions] for more details. The {{{jtag_usbv4}}} application requires a binary firmware image of the entire FLASH storage device. By convention we put a {{{.bin}}} file extension on this. These images are created with the {{{mkimage_jtag}}} script which can be found [http://dev.gateworks.com/jtag/mkimage_jtag here]. For details on creating JTAGable FLASH images see [wiki:jtag_instructions#images here]. Note that you need to choose the firmware image appropriate for your board's FLASH storage: * u-boot_spl.bin - Binary JTAG image of 'just' the boot firmware (works for all FLASH types and sizes) * ventana-owrt-*-large.bin - for 2GB NAND FLASH devices * ventana-owrt-*-normal.bin - for 256MB NAND FLASH devices Example usage of {{{jtag_usbv4}}} to program a 256MB NAND FLASH running on a Linux PC: {{{#!bash sudo rmmod ftdi_sio # make sure the ftdi_sio kernel module is not using the JTAG device sudo jtag_usbv4 –p ventana_owrt_normal.bin # program Gateworks JTAG Programmer v4.0 r311 Copyright (C) 2004-2014, Gateworks Corporation, All Rights Reserved Built 12:32:04, Jul 10 2014 Using USB Port Channel # S01 -------------------------------------------------------------------------------- USB Open Rev r0 JTAG_ID #00 V7A JTAG_ID #01 DMA JTAG_ID #02 MXD JTAG_ID #03 MSP Boot Sane OK Load Debugger OK Flash Size 256 BAD Blocks 0 Flash Erase OK Flash Boot OK Flash Prog OK }}} See also: * [wiki:jtag_instructions JTAG Tutorial Page] * [http://dev.gateworks.com/jtag/jtag_usbv4 jtag_usbv4 executable (32/64bit x86 Linux)] * [http://dev.gateworks.com/openwrt/latest/imx6 Ventana most recent pre-built OpenWrt images] * [http://dev.gateworks.com/images/ventana Ventana stable/released pre-built OpenWrt images] [=#serial_enet] === Installing Firmware via Serial / Ethernet(TFTP) using the bootloader === The procedure for updating the OS (kernel+rootfs) via Serial/ENET and a tftp server depends on what type of FLASH the Ventana product has. [=#serial_enet_nand] ==== NAND flash ==== The fastest way to update the OS firmware on a board is to use the Bootloader with a serial console connection and a network connection to a TFTP server. Note that this does not allow updating the entire boot firmware. Before doing this, make sure you have a TFTP server on the same network as the board and have placed the required firmware images there. The firmware images in this case are not JTAG'able binary files used in the [#jtag JTAG programming method above] but instead are UBI filesystem images ({{{.ubi}}} files). * Which ubi size to use, normal or large, has to do with the flash geometry size (see [wiki:/linux/ubi/#flashgeometry here] to determine your flash geometry) The following steps are used to install firmware to a Ventana board using Serial and Ethernet. 1. Connect your target board to your network, power the device, and break into the Bootloader when prompted: {{{#!bash U-Boot SPL 2015.04-ge511908 (Jan 12 2018 - 08:46:10) Booting from NAND PMIC: PFUZE100 ID=0x10 NAND : 2048 MiB U-Boot 2015.04-ge511908 (Jan 12 2018 - 08:46:10) CPU: Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz) CPU: Automotive temperature grade (-40C to 125C) at 45C Reset cause: POR I2C: ready DRAM: 2 GiB PMIC: PFUZE100 ID=0x10 NAND: 2048 MiB MMC: FSL_SDHC: 0 auto-detected panel HDMI Display: HDMI (1024x768) In: serial Out: serial Err: serial Gateworks Corporation Copyright 2014 Model: GW5404-D MFGDate: 10-23-2015 Serial:662039 GSC: v50 0xd60e WDT:disabled board temp at 48C RTC: 0 DIO0: GPIO1_IO09 (gpio-9) DIO1: GPIO1_IO19 (gpio-19) DIO2: GPIO2_IO09 (gpio-41) DIO3: GPIO2_IO10 (gpio-42) MSATA: enabled RS232: enabled Net: FEC [PRIME], usb_ether Hit any key to stop autoboot: 0 Ventana > }}} 1. Set your the env variables used by {{{tftpboot}}} appropriate for your network. For example: {{{#!bash Ventana > setenv ipaddr 192.168.1.1 Ventana > setenv netmask 255.255.255.0 Ventana > setenv serverip 192.168.1.146 }}} 1. Set the {{{image_rootfs}}} variable to the filename on your TFTP server and run the {{{nand_update}}} script (present in the default Ventana NAND bootloader) which will TFTP the file, erase and program NAND: {{{#!bash Ventana > setenv image_rootfs ventana-owrt-20.06-large.ubi Ventana > run nand_update Updating NAND from 192.168.1.146:ventana-owrt-20.06-large.ubi... Using FEC device TFTP from server 192.168.1.146; our IP address is 192.168.1.1 Filename 'ventana-owrt-20.06-large.ubi'. Load address: 0x12000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ... ################################################################# ################################################################# ################################################################# ############# 8.8 MiB/s done Bytes transferred = 25952256 (18c0000 hex) NAND erase.part: device 0 offset 0x1100000, size 0x7ef00000 Skipping bad block at 0x50580000 Erasing at 0x7ffc0000 -- 100% complete. OK NAND write: device 0 offset 0x1100000, size 0x18c0000 25952256 bytes written: OK Ventana > }}} 1. Reset or power cycle the board If no changes have been made to the default environment variables, your board will boot to a OpenWrt prompt on your newly built kernel/filesystem. If the bootloader environment was modified you may want to erase the u-boot env flash section to set the board back to factory defaults. This can be done by the following: {{{#!bash env default -f -a saveenv }}} Notes: * NAND flash devices can contain bad blocks (to allow for a lower price/size) and also have ECC for error correction. The flash devices have a certian amount of 'out of band' (OOB) storage available for every block that can be used for things such as ECC and/or filesystems. The i.MX6 NAND controller has hardware ECC support but uses the entire OOB area for the flash devices we use. The JFFS2 filesystem requires OOB for NAND and thus will not work on i.MX6 NAND solutions therefore we use the UBIFS filesystem. * Standard Ventana product currently has 256MB NAND FLASH, however some custom boards have 1GB or 2GB NAND. For boards with 1GB/2GB FLASH use openwrt-imx6-ventana-rootfs_large.ubi [=#blockdev] === Installing OpenWrt on a removable block storage device: MicroSD card / USB drive / mSATA device === Installing OpenWrt on a removable block storage device: MicroSD card / USB drive / mSATA device The latest OpenWrt package and kernel configuration in the trunk BSP supports the necessary configuration for booting to a USB/micro-SD/mSATA based root filesystem (static kernel support for chipidea USB host controller, EHCI, and MXS phy) therefore all you need to do is create the storage device using the tarball of the root filesystem. Starting with the OpenWrt 16.02 branch, we have decided to include a script ({{{mkimage_blkdev}}}) to make creating bootable block storage devices with various tarballs's easier. The usage is as follows: {{{#!bash # The system has 2x block devices currently connected > ./gateworks/scripts/mkimage_blkdev usage: mkimage_blkdev /dev/sdX file1.tar[.gz|.bz2] [file2.tar[.gz|.bz2] ...] [ [env]] The following block devices were found: /dev/sdc: JetFlash Transcend 32GB 29.4219GB /dev/sdd: Kingston DataTraveler SE9 7.26727GB }}} An example execution of this may look as follows: {{{#!bash sudo ./gateworks/scripts/mkimage_blkdev /dev/sdb /bin/imx6/gateworks-imx6-ventana-*.tar.gz SPL u-boot.img }}} In the above example, we pass in several tarballs that match the gateworks-imx6-ventana-*.tar.gz expansion and flash it onto /dev/sdc. In the process, we re-partition /dev/sdc with a single ext4 partition where the contents of the tarballs are placed. * [http://dev.gateworks.com/ventana/images/SPL Ventana SPL Download] * [http://dev.gateworks.com/ventana/images/u-boot.img Ventana u-boot.img Download] To flash an msata device, you may have to do the following: {{{#!bash sudo FORCE=1 ./gateworks/scripts/mkimage_blkdev bin/imx6/gateworks-imx6-ventana-*.tar.gz /dev/sde The reason for this is that msata devices often don't look like a 'block storage device' to linux, but instead as a hard drive. There are protections built into the mkimage_blkdev script in order to avoid user error and accidentally wipe out their own hard disks, which is the reason for the FORCE=1 override. Please use this flag only while exercising extreme caution. }}} To see information on the manual steps for creating a bootable tarball, please visit the [wiki:linux/blockdev linux/blockdev] page.