On Wed, Nov 10, 2010 at 09:45:36PM -0500, Scott Nicholas wrote:
> I want my target to work on firstboot. I look how other targets will
> make image with 'deadc0de' at start of what will become jffs. This
> means I have to change the image CRC32 so that when it gets formatted,
> this part is not checked by u-boot next boot...
> 
> The bootloader is old U-Boot. I cannot get crc32 calculated
> correctly.. I need to re-calculate the header and data CRC32, but
> we'll start with header since it's short and hopefully once I figure
> it out the data one will follow.

> Any ideas?? The first seed of '0' seems correct too from u-boot
> mkimage sources. :( pleaseeee i've spent too long on this 1 bug. maybe
> other targets even do it different to ensure old parts of flash are
> erased? i still would like to resize image in flash on first boot.
> would allow squashfs replace without kernel. As now, kernel+squashfs
> are at the mercy of this crc.
> 
> Maybe it's something simple I'm overlooking...

My U-Boot bootm command:

Marvell>> ? bootm
bootm [addr [arg ...]]
  - boot application image stored in memory
    passing arguments 'arg ...'; when booting a Linux kernel,
    'arg' can be the address of an initrd image

This command calculates checksum for both kernel and ramdisk (kernel
located at addr1 and ramdisk located at addr2) and then boots kernel:

Marvell>> bootm addr1 addr2

This command calculates checksum only for kernel (kernel located at
addr1) and then boots kernel:

Marvell>> bootm addr1

Are you trying to make checksum for kernel and for ramdisk? OpenWrt does
not use ramdisk this way. If you compile your image as ramdisk you get
just one file.

I use this command:

Marvell>> bootm addr1

to boot OpenWrt from U-Boot. It only calculates checksum for kernel and
not for squashfs mtd partition...


You should use mkimage tool to calculate kernel checksum. Here is example for 
target XYZ:

define Image/BuildKernel
 # XYZ mach id 1542 (0x606) - you will have different mach id !!!
        echo -en "\x06\x1c\xa0\xe3\x06\x10\x81\xe3" > $(KDIR)/XYZ-zImage
        cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/XYZ-zImage
        $(STAGING_DIR_HOST)/bin/mkimage -A arm -O linux -T kernel \
        -C none -a 0x00008000 -e 0x00008000 -n 'Linux-$(LINUX_VERSION)' \
        -d $(KDIR)/XYZ-zImage $(KDIR)/XYZ-uImage
        cp $(KDIR)/XYZ-uImage $(BIN_DIR)/openwrt-XYZ-uImage
endef

Hope this helps...

Regards,
Luka

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to