Actions: Add RPi4 build

pull/37/head
Andre Richter 5 years ago
parent 7f74318f5d
commit 6119cf88b1
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -1,4 +1,4 @@
name: Build RPi3
name: BSP-RPi3
on:
push:
@ -20,7 +20,7 @@ on:
jobs:
build:
name: Build RPi3 kernels
name: Build kernels
runs-on: ubuntu-18.04
steps:
@ -37,4 +37,4 @@ jobs:
cargo install cargo-xbuild cargo-binutils
- name: Make all
run: |
ruby utils/make_all.rb
ruby utils/make_all.rb rpi3

@ -0,0 +1,40 @@
name: BSP-RPi4
on:
push:
branches:
- master
paths-ignore:
- 'utils/**'
- 'doc/**'
- 'docker/**'
pull_request:
branches:
- master
paths-ignore:
- 'utils/**'
- 'doc/**'
- 'docker/**'
schedule:
- cron: '0 5 * * *'
jobs:
build:
name: Build kernels
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up Ruby 2.x
uses: actions/setup-ruby@v1
with:
ruby-version: 2.x
- name: Set up Rust nightly
run: |
rustup self update
rustup toolchain install nightly --component rust-src llvm-tools-preview
rustup default nightly
cargo install cargo-xbuild cargo-binutils
- name: Make all
run: |
ruby utils/make_all.rb rpi4

@ -32,6 +32,6 @@ jobs:
rustup self update
rustup toolchain install nightly --component rustfmt
rustup default nightly
- name: Make all
- name: Run cargo fmt
run: |
ruby utils/fmt_all.rb --check

@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot"
[features]
default = []
bsp_rpi3 = []
bsp_rpi4 = []
[dependencies]

@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3)
QEMU_MISC_ARGS = -d in_asm
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
else ifeq ($(BSP),rpi4)
TARGET = aarch64-unknown-none-softfloat
OUTPUT = kernel8.img
# QEMU_BINARY = qemu-system-aarch64
# QEMU_MACHINE_TYPE =
# QEMU_MISC_ARGS = -d in_asm
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld)
@ -56,9 +64,14 @@ doc:
cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items
xdg-open target/$(TARGET)/doc/kernel/index.html
ifeq ($(QEMU_MACHINE_TYPE),)
qemu:
@echo "This board is not yet supported for QEMU."
else
qemu: all
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS)
endif
clippy:
cargo xclippy --target=$(TARGET) --features bsp_$(BSP)

@ -4,8 +4,8 @@
//! Conditional exporting of processor architecture code.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod aarch64;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use aarch64::*;

@ -4,8 +4,8 @@
//! Conditional exporting of Board Support Packages.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod rpi;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use rpi::*;

@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot"
[features]
default = []
bsp_rpi3 = []
bsp_rpi4 = []
[dependencies]
r0 = "0.2.*"

@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3)
QEMU_MISC_ARGS = -d in_asm
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
else ifeq ($(BSP),rpi4)
TARGET = aarch64-unknown-none-softfloat
OUTPUT = kernel8.img
# QEMU_BINARY = qemu-system-aarch64
# QEMU_MACHINE_TYPE =
# QEMU_MISC_ARGS = -d in_asm
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld)
@ -56,9 +64,14 @@ doc:
cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items
xdg-open target/$(TARGET)/doc/kernel/index.html
ifeq ($(QEMU_MACHINE_TYPE),)
qemu:
@echo "This board is not yet supported for QEMU."
else
qemu: all
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS)
endif
clippy:
cargo xclippy --target=$(TARGET) --features bsp_$(BSP)

@ -22,8 +22,8 @@ Check out `make qemu` again to see the additional code run.
diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml
--- 01_wait_forever/Cargo.toml
+++ 02_runtime_init/Cargo.toml
@@ -13,4 +13,4 @@
bsp_rpi3 = []
@@ -14,4 +14,4 @@
bsp_rpi4 = []
[dependencies]
-

@ -4,8 +4,8 @@
//! Conditional exporting of processor architecture code.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod aarch64;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use aarch64::*;

@ -4,8 +4,8 @@
//! Conditional exporting of Board Support Packages.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod rpi;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use rpi::*;

@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot"
[features]
default = []
bsp_rpi3 = []
bsp_rpi4 = []
[dependencies]
r0 = "0.2.*"

@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3)
QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
else ifeq ($(BSP),rpi4)
TARGET = aarch64-unknown-none-softfloat
OUTPUT = kernel8.img
# QEMU_BINARY = qemu-system-aarch64
# QEMU_MACHINE_TYPE =
# QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld)
@ -56,9 +64,14 @@ doc:
cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items
xdg-open target/$(TARGET)/doc/kernel/index.html
ifeq ($(QEMU_MACHINE_TYPE),)
qemu:
@echo "This board is not yet supported for QEMU."
else
qemu: all
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS)
endif
clippy:
cargo xclippy --target=$(TARGET) --features bsp_$(BSP)

@ -37,6 +37,15 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile
+ QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
else ifeq ($(BSP),rpi4)
@@ -21,7 +21,7 @@
OUTPUT = kernel8.img
# QEMU_BINARY = qemu-system-aarch64
# QEMU_MACHINE_TYPE =
-# QEMU_MISC_ARGS = -d in_asm
+# QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
diff -uNr 02_runtime_init/src/bsp/rpi.rs 03_hacky_hello_world/src/bsp/rpi.rs

@ -4,8 +4,8 @@
//! Conditional exporting of processor architecture code.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod aarch64;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use aarch64::*;

@ -4,8 +4,8 @@
//! Conditional exporting of Board Support Packages.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod rpi;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use rpi::*;

@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot"
[features]
default = []
bsp_rpi3 = ["cortex-a"]
bsp_rpi4 = ["cortex-a"]
[dependencies]
r0 = "0.2.*"

@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3)
QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
else ifeq ($(BSP),rpi4)
TARGET = aarch64-unknown-none-softfloat
OUTPUT = kernel8.img
# QEMU_BINARY = qemu-system-aarch64
# QEMU_MACHINE_TYPE =
# QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld)
@ -56,9 +64,14 @@ doc:
cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items
xdg-open target/$(TARGET)/doc/kernel/index.html
ifeq ($(QEMU_MACHINE_TYPE),)
qemu:
@echo "This board is not yet supported for QEMU."
else
qemu: all
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS)
endif
clippy:
cargo xclippy --target=$(TARGET) --features bsp_$(BSP)

@ -13,12 +13,14 @@ which provides zero-overhead abstractions and wraps the `unsafe` parts.
diff -uNr 03_hacky_hello_world/Cargo.toml 04_zero_overhead_abstraction/Cargo.toml
--- 03_hacky_hello_world/Cargo.toml
+++ 04_zero_overhead_abstraction/Cargo.toml
@@ -10,7 +10,10 @@
@@ -10,8 +10,11 @@
# The features section is used to select the target board.
[features]
default = []
-bsp_rpi3 = []
-bsp_rpi4 = []
+bsp_rpi3 = ["cortex-a"]
+bsp_rpi4 = ["cortex-a"]
[dependencies]
r0 = "0.2.*"

@ -4,8 +4,8 @@
//! Conditional exporting of processor architecture code.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod aarch64;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use aarch64::*;

@ -4,8 +4,8 @@
//! Conditional exporting of Board Support Packages.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod rpi;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use rpi::*;

@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot"
[features]
default = []
bsp_rpi3 = ["cortex-a"]
bsp_rpi4 = ["cortex-a"]
[dependencies]
r0 = "0.2.*"

@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3)
QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
else ifeq ($(BSP),rpi4)
TARGET = aarch64-unknown-none-softfloat
OUTPUT = kernel8.img
# QEMU_BINARY = qemu-system-aarch64
# QEMU_MACHINE_TYPE =
# QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld)
@ -56,9 +64,14 @@ doc:
cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items
xdg-open target/$(TARGET)/doc/kernel/index.html
ifeq ($(QEMU_MACHINE_TYPE),)
qemu:
@echo "This board is not yet supported for QEMU."
else
qemu: all
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS)
endif
clippy:
cargo xclippy --target=$(TARGET) --features bsp_$(BSP)

@ -4,8 +4,8 @@
//! Conditional exporting of processor architecture code.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod aarch64;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use aarch64::*;

@ -4,8 +4,8 @@
//! Conditional exporting of Board Support Packages.
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod rpi;
#[cfg(feature = "bsp_rpi3")]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use rpi::*;

@ -80,11 +80,12 @@ sudo screen /dev/ttyUSB0 115200
diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml
--- 05_safe_globals/Cargo.toml
+++ 06_drivers_gpio_uart/Cargo.toml
@@ -10,10 +10,12 @@
@@ -10,11 +10,12 @@
# The features section is used to select the target board.
[features]
default = []
-bsp_rpi3 = ["cortex-a"]
-bsp_rpi4 = ["cortex-a"]
+bsp_rpi3 = ["cortex-a", "register"]
+bsp_rpi4 = ["cortex-a", "register"]
@ -95,40 +96,6 @@ diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml
cortex-a = { version = "2.*", optional = true }
+register = { version = "0.3.*", optional = true }
diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile
--- 05_safe_globals/Makefile
+++ 06_drivers_gpio_uart/Makefile
@@ -16,6 +16,14 @@
QEMU_MISC_ARGS = -serial stdio
LINKER_FILE = src/bsp/rpi/link.ld
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
+else ifeq ($(BSP),rpi4)
+ TARGET = aarch64-unknown-none-softfloat
+ OUTPUT = kernel8.img
+# QEMU_BINARY = qemu-system-aarch64
+# QEMU_MACHINE_TYPE =
+# QEMU_MISC_ARGS = -serial stdio
+ LINKER_FILE = src/bsp/rpi/link.ld
+ RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld)
@@ -56,9 +64,14 @@
cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items
xdg-open target/$(TARGET)/doc/kernel/index.html
+ifeq ($(QEMU_MACHINE_TYPE),)
+qemu:
+ @echo "This board is not yet supported for QEMU."
+else
qemu: all
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS)
+endif
clippy:
cargo xclippy --target=$(TARGET) --features bsp_$(BSP)
diff -uNr 05_safe_globals/src/arch/aarch64.rs 06_drivers_gpio_uart/src/arch/aarch64.rs
--- 05_safe_globals/src/arch/aarch64.rs
+++ 06_drivers_gpio_uart/src/arch/aarch64.rs
@ -149,21 +116,6 @@ diff -uNr 05_safe_globals/src/arch/aarch64.rs 06_drivers_gpio_uart/src/arch/aarc
#[inline(always)]
pub fn wait_forever() -> ! {
diff -uNr 05_safe_globals/src/arch.rs 06_drivers_gpio_uart/src/arch.rs
--- 05_safe_globals/src/arch.rs
+++ 06_drivers_gpio_uart/src/arch.rs
@@ -4,8 +4,8 @@
//! Conditional exporting of processor architecture code.
-#[cfg(feature = "bsp_rpi3")]
+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod aarch64;
-#[cfg(feature = "bsp_rpi3")]
+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use aarch64::*;
diff -uNr 05_safe_globals/src/bsp/driver/bcm/bcm2xxx_gpio.rs 06_drivers_gpio_uart/src/bsp/driver/bcm/bcm2xxx_gpio.rs
--- 05_safe_globals/src/bsp/driver/bcm/bcm2xxx_gpio.rs
+++ 06_drivers_gpio_uart/src/bsp/driver/bcm/bcm2xxx_gpio.rs
@ -849,19 +801,15 @@ diff -uNr 05_safe_globals/src/bsp/rpi.rs 06_drivers_gpio_uart/src/bsp/rpi.rs
diff -uNr 05_safe_globals/src/bsp.rs 06_drivers_gpio_uart/src/bsp.rs
--- 05_safe_globals/src/bsp.rs
+++ 06_drivers_gpio_uart/src/bsp.rs
@@ -4,8 +4,10 @@
@@ -4,6 +4,8 @@
//! Conditional exporting of Board Support Packages.
-#[cfg(feature = "bsp_rpi3")]
+mod driver;
+
+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
mod rpi;
-#[cfg(feature = "bsp_rpi3")]
+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
pub use rpi::*;
diff -uNr 05_safe_globals/src/interface.rs 06_drivers_gpio_uart/src/interface.rs
--- 05_safe_globals/src/interface.rs

@ -7,14 +7,14 @@
require_relative 'helpers/tutorial_folders.rb'
def make_all
def make_all(bsp = 'rpi3')
crates = tutorial_folders
crates.each do |x|
x = File.dirname(x)
puts "\n\n" + x.to_s + "\n\n"
Dir.chdir(x) do
unless system('make')
unless system("BSP=#{bsp} make")
puts "\n\nBuild failed!"
exit(1) # Exit with error code
end
@ -22,4 +22,4 @@ def make_all
end
end
make_all if $PROGRAM_NAME == __FILE__
make_all(ARGV[0]) if $PROGRAM_NAME == __FILE__

Loading…
Cancel
Save