8000 [config] read configuration from exported values instead of envs by Azure-stars · Pull Request #10 · arceos-org/arceos-apps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[config] read configuration from exported values instead of envs #10

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

Merged
merged 2 commits into from
Jul 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- name: Check code format
run: cargo fmt --all -- --check
- name: Clippy
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: cargo clippy --all-features

build-rust-apps:
Expand All @@ -39,7 +38,7 @@ jobs:
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat, loongarch64-unknown-none
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat, loongarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-bin-cache
Expand Down Expand Up @@ -96,7 +95,7 @@ jobs:
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat, loongarch64-unknown-none
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat, loongarch64-unknown-none-softfloat
- uses: arceos-org/setup-musl@v1
with:
arch: ${{ matrix.arch }}
Expand Down Expand Up @@ -137,7 +136,7 @@ jobs:
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
targets: x86_64-unknown-none, aarch64-unknown-none-softfloat
- uses: arceos-org/setup-musl@v1
with:
arch: x86_64
Expand All @@ -147,29 +146,30 @@ jobs:
cache-targets: false
- run: cargo install cargo-binutils
- run: ./scripts/get_deps.sh

- name: Export config path for x86_64-pc-oslab
run: echo "CONFIG_PATH=$(pwd)/.arceos/configs/custom/x86_64-pc-oslab.toml" >> $GITHUB_ENV
- name: Build rust/helloworld for x86_64-pc-oslab
run: make PLATFORM=x86_64-pc-oslab A=rust/helloworld
run: make PLAT_CONFIG=$CONFIG_PATH A=rust/helloworld
- name: Build rust/net/httpserver for x86_64-pc-oslab
run: make PLATFORM=x86_64-pc-oslab A=rust/net/httpserver FEATURES=driver-ixgbe
run: make PLAT_CONFIG=$CONFIG_PATH A=rust/net/httpserver FEATURES=driver-ixgbe
- name: Build c/iperf for x86_64-pc-oslab
run: make PLATFORM=x86_64-pc-oslab A=c/iperf FEATURES=driver-ixgbe,driver-ramdisk
run: make PLAT_CONFIG=$CONFIG_PATH A=c/iperf FEATURES=driver-ixgbe,driver-ramdisk
- name: Build c/redis for x86_64-pc-oslab
run: make PLATFORM=x86_64-pc-oslab A=c/redis FEATURES=driver-ixgbe,driver-ramdisk SMP=4
run: make PLAT_CONFIG=$CONFIG_PATH A=c/redis FEATURES=driver-ixgbe,driver-ramdisk SMP=4

- run: make PLATFORM=aarch64-raspi4 defconfig
- run: make MYPLAT=axplat-aarch64-raspi defconfig
- name: Build rust/helloworld for aarch64-raspi4
run: make PLATFORM=aarch64-raspi4 SMP=4 A=rust/helloworld
run: make MYPLAT=axplat-aarch64-raspi A=rust/helloworld
- name: Build rust/fs/shell for aarch64-raspi4
run: make PLATFORM=aarch64-raspi4 SMP=4 A=rust/fs/shell FEATURES=driver-bcm2835-sdhci BUS=mmio
run: make MYPLAT=axplat-aarch64-raspi A=rust/fs/shell FEATURES=driver-bcm2835-sdhci BUS=mmio

- run: make PLATFORM=aarch64-bsta1000b defconfig
- run: make MYPLAT=axplat-aarch64-bsta1000b defconfig
- name: Build rust/helloworld for aarch64-bsta1000b
run: make PLATFORM=aarch64-bsta1000b SMP=8 A=rust/helloworld
run: make MYPLAT=axplat-aarch64-bsta1000b A=rust/helloworld

- run: make PLATFORM=aarch64-phytium-pi defconfig
- run: make MYPLAT=axplat-aarch64-phytium-pi defconfig
- name: Build rust/helloworld for aarch64-phytium-pi
run: make PLATFORM=aarch64-phytium-pi SMP=4 A=rust/helloworld
run: make MYPLAT=axplat-aarch64-phytium-pi A=rust/helloworld

build-for-std:
runs-on: ${{ matrix.os }}
Expand All @@ -184,7 +184,6 @@ jobs:
with:
toolchain: ${{ matrix.rust-toolchain }}
- name: Build apps for std
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
./scripts/get_deps.sh
cargo build --all --exclude arceos-display
3 changes: 2 additions & 1 deletion c/redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ MSET (10 keys): 183150.19 requests per second

## Compile and Run

- `make A=c/redis LOG=error PLATFORM=x86_64-pc-oslab SMP=4 FEATURES=driver-ixgbe,driver-ramdisk IP=10.2.2.2 GW=10.2.2.1`
- `./scripts/get_deps.sh`
- `make A=c/redis LOG=error MYPLAT=<path_to_arceos>/configs/custom/x86_64-pc-oslab.toml SMP=4 FEATURES=driver-ixgbe,driver-ramdisk IP=10.2.2.2 GW=10.2.2.1`
- Copy `redis_x86_64-pc-oslab.elf` to `/boot`, then reboot.
- Enter `grub` then boot the PC by ArceOS Redis.
- Connect to ArceOS-Redis server by:
Expand Down
2 changes: 1 addition & 1 deletion rust/exception/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn raise_page_fault() {
vaddr, access_flags, is_user
);
println!("Page fault test OK!");
axhal::misc::terminate();
axhal::power::system_off();
}

let fault_addr = 0xdeadbeef as *mut u8;
Expand Down
10 changes: 7 additions & 3 deletions rust/fs/shell/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,14 @@ fn do_pwd(_args: &str) {
fn do_uname(_args: &str) {
let arch = option_env!("AX_ARCH").unwrap_or("");
let platform = option_env!("AX_PLATFORM").unwrap_or("");
let smp = match option_env!("AX_SMP") {
None | Some("1") => "",
_ => " SMP",
#[cfg(feature = "axstd")]
let smp = if std::thread::available_parallelism().unwrap().get() == 1 {
""
} else {
" SMP"
};
#[cfg(not(feature = "axstd"))]
let smp = "";
let version = option_env!("CARGO_PKG_VERSION").unwrap_or("0.1.0");
println!(
"ArceOS {ver}{smp} {arch} {plat}",
Expand Down
6 changes: 2 additions & 4 deletions rust/task/affinity/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ extern crate axstd as std;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread;

#[cfg(feature = "axstd")]
use std::os::arceos::api::config::SMP;
#[cfg(feature = "axstd")]
use std::os::arceos::api::task::{ax_set_current_affinity, AxCpuMask};
#[cfg(feature = "axstd")]
use std::os::arceos::modules::axhal::cpu::this_cpu_id;
use std::os::arceos::modules::axhal::percpu::this_cpu_id;

const KERNEL_STACK_SIZE: usize = 0x40000; // 256 KiB

Expand All @@ -26,7 +24,7 @@ static FINISHED_TASKS: AtomicUsize = AtomicUsize::new(0);
fn main() {
println!("Hello, main task!");
for i in 0..NUM_TASKS {
let cpu_id = i % SMP;
let cpu_id = i % thread::available_parallelism().unwrap().get();
thread::spawn(move || {
// Initialize cpu affinity here.
#[cfg(feature = "axstd")]
Expand Down
1 change: 1 addition & 0 deletions rust/task/irq/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ fn main() {

test_yielding();
test_sleep();
#[cfg(feature = "axstd")]
test_wait_queue();

println!("Task irq state tests run OK!");
Expand Down
2 changes: 1 addition & 1 deletion rust/task/priority/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn main() {
}

#[cfg(feature = "axstd")]
if cfg!(feature = "sched-cfs") && option_env!("AX_SMP") == Some("1") {
if cfg!(feature = "sched-cfs") && thread::available_parallelism().unwrap().get() == 1 {
assert!(
leave_times[0] > leave_times[1]
&& leave_times[1] > leave_times[2]
Expand Down
6 changes: 4 additions & 2 deletions rust/task/yield/src/main.rs