File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ case " $1 " in
4+ start)
5+ if [ -e /usr/sbin/tee-supplicant -a -e /dev/teepriv0 ]; then
6+ echo " Starting tee-supplicant..."
7+ tee-supplicant &
8+ ifconfig lo up &
9+ exit 0
10+ else
11+ echo " tee-supplicant or TEE device not found"
12+ exit 1
13+ fi
14+ ;;
15+
16+ stop)
17+ killall tee-supplicant
18+ ;;
19+
20+ status)
21+ cat /dev/teepriv0 2>&1 | grep -q " Device or resource busy" || not=" not "
22+ echo " tee-supplicant is ${not} active"
23+ ;;
24+ esac
Original file line number Diff line number Diff line change 11FW_TEXT_START := 0xc0000000
2- UIMAGE_AE_CMD := -a 0xc0400000 -e 0xc0400000
2+ OPTEE_OS_TZDRAM_START := 0xc0800000
3+ OPTEE_OS_TZDRAM_SIZE := 0x800000
4+ OPTEE_OS_SHMEM_START := 0xc0200000
5+ OPTEE_OS_SHMEM_SIZE := 0x200000
6+ OPTEE_PLIC_BASE := 0x4000000
37# Need Nuclei Qemu >= 2023.10
48QEMU_MACHINE_OPTS := -M nuclei_evalsoc,download=flashxip -smp 8 -m 2G
59# initramfs pre command before generate initrd ramfs
Original file line number Diff line number Diff line change @@ -40,5 +40,6 @@ BR2_PACKAGE_MTD_JFFS2DUMP=y
4040BR2_PACKAGE_MTD_MKFSJFFS2=y
4141BR2_PACKAGE_MTD_MTDPART=y
4242BR2_PACKAGE_MINICOM=y
43+ BR2_PACKAGE_OPENSSL=y
4344# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
4445BR2_PACKAGE_LRZSZ=y
Original file line number Diff line number Diff line change @@ -68,9 +68,10 @@ CONFIG_MMC_SPI=y
6868# CONFIG_VIRTIO_MENU is not set
6969# CONFIG_VHOST_MENU is not set
7070CONFIG_MAILBOX=y
71- CONFIG_NUCLEI_MAILBOX=y
7271# CONFIG_IOMMU_SUPPORT is not set
7372# CONFIG_NVMEM is not set
73+ CONFIG_TEE=y
74+ CONFIG_OPTEE=y
7475CONFIG_EXT3_FS=y
7576CONFIG_JFS_FS=y
7677CONFIG_F2FS_FS=y
@@ -89,7 +90,6 @@ CONFIG_CRYPTO_RSA=y
8990CONFIG_CRYPTO_SEQIV=y
9091CONFIG_CRYPTO_ECHAINIV=y
9192CONFIG_CRYPTO_DEFLATE=y
92- CONFIG_CRYPTO_DEV_NUCLEI=y
9393CONFIG_PRINTK_TIME=y
9494# CONFIG_DEBUG_MISC is not set
9595# CONFIG_SLUB_DEBUG is not set
Original file line number Diff line number Diff line change 166166 };
167167 };
168168
169- memory@c0000000 {
169+ memory@c1000000 {
170170 device_type = "memory";
171- reg = <0x0 0xc0000000 0x0 0x3E000000 >;
171+ reg = <0x0 0xc1000000 0x0 0x3D000000 >;
172172 };
173173
174174 soc {
301301 mboxes = <&mailbox 0>;
302302 status = "okay";
303303 };
304+
305+ firmware {
306+ optee {
307+ compatible = "linaro,optee-tz";
308+ method = "smc";
309+ };
310+ };
311+
304312};
Original file line number Diff line number Diff line change @@ -19,14 +19,22 @@ static const struct fdt_match nuclei_evalsoc_match[] = {
1919 { .compatible = "nuclei,eval-soc" },
2020 { },
2121};
22-
22+ extern void sm_init (bool cold_boot );
23+ extern void opteed_cpu_on_handler (uint32_t linear_id );
2324static int nuclei_evalsoc_final_init (bool cold_boot ,
2425 const struct fdt_match * match )
2526{
2627 unsigned long smpcc_base = 0 , smpcc_cfg ;
27- if (cold_boot ) { // Add cold boot initial steps
28- }
28+ if (!cold_boot ) { // Add cold boot initial steps
29+ /* warm boot to setup optee ctx for secondary cpu */
30+ unsigned int secondary_hartid ;
2931
32+ secondary_hartid = current_hartid ();
33+ opteed_cpu_on_handler (secondary_hartid );
34+
35+ return 0 ;
36+ }
37+ sm_init (cold_boot );
3038 // Check mcfg_info.tee to see whether tee present
3139 if (csr_read (0xfc2 ) & 0x1 ) {
3240 // Enable U-Mode to access all regions by setting spmpcfg0 and spmpaddr0
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ test -z "${kernelimg}" && setenv kernelimg ${bootloc}/kernel.itb
33
44echo " Boot images located in ${bootloc}"
55echo " Loading kernel: ${kernelimg}"
6- fatload mmc 0 0xc3000000 ${kernelimg}
6+ fatload mmc 0 0xc4000000 ${kernelimg}
77echo " Starts booting from SD"
8- bootm 0xc3000000 :kernel 0xc3000000 :ramdisk 0xc8000000
8+ bootm 0xc4000000 :kernel 0xc4000000 :ramdisk 0xc8000000
Original file line number Diff line number Diff line change 1515 arch = "riscv";
1616 os = "linux";
1717 compression = "lz4";
18- load = <0xc0400000 >;
19- entry = <0xc0400000 >;
18+ load = <0xc1000000 >;
19+ entry = <0xc1000000 >;
2020 cipher {
2121 algo = "aes256";
22- key-name-hint = "aes256key_uboot ";
22+ key-name-hint = "aes_spl ";
2323 };
2424 signature {
2525 algo = "sha256,rsa2048";
26- key-name-hint = "uboot ";
26+ key-name-hint = "rsa_spl ";
2727 };
2828 };
2929 ramdisk{
3636 entry = <0x0>;
3737 cipher {
3838 algo = "aes256";
39- key-name-hint = "aes256key_uboot ";
39+ key-name-hint = "aes_spl ";
4040 };
4141 signature {
4242 algo = "sha256,rsa2048";
43- key-name-hint = "uboot ";
43+ key-name-hint = "rsa_spl ";
4444 };
4545 };
46+ fdt {
47+ description = "Firmware DTB";
48+ data = /incbin/("kernel.dtb");
49+ type = "flat_dt";
50+ arch = "riscv";
51+ load = <0x0 0xc8000000>;
52+ compression = "none";
53+ cipher {
54+ algo = "aes256";
55+ key-name-hint = "aes_spl";
56+ };
57+ signature {
58+ algo = "sha256,rsa2048";
59+ key-name-hint = "rsa_spl";
60+ };
61+ };
4662 };
4763
4864 configurations {
5167 description = "Boot Linux kernel with FDT blob";
5268 kernel = "kernel";
5369 ramdisk = "ramdisk";
70+ fdt = "fdt";
5471 };
5572 };
5673};
Original file line number Diff line number Diff line change 11CONFIG_RISCV=y
2- CONFIG_TEXT_BASE=0xc0200000
2+ CONFIG_TEXT_BASE=0xc1200000
33CONFIG_SYS_MALLOC_LEN=0xc00000
44CONFIG_NR_DRAM_BANKS=1
55CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
6- CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0200000
6+ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc1200000
77CONFIG_ENV_SIZE=0x20000
88CONFIG_SPL_DM_SPI=y
99CONFIG_SPL_STACK=0x80040000
@@ -13,7 +13,7 @@ CONFIG_SPL=y
1313CONFIG_SPL_FS_FAT=y
1414CONFIG_SPL_SPI_FLASH_SUPPORT=y
1515CONFIG_SPL_SPI=y
16- CONFIG_SYS_LOAD_ADDR=0xc0200000
16+ CONFIG_SYS_LOAD_ADDR=0xc1200000
1717CONFIG_SPL_PAYLOAD=""
1818CONFIG_BUILD_TARGET=""
1919CONFIG_TARGET_NUCLEI_GENERIC_SOC=y
@@ -65,6 +65,7 @@ CONFIG_CMD_LOG=y
6565CONFIG_SYS_RELOC_GD_ENV_ADDR=y
6666# CONFIG_NET is not set
6767CONFIG_NUCLEI_HSM_AES=y
68+ CONFIG_NUCLEI_HSM_SHA=y
6869CONFIG_NUCLEI_HSM_RSA=y
6970CONFIG_DM_MTD=y
7071CONFIG_SPI_FLASH_ATMEL=y
@@ -78,5 +79,7 @@ CONFIG_SPI_FLASH_WINBOND=y
7879# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
7980CONFIG_FAT_WRITE=y
8081CONFIG_REGEX=y
82+ CONFIG_SHA_HW_ACCEL=y
83+ CONFIG_SHA_PROG_HW_ACCEL=y
8184CONFIG_HEXDUMP=y
8285# CONFIG_EFI_LOADER is not set
Original file line number Diff line number Diff line change 1616 compression = "none";
1717 cipher {
1818 algo = "aes256";
19- key-name-hint = "aes256key_spl ";
19+ key-name-hint = "aes_spl ";
2020 };
2121 signature {
2222 algo = "sha256,rsa2048";
23- key-name-hint = "spl ";
23+ key-name-hint = "rsa_spl ";
2424 };
2525 };
2626
27- uboot {
28- description = "U-Boot ";
29- data = /incbin/("u-boot .bin");
27+ optee {
28+ description = "OP-TEE ";
29+ data = /incbin/("optee .bin");
3030 type = "standalone";
3131 arch = "riscv";
32- os = "U-Boot";
33- load = <0x0 0xc0200000>;
32+ os = "tee";
33+ load = <0x0 0xc0800000>;
34+ entry = <0x0 0xc0800000>;
3435 compression = "none";
3536 cipher {
3637 algo = "aes256";
37- key-name-hint = "aes256key_spl ";
38+ key-name-hint = "aes_spl ";
3839 };
3940 signature {
4041 algo = "sha256,rsa2048";
41- key-name-hint = "spl ";
42+ key-name-hint = "rsa_spl ";
4243 };
4344 };
4445
45- fdt {
46- description = "Firmware DTB ";
47- data = /incbin/("fdt.dtb ");
48- type = "flat_dt ";
46+ uboot {
47+ description = "U-Boot ";
48+ data = /incbin/("u-boot.bin ");
49+ type = "standalone ";
4950 arch = "riscv";
50- load = <0x0 0xc8000000>;
51+ os = "U-Boot";
52+ load = <0x0 0xc1200000>;
53+ entry = <0x0 0xc1200000>;
5154 compression = "none";
5255 cipher {
5356 algo = "aes256";
54- key-name-hint = "aes256key_spl ";
57+ key-name-hint = "aes_spl ";
5558 };
5659 signature {
5760 algo = "sha256,rsa2048";
58- key-name-hint = "spl ";
61+ key-name-hint = "rsa_spl ";
5962 };
6063 };
6164 };
6669 boot {
6770 description = "UBoot SPL";
6871 firmware = "opensbi";
69- loadables = "uboot";
70- fdt = "fdt";
72+ loadables = "uboot","optee";
7173 };
7274 };
7375};
You can’t perform that action at this time.
0 commit comments