Commit 3053b5f9 authored by Jens Korinth's avatar Jens Korinth
Browse files

Implement basic script to produce boot images

* it is an incredibly annoying process I'd really like to automate
* first draft seems to work ok, but there is a problem with the devicetrees
* need to continue work next week
parent d764cc24
Scripts to generate BOOT.BIN images for PyNQ, ZedBoard, ZC706
=============================================================
Automates the following steps
* download specific revision of u-boot-xlnx
* build it
* download specific revision of linux-xlnx kernel
* build uImage
* create simple Vivado project with default initialization and constraints
* export .hdf file
* use hsi to build FSBL
* use bootgen to generate boot image BOOT.BIN
CONFIG_SYSVIPC=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CGROUPS=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL_SYSCALL=y
# CONFIG_BUG is not set
CONFIG_EMBEDDED=y
CONFIG_PERF_EVENTS=y
CONFIG_SLAB=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MODVERSIONS=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_ARCH_VEXPRESS=y
CONFIG_ARCH_ZYNQ=y
CONFIG_PL310_ERRATA_588369=y
CONFIG_PL310_ERRATA_727915=y
CONFIG_PL310_ERRATA_769419=y
CONFIG_ARM_ERRATA_754322=y
CONFIG_ARM_ERRATA_754327=y
CONFIG_ARM_ERRATA_764369=y
CONFIG_ARM_ERRATA_775420=y
CONFIG_PCI=y
CONFIG_PCI_MSI=y
CONFIG_PCI_REALLOC_ENABLE_AUTO=y
CONFIG_PCIE_XILINX=y
CONFIG_SMP=y
CONFIG_SCHED_MC=y
CONFIG_SCHED_SMT=y
CONFIG_PREEMPT=y
CONFIG_AEABI=y
CONFIG_HIGHMEM=y
CONFIG_CMA=y
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT_DETAILS=y
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_IDLE=y
CONFIG_ARM_ZYNQ_CPUIDLE=y
CONFIG_VFP=y
CONFIG_NEON=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=m
CONFIG_BRIDGE=m
CONFIG_VLAN_8021Q=m
CONFIG_CAN=y
CONFIG_CAN_XILINXCAN=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_DMA_CMA=y
CONFIG_CONNECTOR=y
CONFIG_MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_OF=y
CONFIG_MTD_M25P80=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_PL35X=y
CONFIG_MTD_SPI_NOR=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=16384
CONFIG_SRAM=y
CONFIG_XILINX_TRAFGEN=y
CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_AT25=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_SG=y
CONFIG_NETDEVICES=y
CONFIG_MACB=y
# CONFIG_NET_VENDOR_CIRRUS is not set
# CONFIG_NET_VENDOR_FARADAY is not set
CONFIG_E1000E=y
# CONFIG_NET_VENDOR_MARVELL is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROCHIP is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
CONFIG_R8169=y
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_VIA is not set
# CONFIG_NET_VENDOR_WIZNET is not set
CONFIG_XILINX_EMACLITE=y
CONFIG_XILINX_AXI_EMAC=y
CONFIG_XILINX_PS_EMAC=y
CONFIG_MARVELL_PHY=y
CONFIG_VITESSE_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_INPUT_SPARSEKMAP=y
CONFIG_INPUT_EVDEV=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_GPIO_POLLED=y
# CONFIG_LEGACY_PTYS is not set
# CONFIG_DEVKMEM is not set
CONFIG_SERIAL_XILINX_PS_UART=y
CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
# CONFIG_HW_RANDOM is not set
CONFIG_XILINX_DEVCFG=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_CADENCE=y
CONFIG_SPI=y
CONFIG_SPI_CADENCE=y
CONFIG_SPI_XILINX=y
CONFIG_SPI_ZYNQ_QSPI=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_ZYNQ=y
CONFIG_PMBUS=y
CONFIG_SENSORS_UCD9000=y
CONFIG_SENSORS_UCD9200=y
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_XILINX_WATCHDOG=y
CONFIG_CADENCE_WATCHDOG=y
CONFIG_REGULATOR=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_CONTROLLER=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_VIDEO_XILINX=y
CONFIG_VIDEO_XILINX_CFA=y
CONFIG_VIDEO_XILINX_CRESAMPLE=y
CONFIG_VIDEO_XILINX_REMAPPER=y
CONFIG_VIDEO_XILINX_RGB2YUV=y
CONFIG_VIDEO_XILINX_SCALER=y
CONFIG_VIDEO_XILINX_SWITCH=y
CONFIG_VIDEO_XILINX_TPG=y
# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
CONFIG_VIDEO_ADV7604=y
# CONFIG_DVB_TUNER_DIB0070 is not set
# CONFIG_DVB_TUNER_DIB0090 is not set
CONFIG_DRM=y
CONFIG_DRM_XILINX=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_SOC=y
CONFIG_SND_SOC_ADI=y
CONFIG_SND_SOC_ADI_AXI_I2S=y
CONFIG_SND_SOC_ADI_AXI_SPDIF=y
CONFIG_HID_MICROSOFT=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
CONFIG_USB_STORAGE=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_ULPI=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_XILINX=y
CONFIG_USB_CONFIGFS=m
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_ZERO=m
CONFIG_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_OF_ARASAN=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_ONESHOT=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_TRANSIENT=y
CONFIG_LEDS_TRIGGER_CAMERA=y
CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_SYNOPSYS=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_PCF8563=y
CONFIG_DMADEVICES=y
CONFIG_PL330_DMA=y
CONFIG_XILINX_DMA_ENGINES=y
CONFIG_XILINX_DMA=y
CONFIG_UIO=y
CONFIG_UIO_PDRV_GENIRQ=y
CONFIG_UIO_XILINX_APM=y
CONFIG_COMMON_CLK_SI570=y
CONFIG_MEMORY=y
CONFIG_IIO=y
CONFIG_XILINX_XADC=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
# CONFIG_DNOTIFY is not set
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_SUMMARY=y
CONFIG_NFS_FS=y
CONFIG_ROOT_NFS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
# CONFIG_SCHED_DEBUG is not set
CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_PREEMPT is not set
CONFIG_RCU_CPU_STALL_TIMEOUT=60
CONFIG_FONTS=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
# TaPaSCO specific
CONFIG_FORCE_MAX_ZONEORDER=14
CONFIG_LOCALVERSION="-tapasco"
CONFIG_DEFAULT_HOSTNAME="$BOARD"
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PROFILING=y
CONFIG_HAVE_OPROFILE=y
CONFIG_CMDLINE="console=ttyPS0,115200n8 root=/dev/mmcblk0p2 rw earlyprintk"
CONFIG_CMA_SIZE_MBYTES=128
CONFIG_CMA_SIZE_SEL_MBYTES=y
CONFIG_CMA_ALIGNMENT=8
CONFIG_CMA_AREAS=9
CONFIG_COMPACTION=y
CONFIG_PRINTK_TIME=y
CONFIG_FTRACE=y
CONFIG_FTRACE_SYSCALLS=y
#!/bin/bash
BOARD=${1:-zedboard}
VERSION=${2:-2016.4}
SDCARD=${3:-}
DIR="$BOARD/$VERSION"
CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
BUILD_LINUX_LOG="$PWD/build-linux.log"
BUILD_UBOOT_LOG="$PWD/build-uboot.log"
BUILD_SSBL_LOG="$PWD/build-ssbl.log"
BUILD_UIMAGE_LOG="$PWD/build-uimage.log"
BUILD_FSBL_LOG="$PWD/build-fsbl.log"
BUILD_BOOTBIN_LOG="$PWD/build-bootbin.log"
PREPARE_SD_LOG="$PWD/prepare-sd.log"
# fetch status
FETCH_UBOOT_OK=1
FETCH_LINUX_OK=1
# build status
BUILD_UBOOT_OK=1
BUILD_LINUX_OK=1
BUILD_UIMAGE_OK=1
PREPARE_SD_OK=1
print_usage () {
cat << EOF
Usage: ${0##*/} BOARD VERSION [DEVICE]
Build a boot image for the given BOARD and VERSION (git tag). If DEVICE is
given, repartition the device as a bootable SD card (WARNING: all data will
be lost).
BOARD one of zc706, zedboard
VERSION Vivado Design Suite version, e.g., 2016.4
DEVICE SD card device, e.g., /dev/sdb (optional)
EOF
exit 1
}
check_board () {
case $BOARD in
"zedboard")
;;
"zc706")
;;
"pynq")
;;
*)
echo "unknown board: $BOARD"
echo "select one of zedboard, zc706 or pynq"
print_usage
;;
esac
}
check_compiler () {
gcc=`which ${CROSS_COMPILE}gcc`
if [[ $? -ne 0 ]]; then
echo "Compiler ${CROSS_COMPILE}gcc not found in path."
exit 1
fi
}
check_hsi () {
hsi=`which hsi`
if [[ $? -ne 0 ]]; then
echo "Xilinx hsi tool is not in PATH, please source Vivado settings."
exit 1
fi
}
check_vivado () {
viv=`which vivado`
if [[ $? -ne 0 ]]; then
echo "Xilinx Vivado is not in PATH, please source Vivado settings."
exit 1
fi
}
check_bootgen () {
viv=`which bootgen`
if [[ $? -ne 0 ]]; then
echo "Xilinx bootgen tool is not in PATH, please source Vivado settings."
exit 1
fi
}
check_sdcard () {
if [[ -n $SDCARD && ! -e $SDCARD ]]; then
echo "SD card device $SDCARD does not exist!"
exit 1
fi
}
get_linux () {
if [[ ! -d $DIR/linux-xlnx ]]; then
# echo "Fetching linux $VERSION ..."
mkdir -p "$DIR" > /dev/null &&
pushd $DIR > /dev/null &&
if [[ ! -d linux-xlnx ]]; then git clone -b xilinx-v$VERSION --depth 1 https://github.com/xilinx/linux-xlnx > /dev/null; fi &&
popd > /dev/null
fi
}
get_u-boot () {
if [[ ! -d $DIR/u-boot-xlnx ]]; then
# echo "Fetching u-boot $VERSION ..."
mkdir -p "$DIR" > /dev/null &&
pushd $DIR > /dev/null &&
if [[ ! -d u-boot-xlnx ]]; then git clone -b xilinx-v$VERSION --depth 1 https://github.com/xilinx/u-boot-xlnx > /dev/null; fi &&
popd > /dev/null
fi
}
build_u-boot () {
if [[ ! -e $DIR/u-boot-xlnx/tools/mkimage ]]; then
# echo "Building u-boot $VERSION ..."
case $BOARD in
"zedboard")
DEFCONFIG=zynq_zed_defconfig
;;
"zc706")
DEFCONFIG=zynq_zed_defconfig
;;
"pynq")
echo "Cannot build U-Boot for PyNQ yet."
exit 1
;;
esac
make -C $DIR/u-boot-xlnx CROSS_COMPILE=$CROSS_COMPILE ARCH=arm $DEFCONFIG > /dev/null 2>&1 &&
make -C $DIR/u-boot-xlnx CROSS_COMPILE=$CROSS_COMPILE ARCH=arm tools > $BUILD_UBOOT_LOG 2>&1
else
echo "$DIR/u-boot-xlnx/tools/mkimage already exists, skipping." >> $BUILD_UBOOT_LOG
fi
}
build_linux () {
if [[ ! -e $DIR/linux-xlnx/arch/arm/boot/Image ]]; then
# echo "Building linux $VERSION .."
DEFCONFIG=tapasco_zynq_defconfig
CONFIGFILE="$PWD/configs/tapasco_zynq_defconfig"
cp $CONFIGFILE $DIR/linux-xlnx/arch/arm/configs/ &&\
make -C $DIR/linux-xlnx CROSS_COMPILE=$CROSS_COMPILE ARCH=arm $DEFCONFIG > /dev/null &&
make -C $DIR/linux-xlnx CROSS_COMPILE=$CROSS_COMPILE ARCH=arm -j > $BUILD_LINUX_LOG 2>&1
else
echo "$DIR/linux-xlnx/arch/arm/boot/Image already exists, skipping." >> $BUILD_LINUX_LOG
fi
}
build_ssbl () {
if [[ ! -e $DIR/u-boot-xlnx/u-boot ]]; then
# echo "Building second stage boot loader ..."
DTC=$PWD/$DIR/linux-xlnx/scripts/dtc/dtc
make -C $DIR/u-boot-xlnx CROSS_COMPILE=$CROSS_COMPILE ARCH=arm DTC=$DTC u-boot > $BUILD_SSBL_LOG 2>&1
else
echo "$DIR/u-boot-xlnx/u-boot already exists, skipping." >> $BUILD_SSBL_LOG
fi
cp $DIR/u-boot-xlnx/u-boot $DIR/u-boot-xlnx/u-boot.elf >> $BUILD_SSBL_LOG 2>&1
}
build_uimage () {
if [[ ! -e $DIR/linux-xlnx/arch/arm/boot/uImage ]]; then
# "Building uImage ..."
make -C $DIR/linux-xlnx CROSS_COMPILE=$CROSS_COMPILE ARCH=arm PATH=$PATH:$PWD/$DIR/u-boot-xlnx/tools UIMAGE_LOADADDR=0x8000 uImage > $BUILD_UIMAGE_LOG 2>&1
else
echo "$DIR/linux-xlnx/arch/arm/boot/uImage already exists, skipping." >> $BUILD_UIMAGE_LOG
fi
}
build_fsbl () {
if [[ ! -f $DIR/fsbl/executable.elf ]]; then
mkdir -p $DIR/fsbl > /dev/null &&
pushd $DIR/fsbl > /dev/null &&
cat > project.tcl << EOF
package require json
set platform_file [open "\$env(TAPASCO_HOME)/platform/$BOARD/platform.json" r]
set json [read \$platform_file]
close \$platform_file
set platform [::json::json2dict \$json]
source "\$env(TAPASCO_HOME)/common/common.tcl"
source "\$env(TAPASCO_HOME)/platform/common/platform.tcl"
source "\$env(TAPASCO_HOME)/platform/$BOARD/$BOARD.tcl"
create_project $BOARD $BOARD -part [dict get \$platform "Part"] -force
set board_part ""
if {[dict exists \$platform "BoardPart"]} {
set board_part [dict get \$platform "BoardPart"]
set_property board_part \$board_part [current_project]
}
create_bd_design -quiet "system"
set board_preset {}
if {[dict exists \$platform "BoardPreset"]} {
set board_preset [dict get \$platform "BoardPreset"]
}
set ps [tapasco::createZynqPS "ps7" \$board_preset 100]
# activate ACP, HP0, HP2 and GP0/1 (+ FCLK1 @10MHz)
set_property -dict [list \
CONFIG.PCW_USE_M_AXI_GP0 {1} \
CONFIG.PCW_USE_M_AXI_GP1 {1} \
CONFIG.PCW_USE_S_AXI_HP0 {1} \
CONFIG.PCW_USE_S_AXI_HP1 {0} \
CONFIG.PCW_USE_S_AXI_HP2 {1} \
CONFIG.PCW_USE_S_AXI_HP3 {0} \
CONFIG.PCW_USE_S_AXI_ACP {1} \
CONFIG.PCW_USE_S_AXI_GP0 {0} \
CONFIG.PCW_USE_S_AXI_GP1 {0} \
CONFIG.PCW_S_AXI_HP0_DATA_WIDTH {64} \
CONFIG.PCW_S_AXI_HP2_DATA_WIDTH {64} \
CONFIG.PCW_USE_DEFAULT_ACP_USER_VAL {1} \
CONFIG.PCW_FPGA1_PERIPHERAL_FREQMHZ {10} \
CONFIG.PCW_USE_FABRIC_INTERRUPT {1} \
CONFIG.PCW_IRQ_F2P_INTR {1} \
CONFIG.PCW_TTC0_PERIPHERAL_ENABLE {0} \
CONFIG.PCW_EN_CLK1_PORT {1} ] \$ps
set clk [lindex [get_bd_pins -of_objects \$ps -filter { TYPE == clk && DIR == O }] 0]
connect_bd_net \$clk [get_bd_pins -of_objects \$ps -filter { TYPE == clk && DIR == I}]
validate_bd_design
save_bd_design
make_wrapper -files [get_files $BOARD/$BOARD.srcs/sources_1/bd/system/system.bd] -top
add_files -norecurse $BOARD/$BOARD.srcs/sources_1/bd/system/hdl/system_wrapper.v
update_compile_order -fileset sources_1
generate_target all [get_files $BOARD/$BOARD.srcs/sources_1/bd/system/system.bd]
write_hwdef -force -file $BOARD.hdf
puts "HDF in $BOARD.hdf, done."
exit
EOF
cat > hsi.tcl << EOF
generate_app -hw [open_hw_design $BOARD.hdf] -os standalone -proc ps7_cortexa9_0 -app zynq_fsbl -compile -sw fsbl -dir .
EOF
vivado -nolog -nojournal -notrace -mode batch -source project.tcl > $BUILD_FSBL_LOG 2>&1 &&
hsi -nolog -nojournal -notrace -mode batch -source hsi.tcl >> $BUILD_FSBL_LOG 2>&1
else
echo "$BOARD/fsbl/executable.elf already exists, skipping." >> $BUILD_FSBL_LOG
fi
}
build_bootbin () {
# "Building BOOT.BIN ..."
cat > $DIR/bootimage.bif << EOF
image : {
[bootloader]fsbl/executable.elf
u-boot-xlnx/u-boot.elf
}
EOF
pushd $DIR > /dev/null &&
bootgen -image bootimage.bif -w on -o BOOT.BIN > $BUILD_BOOTBIN_LOG 2>&1 &&
popd > /dev/null
}
prepare_sd () {
sudo dd if=/dev/zero of=$SDCARD bs=1024 count=1 > $PREPARE_SD_LOG 2>&1 &&
sudo sfdisk ${SDCARD} >> $PREPARE_SD_LOG 2>&1 << EOF
2048 204800 c, *
206848 7655424 83 -
EOF
sudo mkfs.vfat -F 32 -n BOOT ${SDCARD}1 >> $PREPARE_SD_LOG 2>&1
sudo mkfs.ext4 -qF -L root ${SDCARD}2 >> $PREPARE_SD_LOG 2>&1
mkdir -p `basename ${SDCARD}1` 2> /dev/null
sudo mount ${SDCARD}1 `basename ${SDCARD}1` >> $PREPARE_SD_LOG 2>&1 &&
copy_files_to_boot &&
sudo umount `basename ${SDCARD}1` >> $PREPARE_SD_LOG 2>&1 &&
rmdir `basename ${SDCARD}1` 2> /dev/null &&
echo "dd'ing rootfs onto second partition, this will take a while ..." >> $PREPARE_SD_LOG &&
tar xJf pynq.rootfs.img.tar.xz | sudo dd of=${SDCARD}2 bs=10M >> $PREPARE_SD_LOG 2>&1
}
copy_files_to_boot () {
TO=`basename ${SDCARD}1`/
echo "Copying $DIR/BOOT.BIN to $TO ..." >> $PREPARE_SD_LOG 2>&1
sudo cp $DIR/BOOT.BIN $TO >> $PREPARE_SD_LOG 2>&1
echo "Coping $DIR/linux-xlnx/arch/arm/boot/uImage to $TO ..." >> $PREPARE_SD_LOG 2>&1
sudo cp $DIR/linux-xlnx/arch/arm/boot/uImage $TO >> $PREPARE_SD_LOG 2>&1
case $BOARD in
"zedboard")
echo "Copying $DIR/linux-xlnx/arch/arm/boot/dts/zynq-zed.dtb to ${TO}devicetree.dtb ..." >> $PREPARE_SD_LOG 2>&1
sudo cp $DIR/u-boot-xlnx/arch/arm/dts/zynq-zed.dtb ${TO}devicetree.dtb >> $PREPARE_SD_LOG 2>&1
;;
"zc706")
echo "Copying $DIR/linux-xlnx/arch/arm/boot/dts/zynq-zc706.dtb ${TO}devicetree.dtb ..." >> $PREPARE_SD_LOG 2>&1
sudo cp $DIR/u-boot-xlnx/arch/arm/dts/zynq-zc706.dtb ${TO}devicetree.dtb >> $PREPARE_SD_LOG 2>&1
;;
*)
;;
esac
}
echo "Cross compiler ABI is set to $CROSS_COMPILE."
echo "Board is $BOARD."
echo "Version is $VERSION."
echo "SD card device is $SDCARD."
check_board
check_compiler
check_hsi
check_vivado
check_sdcard
echo "And so it begins ..."
FETCH_LINUX_OK=$(get_linux; echo $? &)
FETCH_UBOOT_OK=$(get_u-boot; echo $? &)
wait
if [[ $FETCH_LINUX_OK -ne 0 ]]; then
echo "Fetching Linux failed, check logs.."
exit 1
fi
if [[ $FETCH_UBOOT_OK -ne 0 ]]; then
echo "Fetching U-Boot failed, check logs."
exit 1
fi
echo "Ok, got the sources, will build now ..."
echo "Building Linux kernel and U-Boot tools ..."
BUILD_UBOOT_OK=$(build_u-boot; echo $? &)
BUILD_LINUX_OK=$(build_linux; echo $? &)
wait
if [[ $BUILD_LINUX_OK -ne 0 ]]; then
echo "Building Linux failed, check log: $BUILD_LINUX_LOG"
exit 1
fi
if [[ $BUILD_UBOOT_OK -ne 0 ]]; then
echo "Building U-Boot failed, check log: $BUILD_UBOOT_LOG"
exit 1
fi
echo "Building U-Boot SSBL and uImage ..."
BUILD_SSBL_OK=$(build_ssbl; echo $? &)
BUILD_UIMAGE_OK=$(build_uimage; echo $? &)
wait
if [[ $BUILD_SSBL_OK -ne 0 ]]; then
"Echo building U-Boot SSBL failed, check log: $BUILD_SSBL_LOG"
exit 1
fi
if [[ $BUILD_UIMAGE_OK -ne 0 ]]; then
"Echo building uImage failed, check log: $BUILD_UIMAGE_LOG"
exit 1
fi
echo "Build FSBL ..."
BUILD_FSBL_OK=$(build_fsbl; echo $? &)
wait
if [[ $BUILD_FSBL_OK -ne 0 ]]; then
"Echo building FSBL failed, check log: $BUILD_FSBL_LOG"
exit 1
fi
echo "Generating BOOT.BIN ..."
BUILD_BOOTBIN_OK=$(build_bootbin; echo $? &)
wait
if [[ $BUILD_BOOTBIN_OK -ne 0 ]]; then
echo "Echo building BOOT.BIN failed, check log: $BUILD_BOOTBIN_LOG"
exit 1
fi
echo "Done - find BOOT.BIN is here: $DIR/BOOT.BIN."
if [[ -n $SDCARD ]]; then
echo "Preparing $SDCARD, this may take a while ..."
PREPARE_SD_OK=$(prepare_sd; echo $? &)
if [[ $PREPARE_SD_OK -ne 0 ]]; then
echo "Preparing SD card failed, check log: $PREPARE_SD_LOG"
exit 1
fi
sync
echo "SD card $SDCARD successfully prepared, ready to boot!"
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment