Hi Hussain,
On 09/01/2016 13:30, hussain ali wrote:
> Hi Stephano,
> After some effort on building image with yocto, finally I decide to build
> swupdate binary manually!. I succeedded to cross compile it, but not all
> the components such as cfi and archive handler.
It is more difficult to build yourself as inside Yocto. Yocto takjes
care of dependencies and builds the required library. CFI and archive
require MTD headers and libarchive, that you have to build and put
yourself in your environment to succeed.
> At the moment swupdate runs and updates my nand
> flash partition, but it can not update uboot env correctly.
> The mtdparts of nand are as follows:
> /
This has nothing to do with swupdate. I think you cannot update U-Boot
environment at all, even with fw_setenv/fw_printenv provided by U-Boot.
> device nand0 <nand.0>, # parts = 12
> #: name size offset mask_flags
> 0: NAND.SPL 0x00020000 0x00000000 0
> 1: NAND.SPL.backup1 0x00020000 0x00020000 0
> 2: NAND.SPL.backup2 0x00020000 0x00040000 0
> 3: NAND.SPL.backup3 0x00020000 0x00060000 0
> 4: NAND.u-boot-spl-os 0x00040000 0x00080000 0
> 5: NAND.u-boot 0x00100000 0x000c0000 0
> 6: NAND.u-boot-env 0x00020000 0x001c0000 0
> 7: NAND.u-boot-env.backup1 0x00020000 0x001e0000 0
> 8: NAND.kernel-1 0x00800000 0x00200000 0
> 9: NAND.kernel-2 0x00800000 0x00a00000 0
> 10: NAND.rootfs-1 0x0c800000 0x01200000 0
> 11: NAND.rootfs-2 0x12600000 0x0da00000 0/
>
You miss to note which is the architecture you are using. From this
snapshot, I coul maybe wrongly think you have a TI SOC (4 copies of
SPL/MLO as TI specifies).
If this is true and you have an old SOC, do not forget that there is
hurdles between how to write into NAND. The SOC requires Hardware ECC to
load SPL, and this provides 1 bit correction. This is generally enough
for the first sector, not enough for the following ones. For this
reason, most boards using TI SOC switch to software ECC for all other
ranges outside SPL, and in U-Boot there is a command "nandecc" to allow
easy switching. By the way, it is important that the U-Boot environment
is managed by the NAND exactly as kernelr/rootfs, and I presume using
SW-ECC. The linux driver (if you have not patched or added support for
it) cannot switch between HW-ECC and SW-ECC.
>
> and the description file ( for updating rootfs-2):
>
> /software =
> {
> version = "0.1";
>
> hardware-compatibility = [ "revA" ];
>
> images: (
> /* single copy mode */
>
> {
> filename = "rootfs.ubifs";
> volume = "rootfs";
> }
>
> );
>
> uboot: (
> {
> name = "nandroot";
> value = "ubi0:rootfs rw ubi.mtd=11,512";
> }
> );
> }/
>
>
> When I update rootfs-2, from os running on rootfs-1, logs are as follows:
> (despite of some errors, updating is done and uboot env is updated)
>
I want to remark here that you are using the wrong setup if you want to
run as double copy. In this way, you need two different .swu if you
update rootfs-1 or rootfs-2, and thet is completely weird. Check for
"selections" inside documentation, you can have a single .swu without
having to know if rootfs-1 or rootfs-2 is updated.
> /Registered handlers:
ecc unrecoverable error: this comes from the kernel, that is from the
NAND driver. It has nothing to do with swupdate. Before going on, you
need to have fw_printenv/fw_setenv working. If this does not work,
swupdate cannot set the environment.
Check before: I am supposing the ECC setup is different between U-Boot
and kernel.
> Warning: Bad CRC, using default environment
> Software updated successfully
> Please reboot the device to start the new software
> [NOTIFY] : SWUPDATE successful !/
>
>
> But when I update rootfs-1 from OS running on rootfs-2, logs are as
> follows ( in this case the rootfs is updated but uboot env not)
> .
> .
> .
> /[ 435.994249] UBI: default fastmap pool size: 80
> [NOTIFY] : SWUPDATE successful ! /
>
> #
>
> there is another point.
> The fw_printenv tool could not show uboot env. The error messages are
> as follows:
>
> [/ 185.460068] ecc unrecoverable error
> [ 185.463906] ecc unrecoverable error
> [ 185.467628] ecc unrecoverable error
> [ 185.471337] ecc unrecoverable error
> [ 185.475309] ecc unrecoverable error
> [ 185.479026] ecc unrecoverable error
> [ 185.482736] ecc unrecoverable error
> [ 185.486453] ecc unrecoverable error
>
Exactly - you have to fix this, it has nothing to do with swupdate.
Until fw_printenv does not work, you have no chances to update the
environment from linux.
> Warning: Bad CRC, using default environment
> bootcmd=bootp; setenv bootargs root=/dev/nfs
> nfsroot=${serverip}:${rootpath}
> ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
> bootdelay=5
> baudrate=115200
>
>
> /
> But as soon as I update volume with swupdate, it works fine!!
The environment is shared between U-Boot and linux, volumes are updated
only by linux, I presume. By the way, you can access the volumes from
U-Boot, too (see documentation in U-Boot). Try to access the volumes
from the U-Boot's console, I guess you will get ECC (error -74) errors, too.
>
> This is content of the fw_env.config file:
>
> //dev/mtd6 0x0 0x20000 0x20000/
>
This is also wrong. If you have setup twice the environment in U-Boot
(I see NAND.u-boot-env.backup1), you have to set it as well. And is it
the environment's size really 0x20000 ? Check in your U-Boot config,
they *must* match.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone:
+49-8142-66989-53 Fax:
+49-8142-66989-80 Email:
sba...@denx.de
=====================================================================