To include the auto-mounting scripts (mount_sda1_usb.sh & mount_emmc.sh) for the MiniZed USB and eMMC (found in Booting_MiniZed_Using_QSPI_and_eMMC_2017_2_01.pdf) but using PetaLinux 2019.2 with the minized_petalinux reference design in the Avnet HDL Git repo (https://github.com/Avnet/hdl/tree/2019.2), modifications must be made:
First, from within your PetaLinux project, create an app template using the command: petalinux-create -t apps --name configminized --enable
The app template will be located at: <PL_PROJECT>/project-spec/meta-user/recipes-apps
Then create the BitBake file below located at: <PL_PROJECT>/project-spec/meta-user/recipes-apps/configminized/configminized.bb:
SUMMARY = "Minized Configuration Scripts"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://mount_sda1_usb.sh \
file://mount_emmc.sh \
file://load_images.sh"
S = "${WORKDIR}"
do_install() {
install -d ${D}${bindir}
install -m 0755 ${S}/mount_sda1_usb.sh ${D}${bindir}
install -m 0755 ${S}/mount_emmc.sh ${D}${bindir}
install -m 0755 ${S}/load_images.sh ${D}${bindir}
}
Where the auto-mounting scripts (found in the accompanying software for Booting_MiniZed_Using_QSPI_and_eMMC_2017_2_01.pdf on the Avnet website) are located at: <PL_PROJECT>/project-spec/meta-user/recipes-apps/configminized/files
Note that since these are Bourne scripts (echo $SHELL on the MiniZed), we don't need a Makefile since we're not actually compiling anything (we're just including the scripts in the rootfs during the PetaLinux build). After creating the above BitBake recipe, and copying the auto-mount scripts, double-check that the scripts will be included in the PetaLinux build: petalinux-config -c rootfs and navigate to Apps --> configminized (obviously make sure it's selected). Then save and exit the configuration manager.
From this point, you should be able to build PetaLinux: petalinux-build, package the build images (see: Must use petalinux-package command in newest pull of 2019.2 branch in github.com/Avnet/hdl repo for MiniZed ), then flash the eMMC (image.ub) and QSPI (BOOT.bin), and the mount scripts will be located at /usr/bin on your PetaLinux install on the MiniZed!
A few more notes on including custom scripts in the rootfs: If the scripts are modified, it's necessary to clean and re-build the project for the modified scripts to be included in the new image. This can be done with the command: petalinux-build -x mrproper -f, Then re-build the entire project and re-package the eMMC (image.ub) and QSPI (BOOT.bin) using a command like this: petalinux-package --boot --fsbl <PL_PROJECT>/images/linux/zynq_fsbl.elf --fpga <PATH_TO_FPGA_BITFILE>/*.bit --uboot --force. After this, your modified scripts should be included in the build in /usr/bin. It also seems that the clean/build commands must be issued at the root of the PetaLinux project: <PL_PROJECT>.
I also wrote some code that mounts the USB and eMMC and writes the boot images. There are three files that are included in the rootfs:
1) load_images.sh: Top-level file that mounts the eMMC and USB, and flashes the QSPI and copies the image.ub to the eMMC
2) mount_emmc.sh: Mounts the eMMC device
3) mount_sda1_usb.sh: Mounts the USB device
Hopefully this will all help someone else get a handle on the MiniZed with PetaLinux 2019.2. Also, please feel free to leave comments on how this stuff can be done differently or more efficiently. -Cody