diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/conf/layer.conf b/conf/layer.conf index 61a302c..2637d89 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -24,4 +24,5 @@ LAYERVERSION_stm-st-stm32mp = "1" LAYERSERIES_COMPAT_stm-st-stm32mp = "thud" # for optee-os-stm32mp dependency -LAYERDEPENDS_stm-st-stm32mp = "meta-python" \ No newline at end of file +LAYERDEPENDS_stm-st-stm32mp = "meta-python" + diff --git a/recipes-bsp/trusted-firmware-a/tf-a-stm32mp/README.HOW_TO.txt b/recipes-bsp/trusted-firmware-a/tf-a-stm32mp/README.HOW_TO.txt index ddb6dee..3039a77 100644 --- a/recipes-bsp/trusted-firmware-a/tf-a-stm32mp/README.HOW_TO.txt +++ b/recipes-bsp/trusted-firmware-a/tf-a-stm32mp/README.HOW_TO.txt @@ -22,7 +22,7 @@ If you have never configured you git configuration: 2. Initialise cross-compilation via SDK: --------------------------------------- Source SDK environment: - $> source /environment-setup-cortexa9hf-neon-openstlinux_weston-linux-gnueabi + $> source /environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi To verify if your cross-compilation environment have put in place: $> set | grep CROSS @@ -40,6 +40,7 @@ and apply the patch. $> tar xfj .tar.bz2 or $> tar xfJ .tar.xz +A new directory containing tf-a standard source code will be created, go into it: $> cd NB: if there is no git management on source code and you would like to have a diff --git a/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.0.bb b/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.0.bb index 2dd9a44..7933bba 100644 --- a/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.0.bb +++ b/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_2.0.bb @@ -11,7 +11,8 @@ SRC_URI += " \ file://0001-st-update-r1.patch \ " -PV = "2.0" +TF_VERSION = "2.0" +PV = "${TF_VERSION}" S = "${WORKDIR}/arm-trusted-firmware-${PV}" @@ -22,9 +23,10 @@ require tf-a-stm32mp-common.inc # --------------------------------- BBCLASSEXTEND = "devupstream:target" -SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/arm-trusted-firmware.git;protocol=https;branch=v2.0-stm32mp" +SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/arm-trusted-firmware.git;protocol=https;name=tfa;branch=v2.0-stm32mp" SRCREV_class-devupstream = "d0233623681124a85b069f97a447d7edb1cc1c02" - +SRCREV_FORMAT_class-devupstream = "tfa" +PV_class-devupstream = "${TF_VERSION}+github+${SRCPV}" # --------------------------------- # Configure default preference to manage dynamic selection between tarball and github # --------------------------------- diff --git a/recipes-bsp/u-boot/u-boot-stm32mp-common_2018.11.inc b/recipes-bsp/u-boot/u-boot-stm32mp-common_2018.11.inc index 9a2f21f..ab0627a 100644 --- a/recipes-bsp/u-boot/u-boot-stm32mp-common_2018.11.inc +++ b/recipes-bsp/u-boot/u-boot-stm32mp-common_2018.11.inc @@ -26,7 +26,8 @@ SRC_URI += " \ file://0008-ARM-v2018.11-stm32mp-r2-MISC.patch \ " -PV = "2018.11" +U_BOOT_VERSION = "2018.11" +PV = "${U_BOOT_VERSION}" S = "${WORKDIR}/u-boot-${PV}" @@ -35,8 +36,10 @@ S = "${WORKDIR}/u-boot-${PV}" # --------------------------------- BBCLASSEXTEND = "devupstream:target" -SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/u-boot.git;protocol=https;branch=v2018.11-stm32mp" +SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/u-boot.git;name=uboot;protocol=https;branch=v2018.11-stm32mp" SRCREV_class-devupstream = "a120b9bdb3e656bb2f0485924d77d58e2281311a" +SRCREV_FORMAT_class-devupstream = "uboot" +PV_class-devupstream = "${U_BOOT_VERSION}+github+${SRCPV}" # --------------------------------- # Configure default preference to manage dynamic selection between tarball and github diff --git a/recipes-bsp/u-boot/u-boot-stm32mp/README.HOW_TO.txt b/recipes-bsp/u-boot/u-boot-stm32mp/README.HOW_TO.txt index 126b196..952971c 100644 --- a/recipes-bsp/u-boot/u-boot-stm32mp/README.HOW_TO.txt +++ b/recipes-bsp/u-boot/u-boot-stm32mp/README.HOW_TO.txt @@ -22,10 +22,10 @@ If you have never configured you git configuration: $> git config --global user.name "your_name" $> git config --global user.email "your_email@example.com" -2. Initialise cross-compilation via SDK: +2. Initialize cross-compilation via SDK: --------------------------------------- * Source SDK environment: - $> source /environment-setup-cortexa9hf-neon-openstlinux_weston-linux-gnueabi + $> source /environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi * To verify if you cross-compilation environment are put in place: $> set | grep CROSS @@ -36,46 +36,88 @@ Warning: the environment are valid only on the shell session where you have 3. Prepare U-Boot source: ------------------------ -If you have the tarball and the list of patch then you must extract the -tarball and apply the patch. - $> tar xfz .tar.gz - or - $> tar xfj .tar.bz2 - or - $> tar xfJ .tar.xz - $> cd -NB: if there is no git management on source code and you would like to have a -git management on the code see section 4 [Management of U-Boot source code] - if there is some patch, please apply it on source code - $> for p in `ls -1 /*.patch`; do patch -p1 < $p; done +Extract the sources from tarball, for example: +$> tar xfJ SOURCES-st-image-weston-openstlinux-weston-stm32mp1-*.tar.xz -4. Management of U-Boot source code: ------------------------------------ -If you like to have a better management of change made on U-Boot source, you -can use git: - $> tar xfz .tar.gz - $> cd +In the U-Boot source directory (sources/*/u-boot-stm32mp-2018.11-r0), +you have one U-Boot source tarball, the patches and one Makefile: + - v2018.11.tar.gz + - 000*.patch + - Makefile.sdk + +NB: if you would like to have a git management on the code see + section 4 [Management of U-Boot source code with GIT] + +Then you must extract the tarball and apply the patch: + + $> tar xfz v2018.11.tar.gz + $> cd u-boot-2018.11 + $> for p in `ls -1 ../*.patch`; do patch -p1 < $p; done + +4. Management of U-Boot source code with GIT +-------------------------------------------- +If you like to have a better management of change made on U-Boot source, +you have 3 solutions to use git + +4.1 Get STMicroelectronics U-Boot source from GitHub + + URL: https://github.com/STMicroelectronics/u-boot.git + Branch: v2018.11-stm32mp + Revision: v2018.11-stm32mp-r2 + + $> git clone https://github.com/STMicroelectronics/u-boot.git + $> git checkout -b WORKING v2018.11-stm32mp-r2 + +4.2 Create Git from tarball + + $> tar xvf v2018.11.tar.gz + $> cd u-boot-2018.11 $> test -d .git || git init . && git add . && git commit -m "U-Boot source code" && git gc $> git checkout -b WORKING - $> for p in `ls -1 /*.patch`; do git am $p; done + $> for p in `ls -1 ../*.patch`; do git am $p; done + +4.3 Get Git from community and apply STMicroelectronics patches -NB: you can use directly the source from the community: URL: git://git.denx.de/u-boot.git - Branch: ##GIT_BRANCH## - Revision: ##GIT_SRCREV## + Branch: master + Revision: v2018.11 $> git clone git://git.denx.de/u-boot.git - $> cd - $> git checkout -b WORKING ##GIT_SRCREV## - $> for p in `ls -1 /*.patch`; do git am $p; done +or + $> git clone http://git.denx.de/u-boot.git + + $> cd u-boot + $> git checkout -b WORKING v2018.11 + $> for p in `ls -1 ../*.patch`; do git am $p; done 5. Compilation U-Boot source code: --------------------------------- +---------------------------------- To compile U-Boot source code, first move to U-Boot source: - $> cd + $> cd u-boot-2018.11 + or + $> cd u-boot -You can call the specific 'Makefile.sdk' provided to compile U-Boot: +5.1 Compilation for one target (one defconfig, one device tree) + + see /board/st/stm32mp1/README for details + + # make stm32mp15__defconfig + # make DEVICE_TREE= all + + example: + + a) trusted boot on ev1 + # make stm32mp15_trusted_defconfig + # make DEVICE_TREE=stm32mp157c-ev1 all + + b) basic boot on dk2 + # make stm32mp15_basic_defconfig + # make DEVICE_TREE=stm32mp157c-dk2 all + +5.2 Compilation for several targets: use Makefile.sdk + +Calls the specific 'Makefile.sdk' provided to compile U-Boot: - Display 'Makefile.sdk' file default configuration and targets: $> make -f $PWD/../Makefile.sdk help - Compile default U-Boot configuration: @@ -90,6 +132,32 @@ variables 'DEVICE_TREE' and 'UBOOT_CONFIGS': is the name append to u-boot binaries (ex: 'trusted', 'basic', etc) is the u-boot binary to export (ex: 'u-boot.bin', 'u-boot.stm32', etc) ex: UBOOT_CONFIGS=",basic,u-boot.bin ,trusted,u-boot.stm32" + +The generated binary files are available in ../build-${config}. + +by default we define 3 configs: basic, trusted, optee +for the 4 board : stm32mp157a-dk1 stm32mp157c-dk2 stm32mp157c-ed1 stm32mp157c-ev1 + +The generated files are: + +../build-trusted + u-boot-stm32mp157a-dk1-trusted.stm32 + u-boot-stm32mp157c-dk2-trusted.stm32 + u-boot-stm32mp157c-ed1-trusted.stm32 + u-boot-stm32mp157c-ev1-trusted.stm32 + +../build-optee + u-boot-stm32mp157a-dk1-optee.stm32 + u-boot-stm32mp157c-dk2-optee.stm32 + u-boot-stm32mp157c-ed1-optee.stm32 + u-boot-stm32mp157c-ev1-optee.stm32 + +../build-basic + u-boot-stm32mp157a-dk1-basic.img & u-boot-spl.stm32-stm32mp157a-dk1-basic + u-boot-stm32mp157c-dk2-basic.img & u-boot-spl.stm32-stm32mp157c-dk2-basic + u-boot-stm32mp157c-ed1-basic.img & u-boot-spl.stm32-stm32mp157c-ed1-basic + u-boot-stm32mp157c-ev1-basic.img & u-boot-spl.stm32-stm32mp157c-ev1-basic + You can override the default U-Boot configuration if you specify these variables: - Compile default U-Boot configuration but applying specific devicetree(s): $> make -f $PWD/../Makefile.sdk all DEVICE_TREE=" " @@ -100,23 +168,27 @@ You can override the default U-Boot configuration if you specify these variables 6. Update software on board: ---------------------------- + +see also /board/st/stm32mp1/README + 6.1. partitioning of binaries: ------------------------------ -There are two possible configurations available: -- Basic configuration -- Trusted configuration +------------------------------ + +There are two possible boot chains available: +- Basic boot chain (for basic configuration) +- Trusted boot chain (for trusted and optee configuration) U-Boot build provides binaries for each configuration: -- Basic configuration: U-Boot SPL and U-Boot imgage (for FSBL and SSBL) -- Trusted configuration: U-Boot binary with ".stm32" extension (for SSBL) +- Basic boot chain: U-Boot SPL and U-Boot imgage (for FSBL and SSBL) +- Trusted boot chain: U-Boot binary with ".stm32" extension (for SSBL, FSBL is provided by TF-A) -Basic configuration: +6.1.1. Basic boot chain: On this configuration, we use U-Boot SPL as First Stage Boot Loader (FSBL) and U-Boot as Second Stage Boot Loader (SSBL). -U-Boot SPL (u-boot-spl*.stm32) MUST be copied on a dedicated partition named "fsbl1" +U-Boot SPL (u-boot-spl.stm32-*) MUST be copied on a dedicated partition named "fsbl1" U-Boot image (u-boot*.img) MUST be copied on a dedicated partition named "ssbl" -Trusted configuration: +6.1.2. Trusted boot chain: On this configuration, U-Boot is associated to Trusted Firmware (TF-A) and only U-Boot image is used as Second Stage Boot Loader (SSBL). TF-A binary (tf-a-*.stm32) MUST be copied on a dedicated partition named "fsbl1" @@ -124,8 +196,9 @@ U-boot binary (u-boot*.stm32) MUST be copied on a dedicated partition named "ssb 6.2. Update via SDCARD: ----------------------- -Basic configuration -* u-boot-spl*.stm32 + +6.2.1. Basic boot chain +* u-boot-spl.stm32-* Copy the binary on the dedicated partition, on SDCARD/USB disk the partition "fsbl1" is the partition 1: - SDCARD: /dev/mmcblkXp1 (where X is the instance number) @@ -139,7 +212,7 @@ Basic configuration - SDCARD via USB reader: /dev/sdX3 (where X is the instance number) dd if= of=/dev/ bs=1M conv=fdatasync -Trusted configuration +6.2.2. Trusted boot chain * tf-a-*.stm32 Copy the binary on the dedicated partition, on SDCARD/USB disk the partition "fsbl1" is the partition 1: @@ -154,7 +227,8 @@ Trusted configuration - SDCARD via USB reader: /dev/sdX3 (where X is the instance number) dd if= of=/dev/ bs=1M conv=fdatasync -FAQ: to found the partition associated to a specific label, just plug the +6.2.3. FAQ +to found the partition associated to a specific label, just plug the SDCARD/USB disk on your PC and call the following command: $> ls -l /dev/disk/by-partlabel/ total 0 @@ -167,6 +241,19 @@ lrwxrwxrwx 1 root root 10 Jan 17 17:38 userfs -> ../../mmcblk0p6 6.3. Update via USB mass storage on U-Boot: ------------------------------------------- + +We are using the U-Boot command ums + +STM32MP> help ums + ums - Use the UMS [USB Mass Storage] + + Usage: + ums [] e.g. ums 0 mmc 0 + devtype defaults to mmc + ums + +By default on STMicroelectronics board, "mmc 0" is SD card on SDMMC1. + * Plug the SDCARD on Board. * Start the board and stop on U-Boot shell: Hit any key to stop autoboot: 0 @@ -174,10 +261,8 @@ lrwxrwxrwx 1 root root 10 Jan 17 17:38 userfs -> ../../mmcblk0p6 * plug an USB cable between the PC and the board via USB OTG port. * On U-Boot shell, call the usb mass storage functionality: STM32MP> ums 0 mmc 0 - ums - ex.: - ums 0 mmc 0 - ums 0 usb 0 +* After a delay (of up to 15 seconds), the host sees the exported block device. +* Follow section 6.2 to put U-Boot SPL binary and U-Boot binary + (*.img or *.stm32) on SDCARD/USB disk. -* Follow section 6.2 to put U-Boot SPL binary and U-Boot binary (*.img or *.stm32) - on SDCARD/USB disk. +PS: A Ctrl-C is needed to stop the command. diff --git a/recipes-kernel/linux/linux-stm32mp/README.HOW_TO.txt b/recipes-kernel/linux/linux-stm32mp/README.HOW_TO.txt index 224037b..719f2ce 100644 --- a/recipes-kernel/linux/linux-stm32mp/README.HOW_TO.txt +++ b/recipes-kernel/linux/linux-stm32mp/README.HOW_TO.txt @@ -32,7 +32,7 @@ If you have never configured your git configuration, run the following commands: 2. Initialise cross-compilation via SDK: ---------------------------------------- Source SDK environment: - $> source /environment-setup-cortexa9hf-neon-openstlinux_weston-linux-gnueabi + $> source /environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi To verify if your cross-compilation environment has been put in place correctly, run the following command: @@ -51,8 +51,9 @@ tarball and apply the patches. $> tar xfj .tar.bz2 or $> tar xfJ .tar.xz - +A new directory containing kernel standard source code will be created, go into it: $> cd + NB: if you like to have a git management of the code, see section 4 [Manage the kernel source code] if there is some patch, please apply it on source code diff --git a/recipes-kernel/linux/linux-stm32mp_4.19.bb b/recipes-kernel/linux/linux-stm32mp_4.19.bb index ad1656f..06af78e 100644 --- a/recipes-kernel/linux/linux-stm32mp_4.19.bb +++ b/recipes-kernel/linux/linux-stm32mp_4.19.bb @@ -92,8 +92,10 @@ S = "${WORKDIR}/linux-4.19.9" # --------------------------------- BBCLASSEXTEND = "devupstream:target" -SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/linux.git;protocol=https;branch=v${LINUX_VERSION}-stm32mp" +SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/linux.git;protocol=https;branch=v${LINUX_VERSION}-stm32mp;name=linux" SRCREV_class-devupstream = "196201973b7048ccf75aa63ac3c3673f8b6ee1c1" +SRCREV_FORMAT_class-devupstream = "linux" +PV_class-devupstream = "${LINUX_VERSION}+github+${SRCPV}" # --------------------------------- # Configure default preference to manage dynamic selection between tarball and github diff --git a/recipes-security/optee/optee-os-stm32mp.inc b/recipes-security/optee/optee-os-stm32mp.inc index 85d7d6c..b108555 100644 --- a/recipes-security/optee/optee-os-stm32mp.inc +++ b/recipes-security/optee/optee-os-stm32mp.inc @@ -60,6 +60,10 @@ OPTEE_HEADER = "tee-header_v2" OPTEE_PAGEABLE = "tee-pageable_v2" OPTEE_PAGER = "tee-pager_v2" OPTEE_SUFFIX = "stm32" +# Output the ELF generated +ELF_DEBUG_ENABLE ?= "" +OPTEE_ELF = "tee" +OPTEE_ELF_SUFFIX = "elf" do_deploy() { install -d ${DEPLOYDIR} @@ -68,11 +72,17 @@ do_deploy() { install -m 644 ${B}/${conf}/core/${OPTEE_HEADER}.${OPTEE_SUFFIX} ${DEPLOYDIR}/${OPTEE_HEADER}-${conf}-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} install -m 644 ${B}/${conf}/core/${OPTEE_PAGER}.${OPTEE_SUFFIX} ${DEPLOYDIR}/${OPTEE_PAGER}-${conf}-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} install -m 644 ${B}/${conf}/core/${OPTEE_PAGEABLE}.${OPTEE_SUFFIX} ${DEPLOYDIR}/${OPTEE_PAGEABLE}-${conf}-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} + if [ -n "${ELF_DEBUG_ENABLE}" ]; then + install -m 644 ${B}/${conf}/core/${OPTEE_ELF}.${OPTEE_ELF_SUFFIX} ${DEPLOYDIR}/${OPTEE_ELF}-${conf}-${OPTEE_BOOTCHAIN}.${OPTEE_ELF_SUFFIX} + fi done else install -m 644 ${B}/core/${OPTEE_HEADER}.${OPTEE_SUFFIX} ${DEPLOYDIR}/${OPTEE_HEADER}-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} install -m 644 ${B}/core/${OPTEE_PAGER}.${OPTEE_SUFFIX} ${DEPLOYDIR}/${OPTEE_PAGER}-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} install -m 644 ${B}/core/${OPTEE_PAGEABLE}.${OPTEE_SUFFIX} ${DEPLOYDIR}/${OPTEE_PAGEABLE}-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} + if [ -n "${ELF_DEBUG_ENABLE}" ]; then + install -m 644 ${B}/core/${OPTEE_ELF}.${OPTEE_ELF_SUFFIX} ${DEPLOYDIR}/${OPTEE_ELF}-${OPTEE_BOOTCHAIN}.${OPTEE_ELF_SUFFIX} + fi fi } addtask deploy before do_build after do_compile diff --git a/recipes-security/optee/optee-os-stm32mp_3.3.0.bb b/recipes-security/optee/optee-os-stm32mp_3.3.0.bb index 5a34e67..3147109 100644 --- a/recipes-security/optee/optee-os-stm32mp_3.3.0.bb +++ b/recipes-security/optee/optee-os-stm32mp_3.3.0.bb @@ -14,7 +14,8 @@ SRC_URI += " \ require optee-os-stm32mp.inc -PV = "3.3.0" +OPTEE_VERSION = "3.3.0" +PV = "${OPTEE_VERSION}" S = "${WORKDIR}/optee_os-${PV}" @@ -29,8 +30,10 @@ do_configure_prepend(){ # --------------------------------- BBCLASSEXTEND = "devupstream:target" -SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/optee_os.git;protocol=https;branch=3.3.0-stm32mp" +SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/optee_os.git;protocol=https;name=opteeos;branch=3.3.0-stm32mp" SRCREV_class-devupstream = "5f5cc70dfd04419be2ba66b87f41584b6136118c" +SRCREV_FORMAT_class-devupstream = "opteeos" +PV_class-devupstream = "${OPTEE_VERSION}+github+${SRCPV}" # --------------------------------- # Configure default preference to manage dynamic selection between tarball and github diff --git a/recipes-security/optee/optee-os/README.HOW_TO.txt b/recipes-security/optee/optee-os/README.HOW_TO.txt index 210bcba..bac8d42 100644 --- a/recipes-security/optee/optee-os/README.HOW_TO.txt +++ b/recipes-security/optee/optee-os/README.HOW_TO.txt @@ -43,7 +43,9 @@ tarball and apply the patch. $> tar xfj .tar.bz2 or $> tar xfJ .tar.xz +A new directory containing optee standard source code will be created, go into it: $> cd + NB: if there is no git management on source code and you would like to have a git management on the code see section 4 [Management of optee-os source code] if there is some patch, please apply it on source code