# Generate Booting SD Card for VisionFive 2 ## VFAT Image Target: `starfive-visionfive2-vfat.part` Step 1. Enter the command ```! dd if=/dev/zero of=starfive-visionfive2-vfat.part bs=512 count=131072 mkfs.vfat starfive-visionfive2-vfat.part ``` ## SD Card Image Target: `images/sdcard.img` Requirements: ```! . ├── input/ │ ├── starfive-visionfive2-vfat.part │ ├── u-boot-spl.bin.normal.out │ └── visionfive2_fw_payload.img ├── genimage └── vf2-genimage.cfg ``` Step 1. Build `genimage` from the [source](https://github.com/pengutronix/genimage/releases) Step 2. Create `vf2-genimage.cfg` ```! image sdcard.img { hdimage { gpt = true } partition spl { image = "u-boot-spl.bin.normal.out" partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 offset = 2M size = 2M } partition uboot { image = "visionfive2_fw_payload.img" partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47 offset = 4M size = 4M } partition image { partition-type-uuid = EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 image = "starfive-visionfive2-vfat.part" offset = 8M size = 64M } } ``` Step 3. Enter the command ```! ./genimage --config vf2-genimage.cfg ``` ## Flash the Image and Copy Files Step 1. Flash the image to an SD card ```! sudo dd if=sdcard.img of=/dev/sda ``` Step 2. Copy the necessary files to the SD card 1. FIT image: `kernel.fit` 2. Configuration file: `vf2_uEnv.txt` `vf2_uEnv.txt` ```! boot2=fatload mmc 1:3 ${loadaddr} kernel.fit; bootm ${loadaddr}; ```