-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Malte.

> There's no reason why the unified format couldn't be a tgz (or some other, 
> maybe uncompressed, format which carries a magic number) with some meta 
> informations :)  Daniel's proposal sounded quite complicated to me.

So I finally took some time to try the .tgz approach on a classic
Fonera. As it turned out, the space in /tmp is not enough to store both
the tgz and the unpacked images at the same time.

To solve that I basically "invented" some simple image format with a two
byte magic value in the beginning, followed by a 8 byte hex sequence
descriping the length of the kernel image, a 16 byte space-padded string
containing the name of the kernel mtd partition, a 8 byte hex-string
containing the length of the rootfs image and a space-padded 16 byte
string containing the name of the rootfs partition. the following 65486
bytes are space-padded to make the initial "header" stuff 64KB aligned.

This initial 64KB block is concatenated together with the kernel lzma
image and the rootfs image. The reason for doing such an awkward format
is, that I wanted to be able to extract the sub-images with busybox' dd
utility.

Second step was to implement a platform.sh backend for sysupgrade which
uses "dd" to extract name and length information from the first 64KB of
the combined image. After determining the length information, "dd" is
used again to extract the sub-images from the correct offsets in the
combined image. The output is piped to the mtd utility.

The configuration keeping is implemented with mtd's -j option when
writing the rootfs. So far it seemed to work but I have only tested
refleshing with the same images, need to try images of different size later.


I've attached my platform.sh script and another script to generate a
suitable combined image. I have no idea whether they will work with some
other device than the Fonera, maybe someone want to try this out.


Regards, JoW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko9LMMACgkQdputYINPTPOcCgCfWeLtMYS9VhMmb3bacXaJPzPn
9IsAn190+7UVtxyoOpK2+uSF94lVXJB1
=K16A
-----END PGP SIGNATURE-----

Attachment: mkimg.sh
Description: Bourne shell script

Attachment: platform.sh
Description: Bourne shell script

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
  • ... Daniel Dickinson <crazycsh...@gmail.com> (by way of Daniel Dickinson
    • ... Daniel Dickinson
      • ... RHS Linux User
      • ... Malte S. Stretz
        • ... Jo-Philipp Wich
          • ... Malte S. Stretz
            • ... Felix Fietkau
              • ... Daniel Dickinson
            • ... Jo-Philipp Wich
              • ... Frédéric Moulins
                • ... Jo-Philipp Wich
                • ... Frédéric Moulins
        • ... Peter Korsgaard
          • ... Malte S. Stretz

Reply via email to