Hello, On Sat, 20 Jun 2009 20:39:05 +0200 Jo-Philipp Wich <[email protected]> wrote:
> -----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. It works for me on a Nanostation5. I attach again the mkimg.sh script with the possibility to override partition names. Since the kernel partition name is "kernel" for Nanostations, I used : KERNEL_PART=kernel ./mkimg.sh openwrt-atheros-vmlinux.lzma openwrt-atheros-root.squashfs I tested it also with an image with different rootfs size, it seems ok. I think it will work with flash partitions as long as the new kernel is not one block bigger than the old one. If one wants to flash a bigger kernel he has to get rid of the dependency on the bootloader partition table information or be able to edit it (like Ubiquity appears to do with fwupdate). I think Felix's plan is welcome :) Thank you for the solution. fred
mkimg.sh
Description: application/shellscript
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
