> On Feb 25, 2018, at 15:34, Giordon Stark <kra...@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! ;) -- _______________________________________________ meta-xilinx mailing list meta-xilinx@yoctoproject.org https://lists.yoctoproject.org/listinfo/meta-xilinx