| 1 | {{{#!html |
| 2 | <div id="wikipage" class="trac-content"><p> |
| 3 | </p><div class="wiki-toc"> |
| 4 | <ol> |
| 5 | <li> |
| 6 | <a href="#OpenWrtsysupgradesupport">OpenWrt sysupgrade support</a> |
| 7 | <ol> |
| 8 | <li> |
| 9 | <a href="#Sysupgradeviacommandline">Sysupgrade via command line</a> |
| 10 | </li> |
| 11 | <li> |
| 12 | <a href="#UsingLuCIWeb-Admin">Using LuCI Web-Admin</a> |
| 13 | </li> |
| 14 | <li> |
| 15 | <a href="#ProductFamilyNotes">Product Family Notes</a> |
| 16 | <ol> |
| 17 | <li> |
| 18 | <a href="#Ventana">Ventana</a> |
| 19 | </li> |
| 20 | <li> |
| 21 | <a href="#Avila">Avila</a> |
| 22 | </li> |
| 23 | </ol> |
| 24 | </li> |
| 25 | </ol> |
| 26 | </li> |
| 27 | </ol> |
| 28 | </div><p> |
| 29 | </p> |
| 30 | <h1 id="OpenWrtsysupgradesupport"><a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> sysupgrade support</h1> |
| 31 | <p> |
| 32 | <tt>sysupgrade</tt> is an <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> invention that allows the rootfs to be updated to another firmware. |
| 33 | </p> |
| 34 | <p> |
| 35 | The <tt>sysupgrade</tt> script for the Gateworks products provides: |
| 36 | </p> |
| 37 | <ul><li>the <tt>/sbin/sysupgrade</tt> script on the target will flash the kernel/rootfs contained in a specified image |
| 38 | </li><li>the image contents will be validated via an md5 checksum in the image header |
| 39 | </li><li>the kernel and rootfs will be updated (squashfs+jffs2, jffs2 supported, or ubi) |
| 40 | </li><li>standard system config files will be retained (saved, then restored) (unless the <tt>-n</tt> cmdline option is provided) |
| 41 | </li><li>the <tt>-c</tt> command-line argument will save all files on the overlay filesystem |
| 42 | </li></ul><p> |
| 43 | A standard <tt>make</tt> in the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> buildroot tree will create a <tt>sysupgrade</tt> image for your target by default named: |
| 44 | </p> |
| 45 | <ul><li>avila/cambria/laguna: <tt>bin/<target>/*-sysupgrade.bin</tt>. |
| 46 | </li><li>ventana: <tt>bin/imx6/*-squashfs-nand_*.ubi</tt> |
| 47 | </li></ul><p> |
| 48 | You can find more information about sysupgrade on the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> wiki <a class="ext-link" href="http://wiki.openwrt.org/doc/howto/generic.sysupgrade"><span class="icon"></span>here</a> |
| 49 | </p> |
| 50 | <p> |
| 51 | <span class="wikianchor" id="cmdline"></span> |
| 52 | </p> |
| 53 | <h2 id="Sysupgradeviacommandline">Sysupgrade via command line</h2> |
| 54 | <p> |
| 55 | Examples: |
| 56 | </p> |
| 57 | <ul><li>Upgrade a 256MB flash device: |
| 58 | <div class="code"><pre><span class="nb">cd</span> /tmp |
| 59 | wget http://192.168.1.175/openwrt/imx6/gateworks-imx6-ventana-squashfs-nand_normal.ubi |
| 60 | sysupgrade -v gateworks-imx6-ventana-squashfs-nand_normal.ubi |
| 61 | </pre></div></li><li>from a URL: |
| 62 | <div class="code"><pre>sysupgrade -v http://192.168.1.175/openwrt/imx6/gateworks-imx6-ventana-squashfs-nand_normal.ubi |
| 63 | </pre></div></li></ul><p> |
| 64 | <span class="wikianchor" id="gui"></span> |
| 65 | </p> |
| 66 | <h2 id="UsingLuCIWeb-Admin">Using LuCI Web-Admin</h2> |
| 67 | <p> |
| 68 | To perform a <tt>sysupgrade</tt> using the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> WebGUI, please use an ubi file, such as <a class="ext-link" href="http://svn.gateworks.com/ventana/images/"><span class="icon"></span>ventana-owrt-14.08-normal.ubi</a> |
| 69 | </p> |
| 70 | <p> |
| 71 | Go to the top System tab, then the lower tab should be selected as <a class="missing wiki">Backup/Flash?</a> Firmware. |
| 72 | </p> |
| 73 | <p> |
| 74 | Under 'Flash new firmware image' please select the ubi from the location on the desktop PC. |
| 75 | </p> |
| 76 | <p> |
| 77 | <a style="padding:0; border:none" href="/attachment/wiki/OpenWrt/sysupgrade/openwrtsysupgrade.jpg"><img width="400px" src="/raw-attachment/wiki/OpenWrt/sysupgrade/openwrtsysupgrade.jpg" /></a> |
| 78 | </p> |
| 79 | <p> |
| 80 | In the background, this is what is happening on the serial console |
| 81 | </p> |
| 82 | <div class="code"><pre>Switching to ramdisk... |
| 83 | <span class="o">[</span> 447.449487<span class="o">]</span> UBIFS: background thread <span class="s2">"ubifs_bgt0_0"</span> stops |
| 84 | <span class="o">[</span> 447.519016<span class="o">]</span> UBIFS: un-mount UBI device 0, volume 0 |
| 85 | <span class="o">[</span> 447.585743<span class="o">]</span> UBI: detaching mtd2 from ubi0 |
| 86 | <span class="o">[</span> 447.591108<span class="o">]</span> UBI: mtd2 is detached from ubi0 |
| 87 | ubiformat: mtd2 <span class="o">(</span>nand<span class="o">)</span>, size 250609664 bytes <span class="o">(</span>239.0 MiB<span class="o">)</span>, 1912 eraseblocks of 131072 bytes <span class="o">(</span>128.0 KiB<span class="o">)</span>, min. I/O size 2048 bytes |
| 88 | libscan: scanning eraseblock 1911 -- 100 % <span class="nb">complete |
| 89 | </span>ubiformat: 1912 eraseblocks have valid erase counter, mean value is 1 |
| 90 | ubiformat: flashing eraseblock 154 -- 100 % <span class="nb">complete |
| 91 | </span>ubiformat: formatting eraseblo<span class="o">[</span> 467.802383<span class="o">]</span> UBI: attaching mtd2 to ubi0 |
| 92 | ubiformat: formatting eraseblock 1911 -- 100 % <span class="nb">complete</span> |
| 93 | <span class="o">[</span> 468.505882<span class="o">]</span> UBI: scanning is finished |
| 94 | <span class="o">[</span> 468.525333<span class="o">]</span> UBI: volume 0 <span class="o">(</span><span class="s2">"rootfs"</span><span class="o">)</span> re-sized from 153 to 1868 LEBs |
| 95 | <span class="o">[</span> 468.532619<span class="o">]</span> UBI: attached mtd2 <span class="o">(</span>name <span class="s2">"rootfs"</span>, size 239 MiB<span class="o">)</span> to ubi0 |
| 96 | <span class="o">[</span> 468.539101<span class="o">]</span> UBI: PEB size: 131072 bytes <span class="o">(</span>128 KiB<span class="o">)</span>, LEB size: 126976 bytes |
| 97 | <span class="o">[</span> 468.545937<span class="o">]</span> UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048 |
| 98 | <span class="o">[</span> 468.552783<span class="o">]</span> UBI: VID header offset: 2048 <span class="o">(</span>aligned 2048<span class="o">)</span>, data offset: 4096 |
| 99 | <span class="o">[</span> 468.559702<span class="o">]</span> UBI: good PEBs: 1912, bad PEBs: 0, corrupted PEBs: 0 |
| 100 | <span class="o">[</span> 468.565719<span class="o">]</span> UBI: user volume: 1, internal volumes: 1, max. volumes count: 128 |
| 101 | <span class="o">[</span> 468.572885<span class="o">]</span> UBI: max/mean erase counter: 4/2, WL threshold: 4096, image sequence number: 250308913 |
| 102 | <span class="o">[</span> 468.581878<span class="o">]</span> UBI: available PEBs: 0, total reserved PEBs: 1912, PEBs reserved <span class="k">for </span>bad PEB handling: 40 |
| 103 | <span class="o">[</span> 468.591156<span class="o">]</span> UBI: background thread <span class="s2">"ubi_bgt0d"</span> started, PID 4603 |
| 104 | UBI device number 0, total 1912 LEBs <span class="o">(</span>242778112 bytes, 231.5 MiB<span class="o">)</span>, available 0 LEBs <span class="o">(</span>0 bytes<span class="o">)</span>, LEB size 126976 bytes <span class="o">(</span>124.0 KiB<span class="o">)</span> |
| 105 | <span class="o">[</span> 468.666681<span class="o">]</span> UBIFS: background thread <span class="s2">"ubifs_bgt0_0"</span> started, PID 4621 |
| 106 | <span class="o">[</span> 468.686194<span class="o">]</span> UBIFS: start fixing up free space |
| 107 | <span class="o">[</span> 469.759179<span class="o">]</span> UBIFS: free space fixup <span class="nb">complete</span> |
| 108 | <span class="o">[</span> 469.782548<span class="o">]</span> UBIFS: mounted UBI device 0, volume 0, name <span class="s2">"rootfs"</span> |
| 109 | <span class="o">[</span> 469.788572<span class="o">]</span> UBIFS: LEB size: 126976 bytes <span class="o">(</span>124 KiB<span class="o">)</span>, min./max. I/O unit sizes: 2048 bytes/2048 bytes |
| 110 | <span class="o">[</span> 469.797786<span class="o">]</span> UBIFS: FS size: 235794432 bytes <span class="o">(</span>224 MiB, 1857 LEBs<span class="o">)</span>, journal size 9023488 bytes <span class="o">(</span>8 MiB, 72 LEBs<span class="o">)</span> |
| 111 | <span class="o">[</span> 469.807805<span class="o">]</span> UBIFS: reserved <span class="k">for </span>root: 0 bytes <span class="o">(</span>0 KiB<span class="o">)</span> |
| 112 | <span class="o">[</span> 469.812924<span class="o">]</span> UBIFS: media format: w4/r0 <span class="o">(</span>latest is w4/r0<span class="o">)</span>, UUID 58020D53-74F0-4A4C-83AA-B2FB6B08508F, small LPT model |
| 113 | <span class="o">[</span> 469.877200<span class="o">]</span> UBIFS: un-mount UBI device 0, volume 0 |
| 114 | <span class="o">[</span> 469.882090<span class="o">]</span> UBIFS: background thread <span class="s2">"ubifs_bgt0_0"</span> stops |
| 115 | sysupgrade successful |
| 116 | <span class="o">[</span> 469.904545<span class="o">]</span> imx2-wdt 20bc000.wdog: Device shutdown: Expect reboot! |
| 117 | <span class="o">[</span> 469.910875<span class="o">]</span> reboot: Restarting system |
| 118 | </pre></div><h2 id="ProductFamilyNotes">Product Family Notes</h2> |
| 119 | <h3 id="Ventana">Ventana</h3> |
| 120 | <p> |
| 121 | If wanting to use <tt>sysupgrade</tt> to upgrade from 14.08 to 16.02 a bug in sysupgrade will cause it to not preserve configuration settings. This bug is only triggered if moving from a single partition ubifs (14.08) to a dual-partition squashfs+ubifs overlay (in 16.02). |
| 122 | </p> |
| 123 | <p> |
| 124 | If you wish to upgrade from 14.08 to 16.02 'and' preserve configuration please do the following to fix your sysupgrade script on 14.08 prior to using it: |
| 125 | </p> |
| 126 | <div class="code"><pre>sed -i -e <span class="s2">"s~.*if ! mount -t ubifs /dev/\$ubivol /tmp/new_root; then.*~if ! mount -t ubifs ubi0:rootfs_data /tmp/new_root; then~"</span> /lib/upgrade/nand.sh |
| 127 | </pre></div><h3 id="Avila">Avila</h3> |
| 128 | <p> |
| 129 | If you are using sysupgrade on an Avila family product you must use the bootloader that sets the machine-type to the unique avila type of 526 instead of the IXDP425 machine-type of 245. For historical reasons the Avila boards are shipped with the bootloader that tells the kernel its an IXDP425 in which case only the 'openwrt-avila-zImage' which ignores the bootloader's machine-type will work and the generic <tt>openwrt-ixp4xx-generic-zImage</tt> which relies on a properly set machine-type will not work. Alternatively you could generate a <tt>sysupgrade</tt> image comprised of the <tt>openwrt-avila-zImage</tt>. You can find rb-526 <a class="ext-link" href="http://trac.gateworks.com/export/342/avila/redboot/images/rb-526.bin"><span class="icon"></span>here</a> |
| 130 | </p> |
| 131 | }}} |