]> rtime.felk.cvut.cz Git - fpga/zynq/canbench-sw.git/commitdiff
uboot images migrated to FIT, bootscript loads only 1 image (faster)
authorMartin Jerabek <jerabma7@fel.cvut.cz>
Wed, 18 May 2016 13:38:43 +0000 (15:38 +0200)
committerMartin Jerabek <jerabma7@fel.cvut.cz>
Wed, 18 May 2016 23:01:50 +0000 (01:01 +0200)
Makefile
petalinux/Makefile
petalinux/bootscript.its [new file with mode: 0644]
petalinux/bootscript.txt
petalinux/uEnv.txt
petalinux/uboot-image.its [new file with mode: 0644]

index 444e90d37fd27780b568d2eea5d75ab0aaebd0fa..de68daf4738d85876337dd4300340bff20818814 100644 (file)
--- 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
index c0ff6071440cf74e724127cc89c899cdcaff09ef..71402b30ef9c199ba9620ee8e9f82a8cdff0b44f 100644 (file)
@@ -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 (file)
index 0000000..31d35cc
--- /dev/null
@@ -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";
+                       };
+               };
+       };
+};
index d7ddeafd5fcaa06f35202200084d096f4732749c..bbc69080bba33b18cc6741d458ece3a9eabcdc1b 100644 (file)
@@ -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
index a929455720d3698a63a0ed00759902b22f70e4ce..69ae68ef39509915c939ce1bbc2b4e8230f7373c 100644 (file)
@@ -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 (file)
index 0000000..264d719
--- /dev/null
@@ -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";
+               };
+       };
+};