Changes between Version 1 and Version 2 of OpenWrt/sysupgrade


Ignore:
Timestamp:
06/18/2018 04:56:13 PM (6 years ago)
Author:
Tim Harvey
Comment:

restore wiki markup from html

Legend:

Unmodified
Added
Removed
Modified
  • OpenWrt/sysupgrade

    v1 v2  
    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/&lt;target&gt;/*-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>
     1[[PageOutline]]
     2
     3
     4= OpenWrt sysupgrade support
     5{{{sysupgrade}}} is an OpenWrt invention that allows the rootfs to be updated to another firmware.
     6
     7The {{{sysupgrade}}} script for the Gateworks products provides:
     8* the {{{/sbin/sysupgrade}}} script on the target will flash the kernel/rootfs contained in a specified image
     9* the image contents will be validated via an md5 checksum in the image header
     10* the kernel and rootfs will be updated (squashfs+jffs2, jffs2 supported, or ubi)
     11* standard system config files will be retained (saved, then restored) (unless the {{{-n}}} cmdline option is provided)
     12* the {{{-c}}} command-line argument will save all files on the overlay filesystem
     13
     14A standard make in the OpenWrt buildroot tree will create a sysupgrade image for your target by default named:
     15* avila/cambria/laguna: bin/<target>/*-sysupgrade.bin.
     16* ventana: bin/imx6/*-squashfs-nand_*.ubi
     17
     18You can find more information about sysupgrade on the OpenWrt wiki [http://wiki.openwrt.org/doc/howto/generic.sysupgrade ​here]
     19
     20
     21== Sysupgrade via command line
     22
    5523Examples:
    56 </p>
    57 <ul><li>Upgrade a 256MB flash device:
    58 <div class="code"><pre><span class="nb">cd</span> /tmp
     24* Upgrade a 256MB flash device:
     25{{{#!bash
     26cd /tmp
    5927wget http://192.168.1.175/openwrt/imx6/gateworks-imx6-ventana-squashfs-nand_normal.ubi
    6028sysupgrade -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>
     29}}}
     30* from a URL:
     31{{{#!bash
     32sysupgrade -v http://192.168.1.175/openwrt/imx6/gateworks-imx6-ventana-squashfs-nand_normal.ubi
     33}}}
     34
     35== Using LuCI Web-Admin
     36To perform a {{{sysupgrade}}} using the OpenWrt WebGUI, please use an ubi file, such as ​{{{ventana-owrt-16.02-normal.ubi}}}
     37
     38Go to the top System tab, then the lower tab should be selected as Backup / Flash Firmware.
     39
    7440Under '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>
     41
    8042In 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
     43{{{#!bash
     44Switching to ramdisk...
     45[  447.449487] UBIFS: background thread "ubifs_bgt0_0" stops
     46[  447.519016] UBIFS: un-mount UBI device 0, volume 0
     47[  447.585743] UBI: detaching mtd2 from ubi0
     48[  447.591108] UBI: mtd2 is detached from ubi0
     49ubiformat: mtd2 (nand), size 250609664 bytes (239.0 MiB), 1912 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
     50libscan: scanning eraseblock 1911 -- 100 % complete
     51ubiformat: 1912 eraseblocks have valid erase counter, mean value is 1
     52ubiformat: flashing eraseblock 154 -- 100 % complete
     53ubiformat: formatting eraseblo[  467.802383] UBI: attaching mtd2 to ubi0
     54ubiformat: formatting eraseblock 1911 -- 100 % complete
     55[  468.505882] UBI: scanning is finished
     56[  468.525333] UBI: volume 0 ("rootfs") re-sized from 153 to 1868 LEBs
     57[  468.532619] UBI: attached mtd2 (name "rootfs", size 239 MiB) to ubi0
     58[  468.539101] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
     59[  468.545937] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
     60[  468.552783] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
     61[  468.559702] UBI: good PEBs: 1912, bad PEBs: 0, corrupted PEBs: 0
     62[  468.565719] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
     63[  468.572885] UBI: max/mean erase counter: 4/2, WL threshold: 4096, image sequence number: 250308913
     64[  468.581878] UBI: available PEBs: 0, total reserved PEBs: 1912, PEBs reserved for bad PEB handling: 40
     65[  468.591156] UBI: background thread "ubi_bgt0d" started, PID 4603
     66UBI device number 0, total 1912 LEBs (242778112 bytes, 231.5 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
     67[  468.666681] UBIFS: background thread "ubifs_bgt0_0" started, PID 4621
     68[  468.686194] UBIFS: start fixing up free space
     69[  469.759179] UBIFS: free space fixup complete
     70[  469.782548] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
     71[  469.788572] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
     72[  469.797786] UBIFS: FS size: 235794432 bytes (224 MiB, 1857 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
     73[  469.807805] UBIFS: reserved for root: 0 bytes (0 KiB)
     74[  469.812924] UBIFS: media format: w4/r0 (latest is w4/r0), UUID 58020D53-74F0-4A4C-83AA-B2FB6B08508F, small LPT model
     75[  469.877200] UBIFS: un-mount UBI device 0, volume 0
     76[  469.882090] UBIFS: background thread "ubifs_bgt0_0" stops
    11577sysupgrade 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>
     78[  469.904545] imx2-wdt 20bc000.wdog: Device shutdown: Expect reboot!
     79[  469.910875] reboot: Restarting system
     80}}}
     81
     82
     83== Product Family Notes
     84
     85=== Ventana
     86If wanting to use {{{sysupgrade}}} 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).
     87
    12488If 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>
     89{{{#!bash
     90sed -i -e "s~.*if ! mount -t ubifs /dev/\$ubivol /tmp/new_root; then.*~if ! mount -t ubifs ubi0:rootfs_data /tmp/new_root; then~" /lib/upgrade/nand.sh
    13191}}}
     92
     93=== Avila
     94If 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 {{{openwrt-ixp4xx-generic-zImage}}} which relies on a properly set machine-type will not work. Alternatively you could generate a sysupgrade image comprised of the {{{openwrt-avila-zImage}}}. You can find rb-526 [http://svn.gateworks.com/avila/redboot/images/rb-526.bin here]