Build files for SD card

This commit is contained in:
Joris van Rantwijk 2024-01-07 01:11:46 +01:00
parent 737bd78d2e
commit 32089fab15
3 changed files with 62 additions and 0 deletions

24
os/21_build_bootimg.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
. script_env
mkdir -p boot_img
cp fsbl/fsbl.elf "$BOOTIMG_DIR"
cp "$UBOOT_DIR/u-boot.elf" "$BOOTIMG_DIR"
rm -f "$BOOTIMG_DIR/boot.bin"
cat >"$BOOTIMG_DIR/boot.bif" <<EOF
the_ROM_image:
{
[bootloader]fsbl.elf
u-boot.elf
}
EOF
source /opt/Xilinx/Vivado/2020.2/settings64.sh
( cd "$BOOTIMG_DIR" ; bootgen -arch zynq -image boot.bif -o boot.bin )

30
os/22_prepare_sdcard.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -e
. script_env
MKIMAGE="$UBOOT_DIR/tools/mkimage"
if [ ! -x "$MKIMAGE" ]; then
echo "ERROR: Missing $MKIMAGE" >&2
echo " Build U-Boot to prepare the mkimage tool" >&2
fi
mkdir -p "$SDCARD_DIR"
# Copy Xilinx boot image (FSBL and U-Boot)
cp -a "$BOOTIMG_DIR/boot.bin" "$SDCARD_DIR"
# Wrap Linux kernel in U-Boot image file
$MKIMAGE -A arm -O linux -C none -T kernel -a 0x8000 -e 0x8000 -n Linux -d "$LINUX_DIR/arch/arm/boot/zImage" "$SDCARD_DIR/uImage"
# Copy device tree
cp -a devicetree/devicetree.dtb "$SDCARD_DIR"
# Copy root fs image
cp -a "$BUILDROOT_DIR/output/images/rootfs.cpio.uboot" "$SDCARD_DIR"
# Wrap U-Boot script in image file
$MKIMAGE -A arm -T script -d config/uboot_script.txt "$SDCARD_DIR/boot.scr"

View File

@ -0,0 +1,8 @@
echo boot.scr: Booting Linux
devicetree_load_address=0x1f00000
kernel_load_address=0x2000000
ramdisk_load_address=0x3100000
load mmc 0 ${kernel_load_address} uImage
load mmc 0 ${devicetree_load_address} devicetree.dtb
load mmc 0 ${ramdisk_load_address} rootfs.cpio.uboot
bootm ${kernel_load_address} ${ramdisk_load_address} ${devicetree_load_address}