[meta-xilinx] Cannot load VFS from SDCard partitioned using wic
Giordon Stark
kratsg at gmail.com
Mon Feb 26 06:08:55 PST 2018
Hi all,
Thanks for all the answers.
@Nathan
> Its mounted read only. Check the card, and the preceding log (there
might be information regarding why it was mounted read only).
Which preceding log? I double-checked this on the Linux VM using fdisk and
nothing seemed off. I followed your suggestion to add the 'ro' flag instead
(sdroot0 from zcu102-zynqmp recipe uses rw). We would like to use 'rw' in
the future, but switch to 'ro' makes this work nicely now. This is
obviously a workaround, but not a permanent solution.
@Richard,
If the wic image isn't a problem, it sounds like it's related to the issue
you posted where we need to add a flag to the device tree to disable this
check -- even though we're not using the WP pin in our design? I will check
this.
@Jean-Francois
We've seen this finnickiness with the Zynq-700 series - so I'm glad I'm not
the only one!
> As for manually copying files on the wic generated sdcard image, you
shouldn't have to do this.
We do this right now for two somewhat convoluted(?) reasons.
- we are using the FSBL method, which, unless I'm using meta-xilinx-tools
(part of meta-xilinx now), I need to use the Vivado SDK to generate the
FSBL. In any case, we have a custom power sequence interfacing with an ATCA
shelf manager that requires extra logic in the FSBL right now [injected by
engineers at CERN] so I'm not ready to try and get this portion automated
-- I need to copy the BOOT.bin and system.dtb into the SD card -- but this
isn't too hard since the files exist and the BOOT partition is the active
one as FAT 32, so I can just copy it
- we do not have a Linux machine available capable of running bitbake
(mostly because Xilinx does not work on CC7/SLC6 which are the only ones we
have available) and just a windows.
Your recipe looks great and I'll need to look at this more to understand it
better... Still learning bitbake!
Giordon
On Mon, Feb 26, 2018 at 7:26 AM Jean-Francois Dagenais <
jeff.dagenais at gmail.com> wrote:
>
>
> > On Feb 25, 2018, at 15:34, Giordon Stark <kratsg at gmail.com> wrote:
> >
> > I used the wic file created to flash an SD card using dd. I also copied
> system.dtb and created a BOOT.bin to copy into the first (boot) partition.
> However, the SD card seems readable, and shows the right partitions.. but I
> still cannot get the kernel to load the FS from it?
> >
>
> Hi Giordon,
>
> In my experience on our board, the SD is quite finicky. For me it boiled
> down to certain SD cards that will work and others that don't. Of course
> there may be underlying issue, but we have not pinpointed them just yet. As
> a workaround, we simply avoid the "bad" SD cards. Maybe try lower speed
> cards.
>
> As for manually copying files on the wic generated sdcard image, you
> shouldn't have to do this.
>
> Here's a wic file I created for this purpose (there's another pretty
> similar in poky, we use this because we need extra space in the first
> partition) :
>
> $ cat ./scripts/lib/wic/canned-wks/zynq-wic-sdcard.wks
> # short-description: Create SD card image with a boot partition
> # long-description: Creates a partitioned SD card image. Boot files
> # are located in the first vfat partition.
>
> # !! the partition alignment must match that found in test files
> # we add 6MB to the boot partition to allow devs to copy a fpga.bin for
> example
> part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat
> --label ZBOOT --active --align 4096 --extra-space 6
> part / --source rootfs --ondisk mmcblk --fstype=ext4 --label rootfs
> --align 4096 --extra-space
>
>
> Of course, I use my patch for boot.bin as a normal recipe:
> https://www.mail-archive.com/meta-xilinx@yoctoproject.org/msg02179.html
>
> Here's my slightly different version of the file:
> SUMMARY = "Generates boot.bin using bootgen tool"
> DESCRIPTION = "Manages task dependencies and creation of boot.bin. Use the
> \
> BIF_PARTITION_xyz global variables and flags to determine what makes it
> into \
> the image."
>
> LICENSE = "BSD"
>
> include machine-xilinx-${SOC_FAMILY}.inc
>
> inherit xsct-tc deploy
>
> PROVIDES = "virtual/boot-bin"
>
> PACKAGE_ARCH = "${MACHINE_ARCH}"
>
> BIF_FILE_PATH ?= "${B}/bootgen.bif"
> BIF_FILE_PATH = "${WORKDIR}/bootgen.bif"
>
> # this recipe is almost like an image recipe, taken from image.bbclass:
> inherit nopackages
> deltask do_fetch
> deltask do_unpack
> deltask do_patch
> do_install[noexec] = "1"
>
> def create_bif(config, attrflags, attrimage, common_attr, biffd, d):
> import re, os
> for cfg in config:
> if cfg not in attrflags and common_attr:
> error_msg = "%s: invalid ATTRIBUTE" % (cfg)
> bb.error("BIF attribute Error: %s " % (error_msg))
> else:
> if common_attr:
> cfgval = attrflags[cfg].split(',')
> cfgstr = "\t [%s] %s\n" % (cfg,', '.join(cfgval))
> else:
> if cfg not in attrimage:
> error_msg = "%s: invalid or missing elf or image" %
> (cfg)
> bb.error("BIF atrribute Error: %s " % (error_msg))
> imagestr = d.expand(attrimage[cfg])
> if os.stat(imagestr).st_size == 0:
> bb.warn("Empty file %s, excluding from bif file"
> %(imagestr))
> continue
> if cfg in attrflags:
> cfgval = attrflags[cfg].split(',')
> cfgstr = "\t [%s] %s\n" % (', '.join(cfgval), imagestr)
> else:
> cfgstr = "\t %s\n" % (imagestr)
> biffd.write(cfgstr)
>
> return
>
> python do_configure() {
>
> fp = d.getVar("BIF_FILE_PATH", True)
> biffd = open(fp, 'w')
> biffd.write("the_ROM_image:\n")
> biffd.write("{\n")
>
> bifattr = (d.getVar("BIF_COMMON_ATTR", True) or "").split()
> if bifattr:
> attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {}
> create_bif(bifattr, attrflags,'', 1, biffd, d)
>
> bifpartition = (d.getVar("BIF_PARTITION_ATTR", True) or "").split()
> if bifpartition:
> attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {}
> attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {}
> create_bif(bifpartition, attrflags, attrimage, 0, biffd, d)
>
> biffd.write("}")
> biffd.close()
> }
>
> do_configure[vardeps] += "BIF_PARTITION_ATTR BIF_PARTITION_IMAGE
> BIF_COMMON_ATTR"
> do_configure[depends] += "${@get_bootbin_depends(d)}"
>
> def get_bootbin_depends(d):
> bootbindeps = ""
> bifpartition = (d.getVar("BIF_PARTITION_ATTR", True) or "").split()
> attrdepends = d.getVarFlags("BIF_PARTITION_DEPENDS") or {}
> for cfg in bifpartition:
> if cfg in attrdepends:
> bootbindeps = bootbindeps + " " + attrdepends[cfg] +
> ":do_deploy"
>
> return bootbindeps
>
>
> do_compile() {
> cd ${WORKDIR}
> rm -f ${B}/BOOT.bin
> bootgen -image ${BIF_FILE_PATH} -arch ${SOC_FAMILY} -w -o ${B}/BOOT.bin
> if [ ! -e ${B}/BOOT.bin ]; then
> bbfatal "bootgen failed. See log"
> fi
> }
>
> BOOTBIN_BASE_NAME ?= "BOOT-${MACHINE}-${DATETIME}"
> BOOTBIN_BASE_NAME[vardepsexclude] = "DATETIME"
>
> do_deploy() {
> install -d ${DEPLOYDIR}
> install -m 0644 ${B}/BOOT.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}.bin
> ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/BOOT-${MACHINE}.bin
> }
> addtask do_deploy before do_build after do_compile
> -----
>
>
>
> And to tie it all up, in my machine.conf:
> [...]
> IMAGE_CLASSES += "zynq-wic-sdcard"
> IMAGE_FSTYPES = "wic.lz4"
> INITRAMFS_FSTYPES = "cpio.gz.u-boot"
>
> IMAGE_BOOT_FILES = " \
> BOOT-${MACHINE}.bin;BOOT.bin \
> Image \
> Image-${MACHINE}.dtb \
> ${INITRD_IMAGE}.cpio.gz.u-boot;initrd.cpio.gz.u-boot \
> "
>
> [...]
> -------
>
> And here's that zynq-wic-sdcard.bbclass:
> WKS_FILES = "zynq-wic-sdcard.wks"
>
> do_image_wic[depends] += "\
> xilinx-bootbin:do_deploy \
> dosfstools-native:do_populate_sysroot \
> mtools-native:do_populate_sysroot \
> e2fsprogs-native:do_populate_sysroot \
> "
>
> python () {
> initRdImage = d.getVar("INITRD_IMAGE", True)
> if initRdImage:
> d.appendVarFlag("do_image_wic", "depends", " " +
> initRdImage + ":do_image_complete")
> }
>
> IMAGE_CMD_wic_append() {
> cd ${DEPLOY_DIR_IMAGE}
>
> ln -sfv ${IMAGE_LINK_NAME}.wic.lz4 ${IMAGE_LINK_NAME}.sdcard.lz4
> }
> ---------
>
>
> This will make your sdcard (or eMMC) image completely turnkey. Just raw
> copy it to SD and boot! I'm sure there are other/better ways to do this. We
> have been riding this for a year without a hitch.
>
> Hope this helps a bit! ;)
--
Giordon Stark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-xilinx/attachments/20180226/496d9b1b/attachment-0001.html>
More information about the meta-xilinx
mailing list