[[PageOutline]] = Building OpenWrt & Installing for the Gateworks Ventana Family = Gateworks Provides patches to OpenWrt for the Ventana Family that can be downloaded and applied. These patches are periodically updated to fit on top of recent OpenWrt snapshots. The Ventana Family currently is using Linux v3.8.x and is provided with a host of userland tools built into the filesystem to do everything from mesh routing to mounting a hard drive on a read/write filesystem with room for plenty of additional tools/utilities provided by OpenWrt. A web GUI (LUCI) has also been provided on the boards that enables easy administration of the product. **Ventana is still under heavy software development. It is a good idea to update to the latest firmware and monitor our [http://lists.gateworks.com/mailman/listinfo maillist] for activity. ** = Step 1. Compiling the Source Code = Please refer [wiki:build_openwrt here] for instructions on building OpenWrt for the Gateworks products. = Step 2. Installing Firmware = [http://svn.gateworks.com/ventana/images/ Prebuilt OpenWrt Binaries] Customers may choose to compile their own firmware or use our prebuilt binaries [http://svn.gateworks.com/ventana/images/ Prebuilt OpenWrt Binaries] === Installing Firmware on a Ventana board via JTAG - Easiest Option === If you have a JTAG programmer it is easier to install firmware this way! (TFTP method below is faster) NOTE: Ventana JTAG only works on Linux and with the latest JTAG software (version 4 available [wiki:jtag_instructions here]). Every Ventana product is nearly the same and they can all use one universal prebuilt OpenWrt binary (ending in a .bin extension). The file to use is: ventana_owrt_normal.bin. This includes the SPL bootloader and uboot as well. (Exceptions include GW5400A with SPI flash and Ventana boards with larger amounts of flash such as a 1GB/2GB version, whereas 256mb is standard) The binary files can be found in the link above. If running a custom build, here is out to create a JTAG binary image * [http://trac.gateworks.com/wiki/jtag_instructions#CreatingjtagableimagesforVentana Manual Create Images] * [http://trac.gateworks.com/wiki/build_openwrt#BuildingJTAGBinaryFile Easy Create Images] An example using a Linux PC {{{ ./sudo rmmod ftdi_sio ./sudo jtag_usbv4 –p ventana_owrt_normal.bin 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 }}} Please see more details about the JTAG firmware install here: [wiki:jtag_instructions JTAG Tutorial Page] While the JTAG method is the easiest, the TFTP method shown below will transfer faster. === Installing Firmware on a Ventana board via Serial/ENET(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. '''All Ventana product's except for the GW5400-A have NAND FLASH.''' ==== NAND flash ==== To install firmware to a Ventana board using Serial/ENET once your kernel/rootfs are on a network attached tftpserver (tftpserver instructions->[wiki:tftpserver]) do the following: 1. Connect your target board to your network, set ipaddress and serverip in uboot {{{ setenv ipaddr setenv serverip }}} i.e. Set localip to 192.168.1.211 and serverip to 192.168.1.14 {{{ setenv ipaddr 192.168.1.211 setenv serverip 192.168.1.14 }}} 2. run the nand_update script (present in the default Ventana NAND bootloader) which will tftp 'openwrt-imx6-ventana-rootfs_normal.ubi' (defined in ${image_rootfs}), erase and program NAND 1. Confirm the file in the variable image_rootfs is the one you want. To change it use the following command: {{{ setenv image_rootfs openwrt-imx6-ventana-rootfs_normal.ubi }}} 2. Run the nand_update script: {{{ run nand_update }}} 3. boot to nand: {{{ boot }}} 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: {{{ 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 ==== SPI flash ==== To install firmware to a Ventana board using Serial/ENET once your kernel/rootfs are on a network attached tftpserver (tftpserver instructions->[wiki:tftpserver]) do the following: 1. Connect your target board to your network, set ipaddress and serverip in uboot {{{ setenv ipaddr setenv serverip }}} i.e. Set localip to 192.168.1.211 and serverip to 192.168.1.14 {{{ setenv ipaddr 192.168.1.211 setenv serverip 192.168.1.14 }}} 3. run the spi_update script (present in the default Ventana SPI bootloader) which will tftp 'openwrt-imx6-imx6q-gw5400-squashfs.bin' (defined in ${image_os}), erase and program NAND {{{ run spi_update }}} 4. boot to nand: {{{ boot }}} 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: {{{ env default -f -a saveenv }}} [=#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 file1.tar[.gz|.bz2] [file2.tar[.gz|.bz2] ...] /dev/sdX 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 bin/imx6/gateworks-imx6-ventana-*.tar.gz /dev/sdc }}} 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. 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.