| 1 | [[PageOutline]] |
| 2 | |
| 3 | |
| 4 | = Building OpenWrt & Installing for the Gateworks Ventana Family = |
| 5 | 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. |
| 6 | |
| 7 | **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. |
| 8 | ** |
| 9 | |
| 10 | |
| 11 | = Step 1. Compiling the Source Code = |
| 12 | Please refer [wiki:build_openwrt here] for instructions on building OpenWrt for the Gateworks products. |
| 13 | |
| 14 | |
| 15 | = Step 2. Installing Firmware = |
| 16 | [http://svn.gateworks.com/ventana/images/ Prebuilt OpenWrt Binaries] |
| 17 | |
| 18 | Customers may choose to compile their own firmware or use our prebuilt binaries [http://svn.gateworks.com/ventana/images/ Prebuilt OpenWrt Binaries] |
| 19 | |
| 20 | |
| 21 | === Installing Firmware on a Ventana board via JTAG - Easiest Option === |
| 22 | If you have a JTAG programmer it is easier to install firmware this way! (TFTP method below is faster) |
| 23 | |
| 24 | NOTE: Ventana JTAG only works on Linux and with the latest JTAG software (version 4 available [wiki:jtag_instructions here]). |
| 25 | |
| 26 | 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 2GB version, whereas 256mb is standard) |
| 27 | |
| 28 | The binary files can be found in the link above. If running a custom build, here is out to create a JTAG binary image |
| 29 | * [http://trac.gateworks.com/wiki/jtag_instructions#CreatingjtagableimagesforVentana Manual Create Images] |
| 30 | * [http://trac.gateworks.com/wiki/build_openwrt#BuildingJTAGBinaryFile Easy Create Images] |
| 31 | |
| 32 | An example using a Linux PC |
| 33 | {{{ |
| 34 | ./sudo rmmod ftdi_sio |
| 35 | |
| 36 | ./sudo jtag_usbv4 –p ventana_owrt_normal.bin |
| 37 | |
| 38 | Gateworks JTAG Programmer v4.0 r311 |
| 39 | Copyright (C) 2004-2014, Gateworks Corporation, All Rights Reserved |
| 40 | Built 12:32:04, Jul 10 2014 |
| 41 | Using USB Port |
| 42 | |
| 43 | Channel # S01 |
| 44 | -------------------------------------------------------------------------------- |
| 45 | USB Open Rev r0 |
| 46 | JTAG_ID #00 V7A |
| 47 | JTAG_ID #01 DMA |
| 48 | JTAG_ID #02 MXD |
| 49 | JTAG_ID #03 MSP |
| 50 | Boot Sane OK |
| 51 | Load Debugger OK |
| 52 | Flash Size 256 |
| 53 | BAD Blocks 0 |
| 54 | Flash Erase OK |
| 55 | Flash Boot OK |
| 56 | Flash Prog OK |
| 57 | }}} |
| 58 | |
| 59 | Please see more details about the JTAG firmware install here: [wiki:jtag_instructions JTAG Tutorial Page] |
| 60 | |
| 61 | While the JTAG method is the easiest, the TFTP method shown below will transfer faster. |
| 62 | |
| 63 | |
| 64 | === Installing Firmware on a Ventana board via Serial/ENET(tftp) using the bootloader === |
| 65 | 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. |
| 66 | |
| 67 | '''All Ventana product's except for the GW5400-A have NAND FLASH.''' |
| 68 | |
| 69 | |
| 70 | ==== NAND flash ==== |
| 71 | 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: |
| 72 | |
| 73 | 1. Connect your target board to your network, set ipaddress and serverip in uboot |
| 74 | |
| 75 | <boot the board and hit a key to enter into u-boot prompt> |
| 76 | {{{ |
| 77 | setenv ipaddr <localip> |
| 78 | setenv serverip <serverip> |
| 79 | }}} |
| 80 | i.e. Set localip to 192.168.1.211 and serverip to 192.168.1.14 |
| 81 | {{{ |
| 82 | setenv ipaddr 192.168.1.211 |
| 83 | setenv serverip 192.168.1.14 |
| 84 | }}} |
| 85 | |
| 86 | 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 |
| 87 | 1. Confirm the file in the variable image_rootfs is the one you want. To change it use the following command: |
| 88 | {{{ |
| 89 | setenv image_rootfs openwrt-imx6-ventana-rootfs_normal.ubi |
| 90 | }}} |
| 91 | 2. Run the nand_update script: |
| 92 | {{{ |
| 93 | run nand_update |
| 94 | }}} |
| 95 | |
| 96 | 3. boot to nand: |
| 97 | {{{ |
| 98 | boot |
| 99 | }}} |
| 100 | |
| 101 | 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. |
| 102 | |
| 103 | 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: |
| 104 | {{{ |
| 105 | env default -f -a |
| 106 | saveenv |
| 107 | }}} |
| 108 | |
| 109 | Notes: |
| 110 | * 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. |
| 111 | * Standard Ventana product currently has 256MB NAND FLASH, however some custom boards have 2GB NAND. For boards with 2GB FLASH use openwrt-imx6-ventana-rootfs_large.ubi |
| 112 | |
| 113 | |
| 114 | ==== SPI flash ==== |
| 115 | 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: |
| 116 | |
| 117 | 1. Connect your target board to your network, set ipaddress and serverip in uboot |
| 118 | |
| 119 | <boot the board and hit a key to enter into u-boot prompt> |
| 120 | {{{ |
| 121 | setenv ipaddr <localip> |
| 122 | setenv serverip <serverip> |
| 123 | }}} |
| 124 | i.e. Set localip to 192.168.1.211 and serverip to 192.168.1.14 |
| 125 | {{{ |
| 126 | setenv ipaddr 192.168.1.211 |
| 127 | setenv serverip 192.168.1.14 |
| 128 | }}} |
| 129 | |
| 130 | |
| 131 | 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 |
| 132 | {{{ |
| 133 | run spi_update |
| 134 | }}} |
| 135 | |
| 136 | 4. boot to nand: |
| 137 | {{{ |
| 138 | boot |
| 139 | }}} |
| 140 | |
| 141 | |
| 142 | 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. |
| 143 | |
| 144 | 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: |
| 145 | {{{ |
| 146 | env default -f -a |
| 147 | saveenv |
| 148 | }}} |
| 149 | |
| 150 | |
| 151 | = Installing OpenWrt on a removable block storage device: MicroSD card / USB drive / mSATA device = |
| 152 | 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. |
| 153 | |
| 154 | Requirements: |
| 155 | 1. Get a microsd card / usb drive / mSATA device |
| 156 | 2. Build OpenWrt |
| 157 | 3. Run the makedisk script from the OpenWrt BSP on a linux computer **making sure to correctly point to your removable media** |
| 158 | {{{ |
| 159 | ./scripts/makedisk /dev/sdc trunk/bin/imx6/openwrt-imx6-ventana-rootfs.tar.gz |
| 160 | }}} |
| 161 | 4. Place the uSD in your ventana board and power up - by default the ventana bootloader env scripts will boot from mmc if present and a kernel is found, otherwise it will fallback to its on-board flash. This can be verified by booting into the bootloader and running the command 'print' which will show all the environment variables. bootcmd will indicate if it is trying to reach the mmc. If there is no indication of this, the bootloader may need to be updated via instructions here: [wiki:ventana/bootloader#BuildingfromSource] |