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
Add support for Raspberry Pi 3 B plus #358
Conversation
rpi3.mk
Outdated
@@ -11,7 +11,8 @@ override COMPILE_S_KERNEL := 64 | |||
# Need to set this before including common.mk | |||
BUILDROOT_GETTY_PORT ?= ttyS0 | |||
BR2_ROOTFS_POST_BUILD_SCRIPT ?= "board/raspberrypi3-64/post-build.sh" | |||
|
|||
#For Raspberry Pi 3 B plus set to rpi3-bplus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space after #
.
rpi3.mk
Outdated
@@ -11,7 +11,8 @@ override COMPILE_S_KERNEL := 64 | |||
# Need to set this before including common.mk | |||
BUILDROOT_GETTY_PORT ?= ttyS0 | |||
BR2_ROOTFS_POST_BUILD_SCRIPT ?= "board/raspberrypi3-64/post-build.sh" | |||
|
|||
#For Raspberry Pi 3 B plus set to rpi3-bplus | |||
PLATFORM ?= rpi3-b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I saw a comment from you somewhere that you couldn't use the composite form? Or did I mix that up? What I'm looking for here is something like
PLATFORM=rpi-3b
PLATFORM=rpi-3bplus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Platform directory in optee_os
is core/arch/arm/plat-rpi3
so PLATFORM has to be rpi3
and PLATFORM_FLAVOR
may be whatever we want (for instance b
or bplus
).
The consequence is, the "composite" form of PLATFORM
is written rpi3-something
.
https://github.com/OP-TEE/optee_os/blob/master/Makefile#L32-L33
Another option would be to rename core/arch/arm/plat-rpi3
to core/arch/arm/plat-rpi
, but since all variants are still 3 more or less, would it be justified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option would be to rename
core/arch/arm/plat-rpi3
tocore/arch/arm/plat-rpi
, but since all variants are still 3 more or less, would it be justified?
I was thinking about the same. My initial thought was to leave the rpi3-...
and start using rpi-...
instead. But as long as it's only rpi3 devices we have, it might be more work than we gain by doing so. In that case, use what I think I proposed in the other github issue about this:
PLATFORM=rpi3-b
PLATFORM=rpi3-bplus
rpi3.mk
Outdated
@@ -31,13 +32,21 @@ RPI3_BOOT_CONFIG ?= $(RPI3_FIRMWARE_PATH)/config.txt | |||
RPI3_UBOOT_ENV ?= $(ROOT)/out/uboot.env | |||
RPI3_UBOOT_ENV_TXT ?= $(RPI3_FIRMWARE_PATH)/uboot.env.txt | |||
RPI3_STOCK_FW_PATH ?= $(ROOT)/firmware | |||
RPI3_STOCK_FW_PATH_BOOT ?= $(RPI3_STOCK_FW_PATH)/boot | |||
ifeq ($(PLATFORM),rpi3-b) | |||
RPI3_STOCK_FW_PATH_BOOT ?= $(RPI3_STOCK_FW_PATH)/boot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When first looking at this I ask myself why does this have to be on different paths (line 36 and 38, besides the PLATFORM)? I guess you didn't want to deal with the "firmware" git? In that case I believe it's better to actually create another xml/manifest file for Rpi3-b+.
rpi3.mk
Outdated
ifeq ($(PLATFORM),rpi3-b) | ||
LINUX_DTB ?= $(LINUX_PATH)/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb | ||
else | ||
LINUX_DTB ?= $(LINUX_PATH)/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but I noticed that the same dtb is showing up on several places, which might be a bit confusing. We should try clean that up at some point in the future.
$ find . -name "bcm2710-rpi-3-b.dtb"
./build/rpi3/firmware/rpi3-bplus/bcm2710-rpi-3-b.dtb
./linux/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb
./firmware/boot/bcm2710-rpi-3-b.dtb
./out-br/target/boot/bcm2710-rpi-3-b.dtb
$ find . -name "bcm2710-rpi-3-b-plus.dtb"
./build/rpi3/firmware/rpi3-bplus/bcm2710-rpi-3-b-plus.dtb
./linux/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb
rpi3.mk
Outdated
@@ -147,10 +156,18 @@ linux-cleaner: linux-cleaner-common | |||
################################################################################ | |||
# OP-TEE | |||
################################################################################ | |||
OPTEE_OS_COMMON_FLAGS += PLATFORM=rpi3 | |||
ifeq ($(PLATFORM),rpi3-b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 159 to 162: Please update to the platform names as I proposed further up.
rpi3.mk
Outdated
@@ -179,6 +197,24 @@ update_rootfs: arm-tf linux u-boot | |||
@install -v -p --mode=755 $(RPI3_STOCK_FW_PATH)/boot/start_db.elf $(BUILDROOT_TARGET_ROOT)/boot/start_db.elf | |||
@install -v -p --mode=755 $(RPI3_STOCK_FW_PATH)/boot/start.elf $(BUILDROOT_TARGET_ROOT)/boot/start.elf | |||
@install -v -p --mode=755 $(RPI3_STOCK_FW_PATH)/boot/start_x.elf $(BUILDROOT_TARGET_ROOT)/boot/start_x.elf | |||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else
is almost unnecessary with exception of a few files. If we put all files under a common path where only $(PLATFORM)
makes them different, then there should be almost no need for if/else
.
@@ -0,0 +1,356 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to get GPL-v2 files in this git, which even more justifies creating another manifest to just clone the firmware (as done already today), instead of copy files like this.
@@ -0,0 +1,30 @@ | |||
Copyright (c) 2006, Broadcom Corporation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, this belongs to the firmware.git instead.
rpi3/firmware/rpi3-bplus/config.txt
Outdated
@@ -0,0 +1,3 @@ | |||
enable_uart=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs here, only thing is to change it to my proposed platform name instead rpi-3bplus
.
@johnphilby Please remove And you also don't need another copy of rpi3 firmware binaries, as the one for RPi3-B also works for RPi3-B-Plus. You can just do what Joakim suggested, creating a separate repo manifest for rpi3b-plus (and using the same link from https://github.com/OP-TEE/manifest/blob/master/rpi3.xml#L25) |
@jbech-linaro and @igoropaniuk thank you for your review comments. I will incorporate them and resubmit again. |
@jbech-linaro @igoropaniuk I think I have addressed your comments. Created a new manifest for supporting RPi3 B Plus. Please review the commits from both the "manifest" and "build" repo. |
This all looks good, having that said, the only difference compared to the original The downside with both of my proposals are that the user must not forget to set the PLATFORM flag when building for RPi3 B-plus which is something that we doesn't really do for other OP-TEE full developer builds. In any case, I'm happy with it is as it is here also, we can refactor the makefiles at a later point also to better share common parts (
Suggestion one: diff --git a/rpi3.mk b/rpi3.mk
index e172571..d7918c5 100644
--- a/rpi3.mk
+++ b/rpi3.mk
@@ -37,9 +37,17 @@ OPTEE_BIN_EXTRA1 ?= $(OPTEE_PATH)/out/arm/core/tee-pager_v2.bin
OPTEE_BIN_EXTRA2 ?= $(OPTEE_PATH)/out/arm/core/tee-pageable_v2.bin
LINUX_IMAGE ?= $(LINUX_PATH)/arch/arm64/boot/Image
+
+ifeq ($(PLATFORM),rpi3-bplus)
+LINUX_DTB ?= $(LINUX_PATH)/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb
+$(info "Building RPi3-bplus")
+else
LINUX_DTB ?= $(LINUX_PATH)/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb
+$(info "Building RPi3b (default)")
+endif
MODULE_OUTPUT ?= $(ROOT)/module_output
+
################################################################################
# Targets
################################################################################
@@ -163,7 +171,11 @@ buildroot: update_rootfs
update_rootfs: arm-tf linux u-boot
@mkdir -p --mode=755 $(BUILDROOT_TARGET_ROOT)/boot
@mkdir -p --mode=755 $(BUILDROOT_TARGET_ROOT)/usr/bin
+ifeq ($(PLATFORM),rpi3-bplus)
+ @install -v -p --mode=755 $(LINUX_DTB) $(BUILDROOT_TARGET_ROOT)/boot/bcm2710-rpi-3-b-plus.dtb
+else
@install -v -p --mode=755 $(LINUX_DTB) $(BUILDROOT_TARGET_ROOT)/boot/bcm2710-rpi-3-b.dtb
+endif
@install -v -p --mode=755 $(RPI3_BOOT_CONFIG) $(BUILDROOT_TARGET_ROOT)/boot/config.txt
@install -v -p --mode=755 $(LINUX_IMAGE) $(BUILDROOT_TARGET_ROOT)/boot/kernel8.img
@install -v -p --mode=755 $(ARM_TF_BOOT) $(BUILDROOT_TARGET_ROOT)/boot/armstub8.bin Suggestion two: diff --git a/rpi3.mk b/rpi3.mk
index e172571..4272cb2 100644
--- a/rpi3.mk
+++ b/rpi3.mk
@@ -37,9 +37,12 @@ OPTEE_BIN_EXTRA1 ?= $(OPTEE_PATH)/out/arm/core/tee-pager_v2.bin
OPTEE_BIN_EXTRA2 ?= $(OPTEE_PATH)/out/arm/core/tee-pageable_v2.bin
LINUX_IMAGE ?= $(LINUX_PATH)/arch/arm64/boot/Image
-LINUX_DTB ?= $(LINUX_PATH)/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb
+
+LINUX_DTB_RPI3B ?= $(LINUX_PATH)/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb
+LINUX_DTB_RPI3BPLUS ?= $(LINUX_PATH)/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb
MODULE_OUTPUT ?= $(ROOT)/module_output
+
################################################################################
# Targets
################################################################################
@@ -163,7 +166,8 @@ buildroot: update_rootfs
update_rootfs: arm-tf linux u-boot
@mkdir -p --mode=755 $(BUILDROOT_TARGET_ROOT)/boot
@mkdir -p --mode=755 $(BUILDROOT_TARGET_ROOT)/usr/bin
- @install -v -p --mode=755 $(LINUX_DTB) $(BUILDROOT_TARGET_ROOT)/boot/bcm2710-rpi-3-b.dtb
+ @install -v -p --mode=755 $(LINUX_DTB_RPI3B) $(BUILDROOT_TARGET_ROOT)/boot/bcm2710-rpi-3-b.dtb
+ @install -v -p --mode=755 $(LINUX_DTB_RPI3BPLUS) $(BUILDROOT_TARGET_ROOT)/boot/bcm2710-rpi-3-b-plus.dtb
@install -v -p --mode=755 $(RPI3_BOOT_CONFIG) $(BUILDROOT_TARGET_ROOT)/boot/config.txt
@install -v -p --mode=755 $(LINUX_IMAGE) $(BUILDROOT_TARGET_ROOT)/boot/kernel8.img
@install -v -p --mode=755 $(ARM_TF_BOOT) $(BUILDROOT_TARGET_ROOT)/boot/armstub8.bin |
@jbech-linaro my two cents: |
Yeah, I guess that this is the better solution as of now, but that requires that both dtb's are there. I believe the install command will complain otherwise. |
@jbech-linaro AFAIK, they are already in the same rpi3 firmware tarball (there is no need to download something else), so anyway you can just copy both after unpacking the archive. |
I see, well, then it's a no brainer I guess. |
@jbech-linaro In lieu of this comment and our common consensus that it is cleaner to just copy both the dtbs, I have updated the pull request. To sum up: Please take a look. |
I am able to restart the job. I am letting you know because I don't know if it is intended for random people to have that permission. |
@IKyriazis I'm well aware of that and as long as it isn't misused I'm going to leave it like that. But if there is someone starting to misuse it, then I'll have to remove that ability for non-trusted users. Anyhow, thanks for mentioning this! |
@johnphilby , sorry for the late reply, this is looking good to me. |
@johnphilby, would you please squash the 3 commits into one and add @jbech-linaro's Reviewed-by tag? |
Sure. Doing that right now. |
FYI, as part of testing for 3.6.0, I'm doing a test build with this PR. |
With the patches applied on master. +-----------------------------------------------------
24078 subtests of which 0 failed
95 test cases of which 0 failed
0 test cases were skipped
TEE test application done! So, if tags haven't already been applied you can add my TB also. |
f4ad1e3
to
7fcdb7c
Compare
@jbech-linaro why is IBART failing? Wrong cross-compiler version?
|
I will add this as well. I am just trying out this interactive rebase thingy. Did not get it right. Trying again. Apparently, "--autosquash" isn't working as I would like it to. |
Copy both RPi3 B and RPi3 B Plus dtb files to enable booting both the targets. This will avoid adding a seperate rpi3-bplus makefile. Signed-off-by: Philby John <philby.j@hcl.com> Signed-off-by: Vv Ramya <ramyavv@hcl.com> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Joakim Bech <joakim.bech@linaro.org> # (rpi3b)
7fcdb7c
to
1c0e779
Compare
Guess I got it right this time. Please verify and merge. and |
It's because @johnphilby branch is a bit old, it needs a rebase so it gets my related patches onto his own branch (6e167bf and e029816). |
OK, then I guess all is well. Let's merge this. Thanks! |
Make use of the PLATFORM variable to set the specific
target being used "rpi3-b" or "rpi3-bplus".
Signed-off-by: Philby John philby.j@hcl.com
Signed-off-by: Vv Ramya ramyavv@hcl.com