From 9393cb81acc34d1bd27cc921d8d98e618fb74662 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Fri, 23 Aug 2019 00:14:04 +0800 Subject: [PATCH] update u-boot,linux kernel to compile dtb and zImage into single idb file; update bootstrap,u-boot,linux kernel nandflash partition; update sama5d4_xplained_loader files in folder --- linux-bsp/patches/at91bootstrap-sama5d4.patch | 10 linux-bsp/patches/linux-at91-sama5d4.patch | 134 +++++++++++++++++++-- tools/sama5d4_xplained_loader/demo_linux_nandflash_system.bat | 2 linux-bsp/patches/u-boot-at91-sama5d4.patch | 61 +++++----- /dev/null | 0 linux-bsp/tarballs/partition.txt | 11 + tools/setup_env.sh | 2 tools/sama5d4_xplained_loader/ReadMe.txt | 16 ++ tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qmlc | 0 tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qml | 76 ++++++++++++ 10 files changed, 259 insertions(+), 53 deletions(-) diff --git a/linux-bsp/patches/at91bootstrap-sama5d4.patch b/linux-bsp/patches/at91bootstrap-sama5d4.patch index 91e26f8..d88e7c0 100644 --- a/linux-bsp/patches/at91bootstrap-sama5d4.patch +++ b/linux-bsp/patches/at91bootstrap-sama5d4.patch @@ -1,6 +1,6 @@ diff -Nuar at91bootstrap/build.sh at91bootstrap-sama5d4/build.sh --- at91bootstrap/build.sh 1970-01-01 08:00:00.000000000 +0800 -+++ at91bootstrap-sama5d4/build.sh 2019-08-22 18:54:20.707235362 +0800 ++++ at91bootstrap-sama5d4/build.sh 2019-08-22 19:29:04.983275344 +0800 @@ -0,0 +1,71 @@ +#!/bin/bash + @@ -75,11 +75,11 @@ + diff -Nuar at91bootstrap/.cfg-sama5d4 at91bootstrap-sama5d4/.cfg-sama5d4 --- at91bootstrap/.cfg-sama5d4 1970-01-01 08:00:00.000000000 +0800 -+++ at91bootstrap-sama5d4/.cfg-sama5d4 2019-08-22 13:18:47.498849159 +0800 ++++ at91bootstrap-sama5d4/.cfg-sama5d4 2019-08-23 00:01:11.723588530 +0800 @@ -0,0 +1,274 @@ +# +# Automatically generated make config: don't edit -+# Thu Aug 22 13:18:42 2019 ++# Thu Aug 22 23:43:05 2019 +# +HAVE_DOT_CONFIG=y +# CONFIG_AT91SAM9260EK is not set @@ -291,7 +291,7 @@ +# +# U-Boot Image Storage Setup +# -+CONFIG_IMG_SIZE="0x000a0000" ++CONFIG_IMG_SIZE="0x00080000" +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_LOUD is not set @@ -353,7 +353,7 @@ +CONFIG_PMC=y diff -Nuar at91bootstrap/Makefile at91bootstrap-sama5d4/Makefile --- at91bootstrap/Makefile 2019-08-02 17:30:35.000000000 +0800 -+++ at91bootstrap-sama5d4/Makefile 2019-08-22 11:46:05.882742473 +0800 ++++ at91bootstrap-sama5d4/Makefile 2019-08-22 19:29:04.983275344 +0800 @@ -119,6 +119,7 @@ HOSTARCH := $(shell uname -m | sed -e s/arm.*/arm/) diff --git a/linux-bsp/patches/linux-at91-sama5d4.patch b/linux-bsp/patches/linux-at91-sama5d4.patch index 5049d2b..e1d12c5 100644 --- a/linux-bsp/patches/linux-at91-sama5d4.patch +++ b/linux-bsp/patches/linux-at91-sama5d4.patch @@ -1,6 +1,6 @@ diff -Nuar linux-at91/arch/arm/boot/dts/at91-sama5d4_xplained.dts linux-at91-sama5d4/arch/arm/boot/dts/at91-sama5d4_xplained.dts --- linux-at91/arch/arm/boot/dts/at91-sama5d4_xplained.dts 2019-08-18 17:24:46.000000000 +0800 -+++ linux-at91-sama5d4/arch/arm/boot/dts/at91-sama5d4_xplained.dts 2019-08-20 14:09:32.906035974 +0800 ++++ linux-at91-sama5d4/arch/arm/boot/dts/at91-sama5d4_xplained.dts 2019-08-22 23:05:47.351524760 +0800 @@ -128,6 +128,12 @@ spi1: spi@fc018000 { cs-gpios = <&pioB 21 0>; @@ -14,10 +14,65 @@ }; adc0: adc@fc034000 { +@@ -201,35 +207,25 @@ + atmel,has-pmecc; + status = "okay"; + +- at91bootstrap@0 { +- label = "at91bootstrap"; +- reg = <0x0 0x40000>; +- }; +- +- bootloader@40000 { +- label = "bootloader"; +- reg = <0x40000 0x80000>; +- }; +- +- bootloaderenv@c0000 { +- label = "bootloader env"; +- reg = <0xc0000 0xc0000>; +- }; +- +- dtb@180000 { +- label = "device tree"; +- reg = <0x180000 0x80000>; +- }; +- +- kernel@200000 { +- label = "kernel"; +- reg = <0x200000 0x600000>; +- }; +- +- rootfs@800000 { +- label = "rootfs"; +- reg = <0x800000 0x0f800000>; +- }; ++ bootloader@0 { /* 1MB: 0~40000(bootstrap) 40000~C0000(u-boot.bin) C0000~100000(u-boot.env) */ ++ label = "bootloader"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ linux@100000 { /* 7MB */ ++ label = "linux"; ++ reg = <0x100000 0x700000>; ++ }; ++ ++ rootfs@800000 { /* 200MB */ ++ label = "rootfs"; ++ reg = <0x800000 0xc800000>; ++ }; ++ ++ apps@800000 { /* 48MB */ ++ label = "apps"; ++ reg = <0xD000000 0x3000000>; ++ }; + }; + }; + diff -Nuar linux-at91/build.sh linux-at91-sama5d4/build.sh --- linux-at91/build.sh 1970-01-01 08:00:00.000000000 +0800 -+++ linux-at91-sama5d4/build.sh 2019-08-22 19:01:50.275243986 +0800 -@@ -0,0 +1,81 @@ ++++ linux-at91-sama5d4/build.sh 2019-08-22 23:15:52.059536360 +0800 +@@ -0,0 +1,85 @@ +#!/bin/bash + +BOARD=sama5d4 @@ -25,6 +80,9 @@ +IMGS_PATH=../images +IMG_KER=linuxrom-${BOARD}.bin +IMG_DTB=linuxrom-${BOARD}.dtb ++IMG_ITB=linuxrom-${BOARD}.itb ++ ++IMG_FILES=${IMG_ITB} + +#INITRAMFS=YES + @@ -44,7 +102,7 @@ +function do_clean() +{ + #clean_initramfs -+ rm -f ${IMG_KER} $IMG_DTB ++ rm -f ${IMG_FILES} + rm -f cscope* tags + make CROSS_COMPILE=${CROSSTOOL} distclean +} @@ -60,22 +118,23 @@ + sed -i "s|^\<ARCH\>.*|ARCH\t\t\t?= arm|g" Makefile + sed -i "s|^CROSS_COMPILE.*|CROSS_COMPILE\t?= ${CROSSTOOL}|g" Makefile + -+ make -j${JOBS} uImage LOADADDR=0x22000000 -+ make -j${JOBS} dtbs ++ make -j${JOBS} + -+ cp arch/arm/boot/uImage ${IMG_KER} && chmod a+x ${IMG_KER} -+ cp arch/arm/boot/dts/at91-sama5d4_xplained.dtb ${IMG_DTB} && chmod a+x ${IMG_DTB} ++ echo "mkimage -f linuxrom-${BOARD}.its ${IMG_ITB}" ++ mkimage -f linuxrom-${BOARD}.its ${IMG_ITB} > /dev/null ++ chmod a+x ${IMG_ITB} +} + +function do_install() +{ + if [ -d $TFTP_PATH ] ;then -+ echo "cp ${IMG_KER} ${IMG_DTB} $TFTP_PATH" -+ cp ${IMG_KER} ${IMG_DTB} $TFTP_PATH ++ echo "cp ${IMG_FILES} $TFTP_PATH" ++ cp ${IMG_FILES} $TFTP_PATH + fi + + if [ -d ${IMGS_PATH} ] ; then -+ cp ${IMG_KER} ${IMG_DTB} $IMGS_PATH ++ echo "cp ${IMG_FILES} $IMGS_PATH" ++ cp ${IMG_FILES} $IMGS_PATH + fi +} + @@ -101,7 +160,7 @@ + diff -Nuar linux-at91/.cfg-sama5d4 linux-at91-sama5d4/.cfg-sama5d4 --- linux-at91/.cfg-sama5d4 1970-01-01 08:00:00.000000000 +0800 -+++ linux-at91-sama5d4/.cfg-sama5d4 2019-08-22 19:01:58.915244152 +0800 ++++ linux-at91-sama5d4/.cfg-sama5d4 2019-08-23 00:02:44.587590311 +0800 @@ -0,0 +1,4073 @@ +# +# Automatically generated file; DO NOT EDIT. @@ -4178,7 +4237,7 @@ +# CONFIG_VIRTUALIZATION is not set diff -Nuar linux-at91/drivers/net/wireless/ralink/rt2x00/rt2800usb.c linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2800usb.c --- linux-at91/drivers/net/wireless/ralink/rt2x00/rt2800usb.c 2019-08-18 17:24:53.000000000 +0800 -+++ linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2800usb.c 2019-08-20 14:09:32.910035974 +0800 ++++ linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2800usb.c 2019-08-22 23:05:23.819524309 +0800 @@ -123,7 +123,8 @@ if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) return false; @@ -4191,7 +4250,7 @@ "TX status timeout for entry %d in queue %d\n", diff -Nuar linux-at91/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h --- linux-at91/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h 2019-08-18 17:24:53.000000000 +0800 -+++ linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h 2019-08-20 14:09:32.910035974 +0800 ++++ linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h 2019-08-22 23:05:23.819524309 +0800 @@ -632,7 +632,8 @@ { if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) @@ -4204,7 +4263,7 @@ /** diff -Nuar linux-at91/drivers/net/wireless/ralink/rt2x00/rt2x00usb.h linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2x00usb.h --- linux-at91/drivers/net/wireless/ralink/rt2x00/rt2x00usb.h 2019-08-18 17:24:53.000000000 +0800 -+++ linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2x00usb.h 2019-08-20 14:09:32.910035974 +0800 ++++ linux-at91-sama5d4/drivers/net/wireless/ralink/rt2x00/rt2x00usb.h 2019-08-22 23:05:23.823524309 +0800 @@ -38,7 +38,7 @@ * a higher value is required. In that case we use the REGISTER_TIMEOUT_FIRMWARE * and EEPROM_TIMEOUT. @@ -4216,7 +4275,7 @@ diff -Nuar linux-at91/drivers/spi/spidev.c linux-at91-sama5d4/drivers/spi/spidev.c --- linux-at91/drivers/spi/spidev.c 2019-08-18 17:24:57.000000000 +0800 -+++ linux-at91-sama5d4/drivers/spi/spidev.c 2019-08-20 14:09:32.910035974 +0800 ++++ linux-at91-sama5d4/drivers/spi/spidev.c 2019-08-22 23:05:23.823524309 +0800 @@ -696,6 +696,7 @@ static const struct of_device_id spidev_dt_ids[] = { { .compatible = "rohm,dh2228fv" }, @@ -4225,9 +4284,50 @@ {}, }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); +diff -Nuar linux-at91/linuxrom-sama5d4.its linux-at91-sama5d4/linuxrom-sama5d4.its +--- linux-at91/linuxrom-sama5d4.its 1970-01-01 08:00:00.000000000 +0800 ++++ linux-at91-sama5d4/linuxrom-sama5d4.its 2019-08-22 22:54:12.063511423 +0800 +@@ -0,0 +1,37 @@ ++/* U-Boot uImage source file for "sama5d4_xplained" */ ++ ++/dts-v1/; ++ ++/ { ++ description = "U-Boot uImage source file for SAMA5D4 Xplained"; ++ #address-cells = <1>; ++ ++ images { ++ kernel@sama5d4 { ++ description = "Linux kernel for SAMA5D4 Xplained"; ++ data = /incbin/("arch/arm/boot/zImage"); ++ type = "kernel"; ++ arch = "arm"; ++ os = "linux"; ++ compression = "none"; ++ load = <0x20008000>; ++ entry = <0x20008000>; ++ }; ++ fdt@sama5d4 { ++ description = "Flattened Device Tree blob for SAMA5D4 Xplained"; ++ data = /incbin/("arch/arm/boot/dts/at91-sama5d4_xplained.dtb"); ++ type = "flat_dt"; ++ arch = "arm"; ++ compression = "none"; ++ }; ++ }; ++ ++ configurations { ++ default = "conf@sama5d4"; ++ conf@sama5d4 { ++ description = "Boot Linux kernel with FDT blob"; ++ kernel = "kernel@sama5d4"; ++ fdt = "fdt@sama5d4"; ++ }; ++ }; ++}; diff -Nuar linux-at91/Makefile linux-at91-sama5d4/Makefile --- linux-at91/Makefile 2019-08-18 17:24:45.000000000 +0800 -+++ linux-at91-sama5d4/Makefile 2019-08-20 14:09:33.046035975 +0800 ++++ linux-at91-sama5d4/Makefile 2019-08-22 23:16:11.343536730 +0800 @@ -1,7 +1,7 @@ VERSION = 4 PATCHLEVEL = 9 diff --git a/linux-bsp/patches/u-boot-at91-sama5d4.patch b/linux-bsp/patches/u-boot-at91-sama5d4.patch index a20c947..24e8766 100644 --- a/linux-bsp/patches/u-boot-at91-sama5d4.patch +++ b/linux-bsp/patches/u-boot-at91-sama5d4.patch @@ -1,6 +1,6 @@ diff -Nuar u-boot-at91/build.sh u-boot-at91-sama5d4/build.sh --- u-boot-at91/build.sh 1970-01-01 08:00:00.000000000 +0800 -+++ u-boot-at91-sama5d4/build.sh 2019-08-22 18:55:28.199236657 +0800 ++++ u-boot-at91-sama5d4/build.sh 2019-08-22 19:29:07.323275389 +0800 @@ -0,0 +1,67 @@ +#!/bin/bash + @@ -71,7 +71,7 @@ + diff -Nuar u-boot-at91/include/configs/sama5d4_xplained.h u-boot-at91-sama5d4/include/configs/sama5d4_xplained.h --- u-boot-at91/include/configs/sama5d4_xplained.h 2019-08-04 21:52:13.000000000 +0800 -+++ u-boot-at91-sama5d4/include/configs/sama5d4_xplained.h 2019-08-22 16:37:32.807077915 +0800 ++++ u-boot-at91-sama5d4/include/configs/sama5d4_xplained.h 2019-08-22 23:56:21.299582959 +0800 @@ -38,7 +38,7 @@ #define CONFIG_USART_BASE ATMEL_BASE_USART3 #define CONFIG_USART_ID ATMEL_ID_USART3 @@ -81,45 +81,48 @@ /* * BOOTP options -@@ -173,9 +173,9 @@ - #define CONFIG_ENV_OFFSET 0xc0000 - #define CONFIG_ENV_OFFSET_REDUND 0x100000 - #define CONFIG_ENV_SIZE 0x20000 +@@ -170,12 +170,10 @@ + #elif CONFIG_SYS_USE_NANDFLASH + /* bootstrap + u-boot + env in nandflash */ + #define CONFIG_ENV_IS_IN_NAND +-#define CONFIG_ENV_OFFSET 0xc0000 +-#define CONFIG_ENV_OFFSET_REDUND 0x100000 +-#define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ -+#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x40000;" \ - "nand read 0x22000000 0x200000 0x600000;" \ +- "nand read 0x22000000 0x200000 0x600000;" \ - "bootz 0x22000000 - 0x21000000" -+ "bootm 0x22000000 - 0x21000000" ++#define CONFIG_ENV_OFFSET 0xC0000 ++#define CONFIG_ENV_SIZE 0x20000 ++//#define CONFIG_ENV_OFFSET_REDUND 0xa0000 ++#define CONFIG_BOOTCOMMAND "nand read 0x22000000 0x100000 0x700000; bootm 0x22000000" #elif CONFIG_SYS_USE_MMC /* bootstrap + u-boot + env in sd card */ #define CONFIG_ENV_IS_IN_FAT -@@ -194,6 +194,37 @@ +@@ -194,6 +192,35 @@ "bootz 0x22000000 - 0x21000000" #endif +/* add by guowenxue, 2019.08.22 */ ++#define CONFIG_FIT 1 +#define CONFIG_ENV_OVERWRITE 1 +#define CONFIG_ETHADDR 42:96:ab:be:a7:5e +#define CONFIG_IPADDR 192.168.2.199 +#define CONFIG_SERVERIP 192.168.2.2 + + -+#define CONFIG_TFTPBOOT "tftp 0x22000000 linuxrom-sama5d4.bin && tftp 0x21000000 linuxrom-sama5d4.dtb; " \ -+ "bootm 0x22000000 - 0x21000000" + -+#define CONFIG_BBL "tftp 0x21000000 u-boot-sama5d4.bin && nand erase 0x40000 0x140000;" \ ++#define CONFIG_TFTPBOOT "tftp 0x22000000 linuxrom-sama5d4.itb && bootm 0x22000000" ++ ++#define CONFIG_BBL "tftp 0x21000000 u-boot-sama5d4.bin && nand erase 0x40000 0xC0000;" \ + "nand write 0x21000000 0x40000 ${filesize}" + -+#define CONFIG_BDTB "tftp 0x21000000 linuxrom-sama5d4.dtb && nand erase 0x180000 0x80000; " \ -+ "nand write 0x21000000 0x180000 ${filesize}" -+ -+#define CONFIG_BKR "tftp 0x22000000 linuxrom-sama5d4.bin && nand erase 0x200000 0x600000; " \ -+ "nand write 0x22000000 0x200000 ${filesize}" ++#define CONFIG_BKR "tftp 0x22000000 linuxrom-sama5d4.itb && nand erase 0x100000 0x700000; " \ ++ "nand write 0x22000000 0x100000 ${filesize}" + +#define CONFIG_BFS "tftp 0x21000000 rootfs-sama5d4.ubi && nand erase 800000 c800000; " \ + "nand write 0x21000000 800000 ${filesize}" + -+#define CONFIG_BSYS "run bbl; run bdtb; run bkr; run bfs" ++#define CONFIG_BSYS "run bbl; run bkr; run bfs" + +#define CONFIG_CLRAPPS "nand erase d000000 13000000" + @@ -131,21 +134,22 @@ #ifdef CONFIG_SYS_USE_MMC #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk " \ -@@ -203,8 +234,8 @@ +@@ -201,10 +228,7 @@ + #else + #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk " \ - "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ - "256K(env),256k(evn_redundent),256k(spare)," \ +- "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ +- "256K(env),256k(evn_redundent),256k(spare)," \ - "512k(dtb),6M(kernel)ro,-(rootfs) " \ - "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" -+ "512k(dtb),6M(kernel)ro,200M(rootfs),-(apps) " \ -+ "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw" ++ "rootfstype=ubifs ubi.mtd=2 root=ubi0:rootfs rw" #endif #define CONFIG_BAUDRATE 115200 diff -Nuar u-boot-at91/include/env_default.h u-boot-at91-sama5d4/include/env_default.h --- u-boot-at91/include/env_default.h 2019-08-04 21:52:13.000000000 +0800 -+++ u-boot-at91-sama5d4/include/env_default.h 2019-08-22 16:33:49.407073630 +0800 -@@ -76,6 +76,33 @@ ++++ u-boot-at91-sama5d4/include/env_default.h 2019-08-22 23:47:56.027573267 +0800 +@@ -76,6 +76,30 @@ #ifdef CONFIG_SERVERIP "serverip=" __stringify(CONFIG_SERVERIP) "\0" #endif @@ -156,9 +160,6 @@ +#endif +#ifdef CONFIG_BBL + "bbl=" CONFIG_BBL "\0" -+#endif -+#ifdef CONFIG_BDTB -+ "bdtb=" CONFIG_BDTB "\0" +#endif +#ifdef CONFIG_BKR + "bkr=" CONFIG_BKR "\0" @@ -181,7 +182,7 @@ #endif diff -Nuar u-boot-at91/Makefile u-boot-at91-sama5d4/Makefile --- u-boot-at91/Makefile 2019-08-04 21:52:12.000000000 +0800 -+++ u-boot-at91-sama5d4/Makefile 2019-08-22 11:46:09.222742538 +0800 ++++ u-boot-at91-sama5d4/Makefile 2019-08-22 19:29:07.323275389 +0800 @@ -194,6 +194,9 @@ ######################################################################### diff --git a/linux-bsp/tarballs/partition.txt b/linux-bsp/tarballs/partition.txt new file mode 100644 index 0000000..87e8146 --- /dev/null +++ b/linux-bsp/tarballs/partition.txt @@ -0,0 +1,11 @@ + +MT29F4G08: PageSize=2K(0x800) BlockSize=2(Planes)*64Pages=256K(0x40000) Total: 256M(0x1000,0000) ++------------------------------------------------------------------------------------------------------- + ImageName ImageSize LoadAddress Size + bootstrap-sama5d4.bin 0x313C 0x000000 0x040000(256K) + u-boot-sama5d4.bin 0x4A37C 0x040000 0x0C0000(512K) + u-boot-env(backup) 0x20000 0x0C0000 0x040000(256K) + + linuxrom-sama5d4.bin 0x4A51E8 0x100000 0x700000(7M) + rootfs-sama5d4.ubi 0x4240000 0x800000 0xc800000(200M) + Apps Partition 48M 0xD000000 0x3000000(48M) diff --git a/tools/sama5d4_xplained-Loader.zip b/tools/sama5d4_xplained-Loader.zip deleted file mode 100644 index 71e870d..0000000 --- a/tools/sama5d4_xplained-Loader.zip +++ /dev/null Binary files differ diff --git a/tools/sama5d4_xplained_loader/ReadMe.txt b/tools/sama5d4_xplained_loader/ReadMe.txt new file mode 100644 index 0000000..0972044 --- /dev/null +++ b/tools/sama5d4_xplained_loader/ReadMe.txt @@ -0,0 +1,16 @@ +This project used to autoload bootstrap, u-boot, linux, rootfs image files in folder images into Nandflash by xxx.bat, and it's configured in xxx.qml. + +Load Files in images folder: + +MT29F4G08: PageSize=2K(0x800) BlockSize=2(Planes)*64Pages=256K(0x40000) Total: 256M(0x1000,0000) ++------------------------------------------------------------------------------------------------------- + ImageName ImageSize LoadAddress Size + bootstrap-sama5d4.bin 0x313C 0x000000 0x040000(256K) + u-boot-sama5d4.bin 0x4A37C 0x040000 0x0C0000(512K) + u-boot-env(backup) 0x20000 0x0C0000 0x040000(256K) + + linuxrom-sama5d4.bin 0x4A51E8 0x100000 0x700000(7M) + rootfs-sama5d4.ubi 0x4240000 0x800000 0xc800000(200M) + Apps Partition 48M 0xD000000 0x3000000(48M) + + \ No newline at end of file diff --git a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.bat b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.bat new file mode 100644 index 0000000..982912b --- /dev/null +++ b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.bat @@ -0,0 +1,2 @@ +sam-ba -x demo_linux_nandflash_system.qml > logfile.log 2>&1 +notepad logfile.log diff --git a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qml b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qml new file mode 100644 index 0000000..7133bf0 --- /dev/null +++ b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qml @@ -0,0 +1,76 @@ +import SAMBA 3.2 +import SAMBA.Connection.Serial 3.2 +import SAMBA.Device.SAMA5D4 3.2 + +SerialConnection { + + device: SAMA5D4Xplained { + config { + nandflash { + header: 0xc1e04e07 + } + } + } + + function initNand() { + /* Placeholder: Nothing to do */ + } + + function getEraseSize(size) { + /* get smallest erase block size supported by applet */ + var eraseSize + for (var i = 0; i <= 32; i++) { + eraseSize = 1 << i + if ((applet.eraseSupport & eraseSize) !== 0) + break; + } + eraseSize *= applet.pageSize + + /* round up file size to erase block size */ + return (size + eraseSize - 1) & ~(eraseSize - 1) + } + + function eraseWrite(offset, filename, bootfile) { + /* get file size */ + var file = File.open(filename, false) + var size = file.size() + file.close() + + applet.erase(offset, getEraseSize(size)) + applet.write(offset, filename, bootfile) + } + + onConnectionOpened: { + var bootstrapFileName = "images/bootstrap-sama5d4.bin" + var ubootFileName = "images/u-boot-sama5d4.bin" + var linuxFileNmae = "images/linuxrom-sama5d4.itb" + var rootfsFileNmae = "images/rootfs-sama5d4.ubi" + + print("-I- === Initilize low level (system clocks) ===") + initializeApplet("lowlevel") + + print("-I- === Initialize extram ===") + initializeApplet("extram") + + print("-I- === Initialize nandflash access ===") + initializeApplet("nandflash") + + print("-I- === Erase nandflash access ===") + //applet.erase(0, 0x100000) + applet.erase() + + print("-I- === Load AT91Bootstrap ===") + eraseWrite(0x000000, bootstrapFileName, true) + + print("-I- === Load u-boot ===") + eraseWrite(0x040000, ubootFileName) + + print("-I- === Load linux kernel image ===") + applet.write(0x100000, linuxFileNmae) + + print("-I- === Load UBI rootfs image ===") + applet.write(0x800000, rootfsFileNmae) + + print("-I- === Done. ===") + } +} diff --git a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qmlc b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qmlc new file mode 100644 index 0000000..a33fabc --- /dev/null +++ b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qmlc Binary files differ diff --git a/tools/setup_env.sh b/tools/setup_env.sh index 8e1df3f..00590a5 100755 --- a/tools/setup_env.sh +++ b/tools/setup_env.sh @@ -55,7 +55,7 @@ help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf \ automake groff curl lzop asciidoc lib32z1 lib32ncurses5" - devtools="u-boot-tools mtd-utils " + devtools="u-boot-tools mtd-utils device-tree-compiler" msg_banner "start apt-get install system devlopment tools(commands)" -- Gitblit v1.9.1