[meta-xilinx] u-boot/UBIFS
Joe Hershberger
joe.hershberger at gmail.com
Wed Sep 23 07:56:29 PDT 2015
Hi Ed,
On Tue, Sep 22, 2015 at 7:19 PM, Edward Wingate <edwingate8 at gmail.com> wrote:
> On Tue, Sep 22, 2015 at 1:12 PM, Joe Hershberger
> <joe.hershberger at gmail.com> wrote:
>> Bummer. Looks like you'll need to patch it a bit to use SF. Prolly
>> there is something complete in Linux that you can port. Or try out
>> that experimental series and give feedback on your experience.
>>
>
> I'm switched to use the bleeding edge of u-boot-xlnx-dev since the
> experimental driver was merged there. I enabled it in u-boot and am
> having mixed success.
>
> I have 3 flash partitions:
> mtd0: fsbl-uboot (8M) - raw flash with FSBL, bitstream and uboot.elf
> mtd1: uboot-env-itb (20M) - contains 3 UBIFS volumes (uboot-env1,
> uboot-env2, itb)
> mtd2: rootfs (100M) - contains 1 UBIFS volume
>
> Should u-boot be able to mount UBIFS volumes that were created using
> Linux ubi tools? I created and populated all my volumes in Linux
> using ubiformat, ubiattach, ubimkvol, ubiupdatevol. I copy my kernel
> and DTB over to the appropriate volume. Everything looks good in
> Linux.
Yes, you should be able to create them from Linux or U-Boot.
> In u-boot, mtdparts gives (I wasn't able to get this far before):
> device nor0 <spi32764.0>, # parts = 3
> #: name size offset mask_flags
> 0: fsbl-uboot 0x00800000 0x00000000 1
> 1: uboot-env-itb 0x01400000 0x00800000 0
> 2: rootfs 0x06400000 0x01c00000 0
>
> active partition: nor0,0 - (fsbl-uboot) 0x00800000 @ 0x00000000
>
> defaults:
> mtdids : nor0=spi32764.0
> mtdparts: mtdparts=spi32764.0:8M(fsbl-uboot)ro,20M(uboot-env-itb),100M(rootfs)
Yeah, Looks fine. One thing to note here, this is not actually doing
anything with hardware or the driver. It is just parsing your mtdids
and mtdparts variables.
I'm surprised that you are using "nor0". I wouldn't be surprised if
you are getting a null pointer or garbage dereference since you don't
have a driver that is using the nor subsystem, right?
Chances are you need to add a spi flash type to mtdparts, reference
that, then hook it to the serial flash subsystem.
> MTDPARTS looks correct here. But when I go to select a partition in
> u-boot using "ubi part", I get data abort error and the CPU resets:
>
> zynq-uboot> ubi part uboot-env-itb
> UBI: attaching mtd1 to ubi0
> data abort
> pc : [<1ff45e08>] lr : [<1ff470d0>]
> reloc pc : [<04028e08>] lr : [<0402a0d0>]
> sp : 1f2f9570 ip : ea005edb fp : 00000004
> r10: 00000000 r9 : 1f2fcef8 r8 : 00000000
> r7 : 00000000 r6 : 00800000 r5 : 00000000 r4 : 00000040
> r3 : 1f35f960 r2 : 00000040 r1 : 00800000 r0 : 1ff3a188
> Flags: nzcv IRQs off FIQs off Mode SVC_32
> Resetting CPU ...
>
> Do I need to specify an offset in the ubi part command?
I think that's only for if you customized it when creating the UBI
format in the partition, but I'm not sure.
> I created the volumes like so in Linux:
> ubiformat -y /dev/mtd1
> ubiformat -y /dev/mtd2
>
> ubiattach -p /dev/mtd1
> ubimkvol /dev/ubi0 -N uboot-env1 -s 4MiB
> ubimkvol /dev/ubi0 -N uboot-env2 -s 4MiB
> ubimkvol /dev/ubi0 -N itb -m
>
> ubiattach -p /dev/mtd2
> ubimkvol /dev/ubi1 -N rootfs -m
> ubiupdatevol /dev/ubi1_0 rootfs.ubifs.img
>
> mount -t ubifs ubi0:itb /mnt/itb
> Copy kernel/DTB to /mnt/itb
>
> mount -t ubifs ubi1:rootfs /mnt/rootfs
> The rootfs looks good in /mnt/rootfs
Looks good to me.
> I would expect u-boot to be able to access the kernel/DTB that I
> copied using Linux, but u-boot crashes when just trying to select a
> partition. Is there some kind of alignment issue I'm not taking care
> of here?
See above. It certainly should be able to do all of that, but you
have to get support for your flash subsystem in MTD first.
> I suppose I can try erasing flash and creating everything using
> u-boot, but I don't have good way to copy over the kernel/DTB to the
> UBI volume when doing things from u-boot serial terminal.
You could, but I don't think that should be necessary.
If you do decide to do that, then you need to create the UBIFS first
on a Linux machine since U-Boot is read-only when accessing UBIFS.
U-Boot can read and write UBI volumes, though, so that's why the
U-Boot env can live there.
So basically you would mkfs.ubifs and use the U-Boot's "ubi write"
command, but I'll bet you won't even be able to get that far because
the ubi part command will crash.
Cheers,
-Joe
More information about the meta-xilinx
mailing list