Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling linaro-swg kernel with custom kernel config #3916

Closed
geneva1 opened this issue Jun 5, 2020 · 18 comments
Closed

Error compiling linaro-swg kernel with custom kernel config #3916

geneva1 opened this issue Jun 5, 2020 · 18 comments
Labels

Comments

@geneva1
Copy link

geneva1 commented Jun 5, 2020

Why do I have the following issue when I build this linux kernel repo from within optee ?

This issue surfaced after I replaced build/kconfigs/qemu.conf with the .config file generated using make allyesconfig within linaro linux repo

  HDRTEST usr/include/linux/mpls_iptunnel.h
  HDRTEST usr/include/linux/kdev_t.h
  HDRTEST usr/include/linux/auto_dev-ioctl.h
  HDRTEST usr/include/linux/nexthop.h
  HDRTEST usr/include/linux/capi.h
  HDRTEST usr/include/linux/fpga-dfl.h
  HDRTEST usr/include/linux/tee.h
In file included from <command-line>:32:
./usr/include/linux/tee.h:139:13: error: expected declaration specifiers or ‘...’ before numeric constant
 } __aligned(8);
             ^
usr/include/Makefile:104: recipe for target 'usr/include/linux/tee.hdrtest' failed
make[3]: *** [usr/include/linux/tee.hdrtest] Error 1
scripts/Makefile.build:503: recipe for target 'usr/include' failed
make[2]: *** [usr/include] Error 2
Makefile:1693: recipe for target 'usr' failed
make[1]: *** [usr] Error 2
make[1]: Leaving directory '/home/rog/Downloads/optee_os/optee-qemu/linux'
common.mk:251: recipe for target 'linux-common' failed
make: *** [linux-common] Error 2
rog@rog-GL502VMK:~/Downloads/optee_os/optee-qemu/build$ 
@geneva1 geneva1 changed the title Error compiling a custom kernel with custom kernel config Error compiling linaro-swg kernel with custom kernel config Jun 5, 2020
@geneva1
Copy link
Author

geneva1 commented Jun 8, 2020

Problem solved by removing __aligned(8) from code snippet within optee_build_path/linux/usr/include/linux/tee.h

However, I am not entirely sure about the side effect of doing so.

struct tee_ioctl_shm_register_fd_data {
	__s64 fd;
	__u64 size;
	__u32 flags;
	__s32 id;
} __aligned(8);

@geneva1
Copy link
Author

geneva1 commented Jun 8, 2020

Why do I have the following error ?

Synchronous Exception at 0x000000007E1A1D98

make run-only
make[1]: Entering directory '/home/rog/Downloads/optee_os/optee-qemu/build'
ln -sf /home/rog/Downloads/optee_os/optee-qemu/build/../out-br/images/rootfs.cpio.gz /home/rog/Downloads/optee_os/optee-qemu/build/../out/bin/

* QEMU is now waiting to start the execution
* Start execution with either a 'c' followed by <enter> in the QEMU console or
* attach a debugger and continue from there.
*
* To run OP-TEE tests, use the xtest command in the 'Normal World' terminal
* Enter 'xtest -h' for help.

# Option “-x” is deprecated and might be removed in a later version of gnome-terminal.
# Option “-x” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
# Use “-- ” to terminate the options and put the command line to execute after it.
cd /home/rog/Downloads/optee_os/optee-qemu/build/../out/bin && /home/rog/Downloads/optee_os/optee-qemu/build/../qemu/aarch64-softmmu/qemu-system-aarch64 \
	-nographic \
	-serial tcp:localhost:54320 -serial tcp:localhost:54321 \
	-smp 2 \
	-s -S -machine virt,secure=on -cpu cortex-a57 \
	-d unimp -semihosting-config enable,target=native \
	-m 1057 \
	-bios bl1.bin \
	-initrd rootfs.cpio.gz \
	-kernel Image -no-acpi \
	-append 'console=ttyAMA0,38400 keep_bootcon root=/dev/vda2' \
	-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0,max-bytes=1024,period=1000 -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic
QEMU 5.0.0 monitor - type 'help' for more information
(qemu) c
(qemu) pflash_write: Write to buffer emulation is flawed
pflash_write: Write to buffer emulation is flawed

@geneva1
Copy link
Author

geneva1 commented Jun 8, 2020

After I removed the line -bios bl1.bin \ , there is no pflash error. However, I still could not reach login screen with the following log. Why ?

listening on port 54320
soc_term: accepted fd 4
soc_term: read fd EOF
soc_term: accepted fd 4
make run-only
make[1]: Entering directory '/home/rog/Downloads/optee_os/optee-qemu/build'
ln -sf /home/rog/Downloads/optee_os/optee-qemu/build/../out-br/images/rootfs.cpio.gz /home/rog/Downloads/optee_os/optee-qemu/build/../out/bin/

* QEMU is now waiting to start the execution
* Start execution with either a 'c' followed by <enter> in the QEMU console or
* attach a debugger and continue from there.
*
* To run OP-TEE tests, use the xtest command in the 'Normal World' terminal
* Enter 'xtest -h' for help.

# Option “-x” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
# Option “-x” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.
cd /home/rog/Downloads/optee_os/optee-qemu/build/../out/bin && /home/rog/Downloads/optee_os/optee-qemu/build/../qemu/aarch64-softmmu/qemu-system-aarch64 \
	-nographic \
	-serial tcp:localhost:54320 -serial tcp:localhost:54321 \
	-smp 2 \
	-s -S -machine virt,secure=on -cpu cortex-a57 \
	-d unimp -semihosting-config enable,target=native \
	-m 1057 \
	#-bios bl1.bin \
	-initrd rootfs.cpio.gz \
	-kernel Image -no-acpi \
	-append 'console=ttyAMA0,38400 keep_bootcon root=/dev/vda2' \
	-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0,max-bytes=1024,period=1000 -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic
QEMU 5.0.0 monitor - type 'help' for more information
(qemu) c
(qemu) 

@geneva1
Copy link
Author

geneva1 commented Jun 9, 2020

if I do not remove -bios bl1.bin but adding another line -d mmu , then I have longer log output (containing registers) but it is still not close to reaching the user login prompt :

Synchronous Exception at 0x000000007E1A1D98

D/TC:0 0 get_aslr_seed:1310 Cannot find valid kaslr-seed

https://github.com/OP-TEE/optee_os/blob/master/core/arch/arm/kernel/boot.c#L1309

listening on port 54321
soc_term: accepted fd 4
soc_term: read fd EOF
soc_term: accepted fd 4
D/TC:0 0 get_aslr_seed:1310 Cannot find valid kaslr-seed
D/TC:0 0 add_phys_mem:586 TEE_SHMEM_START type NSEC_SHM 0x42000000 size 0x00200000
D/TC:0 0 add_phys_mem:586 TA_RAM_START type TA_RAM 0x0e300000 size 0x00d00000
D/TC:0 0 add_phys_mem:586 VCORE_UNPG_RW_PA type TEE_RAM_RW 0x0e160000 size 0x001a0000
D/TC:0 0 add_phys_mem:586 VCORE_UNPG_RX_PA type TEE_RAM_RX 0x0e100000 size 0x00060000
D/TC:0 0 add_phys_mem:586 ROUNDDOWN(0x09040000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x09000000 size 0x00200000
D/TC:0 0 verify_special_mem_areas:524 No NSEC DDR memory area defined
D/TC:0 0 add_va_space:625 type RES_VASPACE size 0x00a00000
D/TC:0 0 add_va_space:625 type SHM_VASPACE size 0x02000000
D/TC:0 0 dump_mmap_table:737 type TEE_RAM_RX   va 0x0e100000..0x0e15ffff pa 0x0e100000..0x0e15ffff size 0x00060000 (smallpg)
D/TC:0 0 dump_mmap_table:737 type TEE_RAM_RW   va 0x0e160000..0x0e2fffff pa 0x0e160000..0x0e2fffff size 0x001a0000 (smallpg)
D/TC:0 0 dump_mmap_table:737 type TA_RAM       va 0x0e300000..0x0effffff pa 0x0e300000..0x0effffff size 0x00d00000 (smallpg)
D/TC:0 0 dump_mmap_table:737 type RES_VASPACE  va 0x0f000000..0x0f9fffff pa 0x00000000..0x009fffff size 0x00a00000 (pgdir)
D/TC:0 0 dump_mmap_table:737 type SHM_VASPACE  va 0x0fa00000..0x119fffff pa 0x00000000..0x01ffffff size 0x02000000 (pgdir)
D/TC:0 0 dump_mmap_table:737 type IO_SEC       va 0x11a00000..0x11bfffff pa 0x09000000..0x091fffff size 0x00200000 (pgdir)
D/TC:0 0 dump_mmap_table:737 type NSEC_SHM     va 0x11c00000..0x11dfffff pa 0x42000000..0x421fffff size 0x00200000 (pgdir)
D/TC:0 0 core_mmu_entry_to_finer_grained:762 xlat tables used 1 / 7
D/TC:0 0 core_mmu_entry_to_finer_grained:762 xlat tables used 2 / 7
D/TC:0 0 core_mmu_entry_to_finer_grained:762 xlat tables used 3 / 7
I/TC: 
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[0] with top at 0xe194ab8
D/TC:0 0 init_canaries:164 watch *0xe194abc
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[1] with top at 0xe1952f8
D/TC:0 0 init_canaries:164 watch *0xe1952fc
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[2] with top at 0xe195b38
D/TC:0 0 init_canaries:164 watch *0xe195b3c
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[3] with top at 0xe196378
D/TC:0 0 init_canaries:164 watch *0xe19637c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[0] with top at 0xe18dd38
D/TC:0 0 init_canaries:165 watch *0xe18dd3c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[1] with top at 0xe18e978
D/TC:0 0 init_canaries:165 watch *0xe18e97c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[2] with top at 0xe18f5b8
D/TC:0 0 init_canaries:165 watch *0xe18f5bc
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[3] with top at 0xe1901f8
D/TC:0 0 init_canaries:165 watch *0xe1901fc
D/TC:0 0 init_canaries:167 #Stack canaries for stack_thread[0] with top at 0xe192238
D/TC:0 0 init_canaries:167 watch *0xe19223c
D/TC:0 0 init_canaries:167 #Stack canaries for stack_thread[1] with top at 0xe194278
D/TC:0 0 init_canaries:167 watch *0xe19427c
D/TC:0 0 select_vector:956 SMCCC_ARCH_WORKAROUND_1 (0x80008000) available
D/TC:0 0 select_vector:957 SMC Workaround for CVE-2017-5715 used
I/TC: Non-secure external DT found
D/TC:0 0 carve_out_phys_mem:286 No need to carve out 0xe100000 size 0x200000
D/TC:0 0 carve_out_phys_mem:286 No need to carve out 0xe300000 size 0xd00000
I/TC: Switching console to device: /pl011@9040000
I/TC: OP-TEE version: 3.9.0-17-g0949602c (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #4 Fri Jun  5 06:21:57 UTC 2020 aarch64
D/TC:0 0 paged_init_primary:1175 Executing at offset 0 with virtual load address 0xe100000
D/TC:0 0 check_ta_store:635 TA store: "Secure Storage TA"
D/TC:0 0 check_ta_store:635 TA store: "REE"
D/TC:0 0 mobj_mapped_shm_init:447 Shared memory address range: fa00000, 11a00000
I/TC: Initialized
D/TC:0 0 paged_init_primary:1188 Primary CPU switching to normal world boot

@geneva1
Copy link
Author

geneva1 commented Jun 12, 2020

I tried https://wiki.osdev.org/Kernel_Debugging#Use_GDB_with_QEMU , but I have the following :

rog@rog-GL502VMK:~/Downloads/optee_os/optee-qemu/build$ sudo qemu-arm  /home/rog/Downloads/optee_os/optee-qemu/build/../linux/arch/arm64/boot/Image 
Error while loading /home/rog/Downloads/optee_os/optee-qemu/build/../linux/arch/arm64/boot/Image: Permission denied
rog@rog-GL502VMK:~/Downloads/optee_os/optee-qemu/build$ 

if I use qemu-system-aarch64 instead of qemu-arm , that permission denied error is gone
so the problem is still with Synchronous Exception at 0x000000007E1A1D98

@etienne-lms
Copy link
Contributor

Sorry, I don't think I can help here. Strange you get all those errors.
Maybe start back from scratch: clone optee qemu_v8.xml repo, make and make run-only to check it boots fine. Then start modifying Linux configuration and see by steps which changes break your setup.

@geneva1
Copy link
Author

geneva1 commented Jun 12, 2020

@etienne-lms

I followed your advice and redo from scratch, but I have the following error during make :

Using advice from #1476 (comment) does not help

Could you advise about #815 (comment) ?

Ran 263 tests in 1.024s

OK
make[2]: Leaving directory '/home/rog/optee_os/edk2/BaseTools/Tests'
make[1]: Leaving directory '/home/rog/optee_os/edk2/BaseTools'
Build environment: Linux-5.3.0-53-generic-x86_64-with-Ubuntu-18.04-bionic
Build start time: 17:26:43, Jun.12 2020

WORKSPACE        = /home/rog/optee_os/edk2
PACKAGES_PATH    = /home/rog/optee_os/edk2:
ECP_SOURCE       = /home/rog/optee_os/edk2/EdkCompatibilityPkg
EDK_SOURCE       = /home/rog/optee_os/edk2/EdkCompatibilityPkg
EFI_SOURCE       = /home/rog/optee_os/edk2/EdkCompatibilityPkg
EDK_TOOLS_PATH   = /home/rog/optee_os/build/../edk2/BaseTools
CONF_PATH        = /home/rog/optee_os/edk2/Conf


Architecture(s)  = AARCH64
Build target     = RELEASE
Toolchain        = GCC49

Active Platform          = /home/rog/optee_os/edk2/ArmVirtPkg/ArmVirtQemuKernel.dsc
Flash Image Definition   = /home/rog/optee_os/edk2/ArmVirtPkg/ArmVirtQemuKernel.fdf

Processing meta-data ............... done!
Building ... /home/rog/optee_os/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf [AARCH64]
make[1]: Entering directory '/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib'
Building ... /home/rog/optee_os/edk2/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf [AARCH64]
/bin/sh: 1: /home/rog/optee_os/build/../toolchains/aarch64/bin/aarch64-linux-gnu-gcc: not found
make[1]: *** [/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib/OUTPUT/BaseStackCheckGcc.obj] Error 127
"/home/rog/optee_os/build/../toolchains/aarch64/bin/aarch64-linux-gnu-gcc"   -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=BaseStackCheckLibStrings -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny -DMDEPKG_NDEBUG -DDISABLE_NEW_DEPRECATED_INTERFACES -mstrict-align -mgeneral-regs-only -c -o /home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib/OUTPUT/./BaseStackCheckGcc.obj -I/home/rog/optee_os/edk2/MdePkg/Library/BaseStackCheckLib -I/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib/DEBUG -I/home/rog/optee_os/edk2/MdePkg -I/home/rog/optee_os/edk2/MdePkg/Include -I/home/rog/optee_os/edk2/MdePkg/Include/AArch64 /home/rog/optee_os/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c
GNUmakefile:308: recipe for target '/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib/OUTPUT/BaseStackCheckGcc.obj' failed
make[1]: Leaving directory '/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib'


build.py...
 : error 7000: Failed to execute command
	make tbuild [/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib]
Building ... /home/rog/optee_os/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf [AARCH64]


build.py...
 : error 7000: Failed to execute command
	make tbuild [/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib]


build.py...
 : error 7000: Failed to execute command
	make tbuild [/home/rog/optee_os/edk2/Build/ArmVirtQemuKernel-AARCH64/RELEASE_GCC49/AARCH64/MdePkg/Library/DxeServicesLib/DxeServicesLib]


build.py...
 : error F002: Failed to build module
	/home/rog/optee_os/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf [AARCH64, GCC49, RELEASE]

- Failed -
Build end time: 17:27:00, Jun.12 2020
Build total time: 00:00:17

common.mk:278: recipe for target 'edk2-common' failed
make: *** [edk2-common] Error 1

@etienne-lms
Copy link
Contributor

ok, i see. You forgot make toolchains.
A full sequence could be:
repo init ... && repo sync && cd build && make toolchains && make all && make run-only

@geneva1
Copy link
Author

geneva1 commented Jun 12, 2020

@etienne-lms no, I downloaded both gcc-arm-8.3-2019.03 files manually because the online server connection is so not stable.

rog@rog-GL502VMK:~/optee_os/build$ cat toolchain.mk 
################################################################################
# Toolchains
################################################################################
ROOT				?= $(CURDIR)/..
TOOLCHAIN_ROOT 			?= $(ROOT)/toolchains

AARCH32_PATH 			?= $(TOOLCHAIN_ROOT)/aarch32
AARCH32_CROSS_COMPILE 		?= $(AARCH32_PATH)/bin/arm-linux-gnueabihf-
AARCH32_GCC_VERSION 		?= gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf
SRC_AARCH32_GCC 		?= https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/${AARCH32_GCC_VERSION}.tar.xz

AARCH64_PATH 			?= $(TOOLCHAIN_ROOT)/aarch64
AARCH64_CROSS_COMPILE 		?= $(AARCH64_PATH)/bin/aarch64-linux-gnu-
AARCH64_GCC_VERSION 		?= gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu
SRC_AARCH64_GCC 		?= https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/${AARCH64_GCC_VERSION}.tar.xz

# Download toolchain macro for saving some repetition
# $(1) is $AARCH.._PATH		: i.e., path to the destination
# $(2) is $SRC_AARCH.._GCC	: is the downloaded tar.gz file
# $(3) is $.._GCC_VERSION	: the name of the file to download
define dltc
	@if [ ! -d "$(1)" ]; then \
		mkdir -p $(1); \
		echo "Downloading $(3) ..."; \
		curl -s -L $(2) -o $(TOOLCHAIN_ROOT)/$(3).tar.xz; \
		tar xf $(TOOLCHAIN_ROOT)/$(3).tar.xz -C $(1) --strip-components=1; \
	fi
endef

.PHONY: toolchains
toolchains: aarch32 aarch64

.PHONY: aarch32
aarch32:
	$(call dltc,$(AARCH32_PATH),$(SRC_AARCH32_GCC),$(AARCH32_GCC_VERSION))

.PHONY: aarch64
aarch64:
	$(call dltc,$(AARCH64_PATH),$(SRC_AARCH64_GCC),$(AARCH64_GCC_VERSION))

CLANG_PATH			?= $(ROOT)/clang-9.0.1

# Download the Clang compiler with LLVM tools and compiler-rt libraries
define dl-clang
	@if [ ! -d "$(1)" ]; then \
		./get_clang.sh $(1); \
	else \
		echo "$(1) already exists"; \
	fi
endef

.PHONY: clang-toolchains
clang-toolchains:
	$(call dl-clang,$(CLANG_PATH))
rog@rog-GL502VMK:~/optee_os/build$ ls -al
total 216
drwxrwxr-x 12 rog rog  4096 Jun 12 17:25 .
drwxrwxr-x 26 rog rog  4096 Jun 12 17:15 ..
-rw-rw-r--  1 rog rog  1728 Jun 12 17:07 am43xx.mk
-rw-rw-r--  1 rog rog  1767 Jun 12 17:07 am57xx.mk
drwxrwxr-x  6 rog rog  4096 Jun 12 17:07 br-ext
-rw-rw-r--  1 rog rog 16780 Jun 12 17:07 common.mk
-rw-rw-r--  1 rog rog  1728 Jun 12 17:07 dra7xx.mk
drwxrwxr-x  3 rog rog  4096 Jun 12 17:07 fvp
-rw-rw-r--  1 rog rog  6841 Jun 12 17:07 fvp.mk
drwxr-xr-x  9 rog rog  4096 Mar 25  2019 gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu
drwxr-xr-x  9 rog rog  4096 Mar 25  2019 gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf
-rwxrwxr-x  1 rog rog  1713 Jun 12 17:07 get_clang.sh
drwxrwxr-x  2 rog rog  4096 Jun 12 17:07 .git
drwxrwxr-x  3 rog rog  4096 Jun 12 17:07 .github
-rw-rw-r--  1 rog rog    67 Jun 12 17:07 .gitignore
-rw-rw-r--  1 rog rog 12187 Jun 12 17:07 hikey960.mk
-rw-rw-r--  1 rog rog 12461 Jun 12 17:07 hikey.mk
-rw-rw-r--  1 rog rog  4117 Jun 12 17:07 juno.mk
drwxrwxr-x  2 rog rog  4096 Jun 12 17:07 kconfigs
lrwxrwxrwx  1 rog rog    10 Jun 12 17:07 Makefile -> qemu_v8.mk
-rw-rw-r--  1 rog rog  7629 Jun 12 17:07 poplar.mk
-rw-rw-r--  1 rog rog  3313 Jun 12 17:07 qemu-check.exp
-rw-rw-r--  1 rog rog  6550 Jun 12 17:07 qemu.mk
-rw-rw-r--  1 rog rog  7600 Jun 12 17:07 qemu_v8.mk
-rw-rw-r--  1 rog rog   551 Jun 12 17:07 README.md
drwxrwxr-x  4 rog rog  4096 Jun 12 17:07 rpi3
-rw-rw-r--  1 rog rog  9200 Jun 12 17:07 rpi3.mk
-rw-rw-r--  1 rog rog  7823 Jun 12 17:07 stm32mp1.mk
-rw-rw-r--  1 rog rog  5499 Jun 12 17:07 synquacer.mk
drwxrwxr-x  2 rog rog  4096 Jun 12 17:07 ti
-rw-rw-r--  1 rog rog  1869 Jun 12 17:07 toolchain.mk
-rw-rw-r--  1 rog rog  2542 Jun 12 17:07 .travis.yml
-rw-rw-r--  1 rog rog  6072 Jun 12 17:07 verdin.mk
drwxrwxr-x  7 rog rog  4096 Jun 12 17:07 zynqmp
-rw-rw-r--  1 rog rog  4141 Jun 12 17:07 zynqmp.mk
rog@rog-GL502VMK:~/optee_os/build$ 

@geneva1
Copy link
Author

geneva1 commented Jun 15, 2020

@etienne-lms The edk2-common error is due to wrong MANUAL (by me, not by toolchains.mk) extract location of both gcc-arm-8.3-2019.03 to /PATH_to_optee_os/build instead of /PATH_TO_optee_os/toolchains.

I can reach user login prompt without modifying any of the kernel configs.
But I still have the following log output:

QEMU 5.0.0 monitor - type 'help' for more information
(qemu) c
(qemu) pflash_write: Write to buffer emulation is flawed
pflash_write: Write to buffer emulation is flawed

So, the error is still with the synchronous exception.

@geneva1
Copy link
Author

geneva1 commented Jun 15, 2020

@etienne-lms Someone told me : that op is not implemented in qemu flash emulation

What does that mean ?

@etienne-lms
Copy link
Contributor

soory, i don't know.

@geneva1
Copy link
Author

geneva1 commented Jun 16, 2020

@etienne-lms as for dealing with the synchronous exception (Primary CPU switching to normal world boot), it seems like enabling multi-core option inside kernel is the way to go. Let me try this and see how

@etienne-lms
Copy link
Contributor

If testing a single core case is fine with you, then you can use QEMU_SMP=1 with run-only:
make run-only QEMU_SMP=1

@geneva1
Copy link
Author

geneva1 commented Jun 16, 2020

@etienne-lms make run-only QEMU_SMP=1 still could not eliminate synchronous exception

@geneva1
Copy link
Author

geneva1 commented Jun 17, 2020

@etienne-lms Have a look at #2002 (comment)

@geneva1
Copy link
Author

geneva1 commented Jun 18, 2020

By using this kconfigs/qemu.conf which includes only the basic OPTEE kconfigs and all netfilter kconfigs inside make menuconfig, I am able to eliminate both the synchronous exception and pflash error.

However, now I have different issue where qemu still could not reach user login prompt :

EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
listening on port 54321
soc_term: accepted fd 4
soc_term: read fd EOF
soc_term: accepted fd 4
D/TC:0 0 get_aslr_seed:1310 Cannot find valid kaslr-seed
D/TC:0 0 add_phys_mem:586 TEE_SHMEM_START type NSEC_SHM 0x42000000 size 0x00200000
D/TC:0 0 add_phys_mem:586 TA_RAM_START type TA_RAM 0x0e300000 size 0x00d00000
D/TC:0 0 add_phys_mem:586 VCORE_UNPG_RW_PA type TEE_RAM_RW 0x0e160000 size 0x001a0000
D/TC:0 0 add_phys_mem:586 VCORE_UNPG_RX_PA type TEE_RAM_RX 0x0e100000 size 0x00060000
D/TC:0 0 add_phys_mem:586 ROUNDDOWN(0x09040000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x09000000 size 0x00200000
D/TC:0 0 verify_special_mem_areas:524 No NSEC DDR memory area defined
D/TC:0 0 add_va_space:625 type RES_VASPACE size 0x00a00000
D/TC:0 0 add_va_space:625 type SHM_VASPACE size 0x02000000
D/TC:0 0 dump_mmap_table:737 type TEE_RAM_RX   va 0x0e100000..0x0e15ffff pa 0x0e100000..0x0e15ffff size 0x00060000 (smallpg)
D/TC:0 0 dump_mmap_table:737 type TEE_RAM_RW   va 0x0e160000..0x0e2fffff pa 0x0e160000..0x0e2fffff size 0x001a0000 (smallpg)
D/TC:0 0 dump_mmap_table:737 type TA_RAM       va 0x0e300000..0x0effffff pa 0x0e300000..0x0effffff size 0x00d00000 (smallpg)
D/TC:0 0 dump_mmap_table:737 type RES_VASPACE  va 0x0f000000..0x0f9fffff pa 0x00000000..0x009fffff size 0x00a00000 (pgdir)
D/TC:0 0 dump_mmap_table:737 type SHM_VASPACE  va 0x0fa00000..0x119fffff pa 0x00000000..0x01ffffff size 0x02000000 (pgdir)
D/TC:0 0 dump_mmap_table:737 type IO_SEC       va 0x11a00000..0x11bfffff pa 0x09000000..0x091fffff size 0x00200000 (pgdir)
D/TC:0 0 dump_mmap_table:737 type NSEC_SHM     va 0x11c00000..0x11dfffff pa 0x42000000..0x421fffff size 0x00200000 (pgdir)
D/TC:0 0 core_mmu_entry_to_finer_grained:762 xlat tables used 1 / 7
D/TC:0 0 core_mmu_entry_to_finer_grained:762 xlat tables used 2 / 7
D/TC:0 0 core_mmu_entry_to_finer_grained:762 xlat tables used 3 / 7
I/TC: 
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[0] with top at 0xe194ab8
D/TC:0 0 init_canaries:164 watch *0xe194abc
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[1] with top at 0xe1952f8
D/TC:0 0 init_canaries:164 watch *0xe1952fc
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[2] with top at 0xe195b38
D/TC:0 0 init_canaries:164 watch *0xe195b3c
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[3] with top at 0xe196378
D/TC:0 0 init_canaries:164 watch *0xe19637c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[0] with top at 0xe18dd38
D/TC:0 0 init_canaries:165 watch *0xe18dd3c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[1] with top at 0xe18e978
D/TC:0 0 init_canaries:165 watch *0xe18e97c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[2] with top at 0xe18f5b8
D/TC:0 0 init_canaries:165 watch *0xe18f5bc
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[3] with top at 0xe1901f8
D/TC:0 0 init_canaries:165 watch *0xe1901fc
D/TC:0 0 init_canaries:167 #Stack canaries for stack_thread[0] with top at 0xe192238
D/TC:0 0 init_canaries:167 watch *0xe19223c
D/TC:0 0 init_canaries:167 #Stack canaries for stack_thread[1] with top at 0xe194278
D/TC:0 0 init_canaries:167 watch *0xe19427c
D/TC:0 0 select_vector:956 SMCCC_ARCH_WORKAROUND_1 (0x80008000) available
D/TC:0 0 select_vector:957 SMC Workaround for CVE-2017-5715 used
I/TC: Non-secure external DT found
D/TC:0 0 carve_out_phys_mem:286 No need to carve out 0xe100000 size 0x200000
D/TC:0 0 carve_out_phys_mem:286 No need to carve out 0xe300000 size 0xd00000
I/TC: Switching console to device: /pl011@9040000
I/TC: OP-TEE version: 3.9.0-17-g0949602c (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #4 Fri Jun  5 06:21:57 UTC 2020 aarch64
D/TC:0 0 paged_init_primary:1175 Executing at offset 0 with virtual load address 0xe100000
D/TC:0 0 check_ta_store:635 TA store: "Secure Storage TA"
D/TC:0 0 check_ta_store:635 TA store: "REE"
D/TC:0 0 mobj_mapped_shm_init:447 Shared memory address range: fa00000, 11a00000
I/TC: Initialized
D/TC:0 0 paged_init_primary:1188 Primary CPU switching to normal world boot
D/TC:1   generic_boot_cpu_on_handler:1237 cpu 1: a0 0x0
D/TC:1   select_vector:956 SMCCC_ARCH_WORKAROUND_1 (0x80008000) available
D/TC:1   select_vector:957 SMC Workaround for CVE-2017-5715 used
D/TC:1   init_secondary_helper:1212 Secondary CPU Switching to normal world boot

@github-actions
Copy link

This issue has been marked as a stale issue because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants