From: Martin Jerabek Date: Wed, 18 May 2016 13:38:43 +0000 (+0200) Subject: uboot images migrated to FIT, bootscript loads only 1 image (faster) X-Git-Url: https://rtime.felk.cvut.cz/gitweb/fpga/zynq/canbench-sw.git/commitdiff_plain/281c87172ed5eadcd6b8deb66b3313832816a174 uboot images migrated to FIT, bootscript loads only 1 image (faster) --- diff --git a/Makefile b/Makefile index 444e90d..de68daf 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,8 @@ petalinux/images/linux/BOOT.BIN: FORCE $(MAKE) -C petalinux images/linux/BOOT.BIN .PHONY: dist -dist: system/system.hdf system/system.bit petalinux/bootscript petalinux/images/linux/BOOT.BIN +dist: system/system.bit petalinux/bootscript petalinux/images/linux/BOOT.BIN petalinux/images/linux/image.ub petalinux/images/linux/system.dtb + $(MAKE) -C petalinux images/linux/image.ub cp -t $(TFTPROOT) $^ petalinux_config: system/system.hdf diff --git a/petalinux/Makefile b/petalinux/Makefile index c0ff607..71402b3 100644 --- a/petalinux/Makefile +++ b/petalinux/Makefile @@ -16,8 +16,9 @@ build: .configured subsystems/linux/configs/u-boot/platform-auto.h images/linux/BOOT.BIN: FORCE cd images/linux && petalinux-package --boot --fsbl zynq_fsbl.elf --u-boot u-boot.elf --force -bootscript: bootscript.txt - mkimage -A arm -O u-boot -T script -C none -a 0 -e 0 -n "t-Boot Script" -d $< $@ +bootscript: bootscript.txt bootscript.its + #mkimage -A arm -O u-boot -T script -C none -a 0 -e 0 -n "t-Boot Script" -d $< $@ + mkimage -f bootscript.its $@ subsystems/linux/configs/u-boot/platform-auto.h: FORCE | build/linux/u-boot/Makefile $(MAKE) UBOOT_AUTO_CONFIG=y -C build/linux/u-boot autogen-config @@ -31,4 +32,10 @@ subsystems/linux/configs/u-boot/platform-auto.h: FORCE | build/linux/u-boot/Make build/linux/u-boot/Makefile: petalinux-build -c u-boot +images/linux/system.bit.gz: ../system/system.bit + gzip -9 <$< >$@ + +images/linux/image.ub: FORCE images/linux/system.bit.gz + mkimage -f uboot-image.its $@ + FORCE: diff --git a/petalinux/bootscript.its b/petalinux/bootscript.its new file mode 100644 index 0000000..31d35cc --- /dev/null +++ b/petalinux/bootscript.its @@ -0,0 +1,18 @@ +/dts-v1/; + +/ { + description = "bootscript"; + #address-cells = <1>; + + images { + bootscript@1 { + description = "Bootscript"; + data = /incbin/("./bootscript.txt"); + type = "script"; + compression = "none"; + hash@1 { + algo = "crc32"; + }; + }; + }; +}; diff --git a/petalinux/bootscript.txt b/petalinux/bootscript.txt index d7ddeaf..bbc6908 100644 --- a/petalinux/bootscript.txt +++ b/petalinux/bootscript.txt @@ -1,14 +1,9 @@ echo "Running bootscript ..." -setenv tftp_dir '' - setenv tftp_path /uzedcan -setenv bitstream_image ${tftp_path}/system.bit -setenv dtb_img ${tftp_path}/system.dtb -setenv kernel_img ${tftp_path}/image.ub -setenv nfsserverip 192.168.1.75 -#setenv nfsserverip 147.32.86.163 +#setenv nfsserverip 192.168.1.75 +setenv nfsserverip 147.32.86.163 setenv nfspath /export/canbench @@ -17,14 +12,12 @@ setenv bootargs ${bootargs} console=ttyPS0,115200 # If duplicate parameters are present, the later will take effect. setenv bootargs ${bootargs} ip=${ipaddr} root=/dev/nfs rw nfsroot=${nfsserverip}:${nfspath} -setenv bitstream_load_address 0x04000000 - -setenv bitstream_tftp 'echo === Loading FPGA bitstream; tftpboot ${bitstream_load_address} ${tftp_dir}${bitstream_image}' -setenv dtb_tftp 'echo === Loading Device Tree; tftpboot ${dtbnetstart} ${tftp_dir}${dtb_img}' -setenv kernel_tftp 'echo === Loading Linux kernel; tftpboot ${netstart} ${tftp_dir}${kernel_img}' +setenv image_img ${tftp_path}/image.ub +setenv image_tftp 'echo === Loading boot image; tftpboot ${netstart} ${tftp_dir}${image_img}; fdt addr ${netstart}' +setenv bitstream_unpack 'fdt get size filesize /images/fpga@1 data; imxtract ${netstart} fpga@1 ${bitstream_load_address}' +setenv boot_now 'bootm ${netstart}' +setenv bitstream_load_address 0x04000000 setenv bitstream_load 'fpga loadb 0 ${bitstream_load_address} ${filesize}' -setenv boot_now 'bootm ${netstart} - ${dtbnetstart}' - -run bitstream_tftp bitstream_load kernel_tftp dtb_tftp boot_now +run image_tftp bitstream_unpack bitstream_load boot_now diff --git a/petalinux/uEnv.txt b/petalinux/uEnv.txt index a929455..69ae68e 100644 --- a/petalinux/uEnv.txt +++ b/petalinux/uEnv.txt @@ -2,5 +2,5 @@ ipaddr=192.168.1.16 serverip=192.168.1.75 bootscript_addr=0x01000000 bootscript_path=bootscript -tboot=tftpboot ${bootscript_addr} ${serverip}:${bootscript_path} && source ${bootscript_addr} -default_bootcmd=run tboot +tboot=tftpboot ${bootscript_addr} ${serverip}:${bootscript_path} && source ${bootscript_addr}:bootscript@1 +default_bootcmd=dhcp; run tboot diff --git a/petalinux/uboot-image.its b/petalinux/uboot-image.its new file mode 100644 index 0000000..264d719 --- /dev/null +++ b/petalinux/uboot-image.its @@ -0,0 +1,63 @@ +/* + * Simple U-boot uImage source file containing a single kernel and FDT blob + */ + +/dts-v1/; + +/ { + description = "Kernel for MicroZed"; + #address-cells = <1>; + + images { + kernel@1 { + description = "Linux kernel"; + data = /incbin/("./images/linux/zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + compression = "none"; + load = <0x00008000>; + entry = <0x00008000>; + hash@1 { + algo = "crc32"; + }; + hash@2 { + algo = "sha1"; + }; + }; + fdt@1 { + description = "Flattened Device Tree blob"; + data = /incbin/("./images/linux/system.dtb"); + type = "flat_dt"; + arch = "arm"; + compression = "none"; + hash@1 { + algo = "crc32"; + }; + hash@2 { + algo = "sha1"; + }; + }; + fpga@1 { + description = "FPGA bitstream"; + data = /incbin/("./images/linux/system.bit.gz"); + type = "filesystem"; + compression = "gzip"; + hash@1 { + algo = "crc32"; + }; + hash@2 { + algo = "sha1"; + }; + }; + }; + + configurations { + default = "conf@1"; + conf@1 { + description = "Boot Linux kernel with FDT blob"; + kernel = "kernel@1"; + fdt = "fdt@1"; + }; + }; +};