Update dev image for OSDK and bump version to 0.4.0

This commit is contained in:
Zhang Junyang
2024-02-27 11:23:06 +08:00
committed by Tate, Hongliang Tian
parent 674c35079c
commit bd878dd1c9
42 changed files with 188 additions and 153 deletions

View File

@ -21,7 +21,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Fetch versions in the repo
id: fetch-versions

25
.github/workflows/framework_test.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Framework Test
on:
pull_request:
push:
branches:
- main
jobs:
unit-test:
runs-on: ubuntu-latest
timeout-minutes: 10
container: asterinas/asterinas:0.4.0
steps:
- run: echo "Running in asterinas/asterinas:0.4.0"
- uses: actions/checkout@v4
- run: make install_osdk
- run: make update_initramfs
- name: Unit test
id: test
run: cd framework/aster-frame && cargo osdk test

View File

@ -1,4 +1,4 @@
name: Asterinas CI
name: Kernel Test
on:
pull_request:
@ -7,14 +7,14 @@ on:
- main
jobs:
aster-lint:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
container: asterinas/asterinas:0.3.0
container: asterinas/asterinas:0.4.0
steps:
- run: echo "Running in asterinas/asterinas:0.3.0"
- run: echo "Running in asterinas/asterinas:0.4.0"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: make install_osdk
@ -22,14 +22,14 @@ jobs:
id: check
run: make check
aster-unit-test:
unit-test:
runs-on: ubuntu-latest
timeout-minutes: 15
container: asterinas/asterinas:0.3.0
container: asterinas/asterinas:0.4.0
steps:
- run: echo "Running in asterinas/asterinas:0.3.0"
- run: echo "Running in asterinas/asterinas:0.4.0"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: make install_osdk
@ -43,14 +43,14 @@ jobs:
# TODO: add component check.
aster-integration-test:
integration-test:
runs-on: ubuntu-latest
timeout-minutes: 30
container: asterinas/asterinas:0.3.1
container: asterinas/asterinas:0.4.0
steps:
- run: echo "Running in asterinas/asterinas:0.3.1"
- run: echo "Running in asterinas/asterinas:0.4.0"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: make install_osdk

View File

@ -1,27 +0,0 @@
name: OSDK CI
on:
pull_request:
paths:
- osdk/**
push:
branches:
- main
jobs:
osdk-ci:
runs-on: ubuntu-latest
timeout-minutes: 10
container: asterinas/asterinas:0.3.0
steps:
- run: echo "Running in asterinas/asterinas:0.3.0"
- uses: actions/checkout@v3
- name: Lint
id: lint
run: cd osdk && cargo clippy -- -D warnings
- name: Unit test
id: unit_test
run: cd osdk && cargo build && cargo test

View File

@ -12,9 +12,9 @@ jobs:
osdk-publish:
runs-on: ubuntu-latest
timeout-minutes: 10
container: asterinas/asterinas:0.3.0
container: asterinas/asterinas:0.4.0
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: katyo/publish-crates@v2
with:
path: './osdk'

33
.github/workflows/osdk_test.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: OSDK Test
on:
pull_request:
paths:
- framework/**
- osdk/**
- tools/**
- Cargo.toml
push:
branches:
- main
jobs:
osdk-test:
runs-on: ubuntu-latest
timeout-minutes: 10
container: asterinas/asterinas:0.4.0
steps:
- run: echo "Running in asterinas/asterinas:0.4.0"
- uses: actions/checkout@v4
- name: Lint
id: lint
run: cd osdk && cargo clippy -- -D warnings
# The OSDK unit test features a recursive call of Cargo,
# which will break when RUSTUP_HOME is altered in the case
# of actions/checkout@v4
- name: Unit test
id: unit_test
run: cd osdk && cargo build && RUSTUP_HOME=/root/.rustup cargo test

60
Cargo.lock generated
View File

@ -21,19 +21,26 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
[[package]]
name = "ahash"
version = "0.8.3"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "align_ext"
version = "0.1.0"
[[package]]
name = "allocator-api2"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]]
name = "aml"
version = "0.16.4"
@ -291,7 +298,7 @@ dependencies = [
[[package]]
name = "asterinas"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"aster-frame",
"aster-framebuffer",
@ -510,6 +517,12 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "dary_heap"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7762d17f1241643615821a8455a0b2c3e803784b058693d990b11f2dce25a0ca"
[[package]]
name = "defmt"
version = "0.3.5"
@ -681,6 +694,10 @@ name = "hashbrown"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash",
"allocator-api2",
]
[[package]]
name = "heapless"
@ -835,19 +852,22 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libflate"
version = "1.4.0"
source = "git+https://github.com/asterinas/libflate?rev=b781da6#b781da6b6841e380f4cfa3529d5070afad56ea32"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7d5654ae1795afc7ff76f4365c2c8791b0feb18e8996a96adad8ffd7c3b2bf"
dependencies = [
"adler32",
"core2",
"crc32fast",
"dary_heap",
"libflate_lz77",
]
[[package]]
name = "libflate_lz77"
version = "1.2.0"
source = "git+https://github.com/asterinas/libflate?rev=b781da6#b781da6b6841e380f4cfa3529d5070afad56ea32"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be5f52fb8c451576ec6b79d3f4deb327398bc05bbdbd99021a6e77a4c855d524"
dependencies = [
"core2",
"hashbrown 0.13.2",
@ -901,11 +921,11 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "lru"
version = "0.9.0"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17"
checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc"
dependencies = [
"hashbrown 0.13.2",
"hashbrown 0.14.3",
]
[[package]]
@ -1621,3 +1641,23 @@ name = "zero"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fe21bcc34ca7fe6dd56cc2cb1261ea59d6b93620215aefb5ea6032265527784"
[[package]]
name = "zerocopy"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.49",
]

View File

@ -1,6 +1,6 @@
[package]
name = "asterinas"
version = "0.3.1"
version = "0.4.0"
edition = "2021"
[dependencies]

View File

@ -81,8 +81,8 @@ USERMODE_TESTABLE := \
services/libs/typeflags-util
# Maintain a list of kernel crates that can be tested with `cargo osdk test`
# The framework is tested independently, thus not included here
KTEST_TESTABLE := \
"framework/aster-frame" \
"services/aster-nix" \
"services/comps/block" \
"services/comps/console" \

View File

@ -3,7 +3,9 @@
A secure, fast, and general-purpose OS kernel written in Rust and compatible with Linux
</p>
[![Asterinas CI](https://github.com/asterinas/asterinas/actions/workflows/aster_ci.yml/badge.svg)](https://github.com/asterinas/asterinas/actions/workflows/aster_ci.yml)
[![Check License](https://github.com/asterinas/asterinas/actions/workflows/license_check.yml/badge.svg)](https://github.com/asterinas/asterinas/actions/workflows/license_check.yml)
[![Framework Test](https://github.com/asterinas/asterinas/actions/workflows/framework_test.yml/badge.svg)](https://github.com/asterinas/asterinas/actions/workflows/framework_test.yml)
[![Kernel Test](https://github.com/asterinas/asterinas/actions/workflows/kernel_test.yml/badge.svg)](https://github.com/asterinas/asterinas/actions/workflows/kernel_test.yml)
English | [中文版](README_CN.md)
@ -51,7 +53,7 @@ git clone https://github.com/asterinas/asterinas
2. Run a Docker container as the development environment.
```bash
docker run -it --privileged --network=host --device=/dev/kvm -v ./asterinas:/root/asterinas asterinas/asterinas:0.3.1
docker run -it --privileged --network=host --device=/dev/kvm -v ./asterinas:/root/asterinas asterinas/asterinas:0.4.0
```
3. Install the Asterinas OSDK from source.

View File

@ -47,7 +47,7 @@ git clone https://github.com/asterinas/asterinas
2. 运行一个作为开发环境的Docker容器。
```bash
docker run -it --privileged --network=host --device=/dev/kvm -v ./asterinas:/root/asterinas asterinas/asterinas:0.3.0
docker run -it --privileged --network=host --device=/dev/kvm -v ./asterinas:/root/asterinas asterinas/asterinas:0.4.0
```
3. 从源码编译安装 Asterinas OSDK

View File

@ -1 +1 @@
0.3.1
0.4.0

View File

@ -90,9 +90,7 @@ pub struct BarManager {
impl BarManager {
/// Gain access to the BAR space and return None if that BAR is set to be invisible or absent.
pub fn bar(&self, idx: u8) -> Option<Bar> {
let Some((bar, visible)) = self.bars[idx as usize].clone() else {
return None;
};
let (bar, visible) = self.bars[idx as usize].clone()?;
if visible {
Some(bar)
} else {

View File

@ -2,14 +2,13 @@
use alloc::vec;
use core::{
iter::Iterator,
marker::PhantomData,
ops::{BitAnd, BitOr, Not, Range},
};
use pod::Pod;
use super::{frame_allocator, HasPaddr, Paddr, VmIo};
use super::{frame_allocator, HasPaddr, VmIo};
use crate::{config::PAGE_SIZE, prelude::*, Error};
/// A collection of page frames (physical memory pages).

View File

@ -4,7 +4,7 @@ use core::ops::Range;
use bitflags::bitflags;
use super::{is_page_aligned, MapArea, MemorySet, Vaddr, VmFrameVec, VmIo};
use super::{is_page_aligned, MapArea, MemorySet, VmFrameVec, VmIo};
use crate::{arch::mm::PageTableFlags, config::PAGE_SIZE, prelude::*, sync::Mutex, Error};
/// Virtual memory space.

View File

@ -95,7 +95,6 @@ pub mod tree;
extern crate alloc;
use alloc::{boxed::Box, string::String};
use core::result::Result;
pub use ktest_proc_macro::ktest;
@ -220,9 +219,7 @@ impl core::iter::Iterator for KtestIter {
type Item = KtestItem;
fn next(&mut self) -> Option<Self::Item> {
let Some(ktest_item) = ktest_array!().get(self.index) else {
return None;
};
let ktest_item = ktest_array!().get(self.index)?;
self.index += 1;
Some(ktest_item.clone())
}

View File

@ -13,7 +13,6 @@ use alloc::{
vec,
vec::Vec,
};
use core::iter::{FromIterator, Iterator};
use crate::{
path::{KtestPath, PathElement},

View File

@ -1,6 +1,6 @@
[package]
name = "cargo-osdk"
version = "0.2.0"
version = "0.4.0"
edition = "2021"
description = "Accelerate OS development with Asterinas OSDK"
license = "MPL-2.0"

View File

@ -1,6 +1,6 @@
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"code-model": "kernel",
"cpu": "x86-64",
"arch": "x86_64",

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-12-01"
channel = "nightly-2024-01-01"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

View File

@ -51,14 +51,12 @@ bitflags = "1.3"
ringbuf = { version = "0.3.2", default-features = false, features = ["alloc"] }
keyable-arc = { path = "../libs/keyable-arc" }
# unzip initramfs
libflate = { git = "https://github.com/asterinas/libflate", rev = "b781da6", features = [
"no_std",
] }
libflate = { version ="2", default-features = false }
core2 = { version = "0.4", default_features = false, features = ["alloc"] }
lending-iterator = "0.1.7"
spin = "0.9.4"
vte = "0.10"
lru = "0.9.0"
lru = "0.12.3"
log = "0.4"
getrandom = { version = "0.2.10", default-features = false, features = [
"rdrand",

View File

@ -1,9 +1,7 @@
// SPDX-License-Identifier: MPL-2.0
use super::*;
use crate::{
device::PtyMaster, events::IoEvents, fs::inode_handle::FileIo, process::signal::Poller,
};
use crate::{events::IoEvents, fs::inode_handle::FileIo, process::signal::Poller};
/// Same major number with Linux.
const PTMX_MAJOR_NUM: u32 = 5;

View File

@ -2,10 +2,7 @@
use super::*;
use crate::{
device::PtySlave,
events::IoEvents,
fs::inode_handle::FileIo,
process::{signal::Poller, Gid, Uid},
device::PtySlave, events::IoEvents, fs::inode_handle::FileIo, process::signal::Poller,
};
/// Same major number with Linux, the minor number is the index of slave.

View File

@ -7,12 +7,8 @@ use core::{
use super::*;
use crate::{
events::{IoEvents, Observer},
fs::{
file_handle::FileLike,
file_table::{FdEvents, FileDescripter},
utils::IoctlCmd,
},
events::Observer,
fs::{file_handle::FileLike, file_table::FdEvents, utils::IoctlCmd},
process::signal::{Pollee, Poller},
};

View File

@ -342,9 +342,7 @@ impl GroupMetadata {
}
pub fn alloc_inode(&mut self, is_dir: bool) -> Option<u32> {
let Some(inode_idx) = self.inode_bitmap.alloc() else {
return None;
};
let inode_idx = self.inode_bitmap.alloc()?;
self.dec_free_inodes();
if is_dir {
self.inc_dirs();
@ -365,9 +363,7 @@ impl GroupMetadata {
}
pub fn alloc_block(&mut self) -> Option<u32> {
let Some(block_idx) = self.block_bitmap.alloc() else {
return None;
};
let block_idx = self.block_bitmap.alloc()?;
self.dec_free_blocks();
Some(block_idx as u32)
}

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
use core::iter::Iterator;
use super::{
inode::{FileType, MAX_FNAME_LEN},
prelude::*,

View File

@ -2,8 +2,6 @@
//! Opend File Handle
use core::any::Any;
use crate::{
events::{IoEvents, Observer},
fs::{

View File

@ -1,14 +1,10 @@
// SPDX-License-Identifier: MPL-2.0
use aster_rights::{Rights, TRights};
use aster_rights::TRights;
use inherit_methods_macro::inherit_methods;
use super::*;
use crate::{
events::IoEvents,
prelude::*,
process::{signal::Poller, Gid, Uid},
};
use crate::prelude::*;
impl InodeHandle<Rights> {
pub fn new(

View File

@ -1,6 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
use alloc::string::String;
use core::{
sync::atomic::{AtomicU32, Ordering},
time::Duration,

View File

@ -6,23 +6,23 @@
#![allow(dead_code)]
#![allow(incomplete_features)]
#![allow(unused_variables)]
#![feature(exclusive_range_pattern)]
#![feature(btree_cursors)]
#![feature(btree_extract_if)]
#![feature(const_option)]
#![feature(exclusive_range_pattern)]
#![feature(extend_one)]
#![feature(fn_traits)]
#![feature(format_args_nl)]
#![feature(int_roundings)]
#![feature(let_chains)]
#![feature(linked_list_remove)]
#![feature(register_tool)]
// FIXME: This feature is used to support vm capbility now as a work around.
// Since this is an incomplete feature, use this feature is unsafe.
// We should find a proper method to replace this feature with min_specialization, which is a sound feature.
#![feature(specialization)]
#![feature(fn_traits)]
#![feature(linked_list_remove)]
#![feature(trait_alias)]
#![feature(register_tool)]
#![feature(format_args_nl)]
#![feature(int_roundings)]
#![feature(step_trait)]
#![feature(btree_cursors)]
#![feature(trait_alias)]
#![register_tool(component_access_control)]
use aster_frame::{

View File

@ -1,6 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
use aster_frame::sync::SpinLock;
use aster_network::AnyNetworkDevice;
use aster_virtio::device::network::DEVICE_NAME;
use smoltcp::{

View File

@ -1,6 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
use alloc::sync::Arc;
use core::sync::atomic::{AtomicBool, Ordering};
use super::{connected::ConnectedStream, init::InitStream};

View File

@ -210,10 +210,7 @@ pub fn handle_user_signal(
/// It the stack is not used by any handler, we will return the new sp in alternate signal stack.
fn use_alternate_signal_stack(posix_thread: &PosixThread) -> Option<usize> {
let mut sig_stack = posix_thread.sig_stack().lock();
let Some(sig_stack) = &mut *sig_stack else {
return None;
};
let sig_stack = (*sig_stack).as_mut()?;
if sig_stack.is_disabled() {
return None;

View File

@ -2,10 +2,7 @@
//! Posix thread implementation
use core::{
any::Any,
sync::atomic::{AtomicU32, Ordering},
};
use core::sync::atomic::{AtomicU32, Ordering};
use aster_frame::task::Task;

View File

@ -146,13 +146,10 @@ impl WorkQueue {
/// the calling worker is located.
fn dequeue(&self, request_cpu: u32) -> Option<Arc<WorkItem>> {
let mut inner = self.inner.lock_irq_disabled();
let Some(index) = inner
let index = inner
.pending_work_items
.iter()
.position(|item| item.is_valid_cpu(request_cpu))
else {
return None;
};
.position(|item| item.is_valid_cpu(request_cpu))?;
let item = inner.pending_work_items.remove(index);
Some(item)
}

View File

@ -2,7 +2,7 @@
use core::ops::Range;
use aster_frame::vm::{Vaddr, VmIo};
use aster_frame::vm::VmIo;
use aster_rights::Rights;
use super::{

View File

@ -8,11 +8,6 @@ mod options;
mod static_cap;
pub mod vm_mapping;
use alloc::{
collections::BTreeMap,
sync::{Arc, Weak},
vec::Vec,
};
use core::ops::Range;
use align_ext::AlignExt;

View File

@ -2,10 +2,7 @@
use core::ops::Range;
use aster_frame::{
sync::Mutex,
vm::{VmFrame, VmFrameVec, VmIo, VmMapOptions, VmPerm, VmSpace},
};
use aster_frame::vm::{VmFrame, VmFrameVec, VmIo, VmMapOptions, VmPerm, VmSpace};
use super::{interval::Interval, is_intersected, Vmar, Vmar_};
use crate::{

View File

@ -61,9 +61,7 @@ pub fn register_device(name: String, device: Arc<SpinLock<Box<dyn AnyNetworkDevi
pub fn get_device(str: &str) -> Option<Arc<SpinLock<Box<dyn AnyNetworkDevice>>>> {
let lock = COMPONENT.get().unwrap().network_device_table.lock();
let Some((_, device)) = lock.get(str) else {
return None;
};
let (_, device) = lock.get(str)?;
Some(device.clone())
}

View File

@ -112,7 +112,6 @@ use alloc::sync::{Arc, Weak};
use core::{
borrow::Borrow,
cmp::Ordering,
convert::AsRef,
fmt,
hash::{Hash, Hasher},
marker::Unsize,

View File

@ -20,6 +20,7 @@ update_image_versions() {
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
ASTER_SRC_DIR=${SCRIPT_DIR}/..
CARGO_TOML_PATH=${ASTER_SRC_DIR}/Cargo.toml
OSDK_CARGO_TOML_PATH=${ASTER_SRC_DIR}/osdk/Cargo.toml
VERSION_PATH=${ASTER_SRC_DIR}/VERSION
# Get and check the new version number
@ -32,6 +33,7 @@ fi
# Update Cargo.toml
update_cargo_versions ${CARGO_TOML_PATH}
update_cargo_versions ${OSDK_CARGO_TOML_PATH}
# Automatically bump Cargo.lock file
cargo update -p asterinas --precise $new_version
@ -50,4 +52,4 @@ done
# Create or update VERSION
echo "${new_version}" > ${VERSION_PATH}
echo "Bumped Asterinas version to $new_version"
echo "Bumped Asterinas & OSDK version to $new_version"

View File

@ -91,12 +91,12 @@ RUN apt clean && rm -rf /var/lib/apt/lists/*
FROM build-qemu as qemu
# Fetch and install QEMU from https://download.qemu.org/qemu-8.1.1.tar.xz
# Fetch and install QEMU from the official source
#
# The QEMU version in the Ubuntu 22.04 repository is 6.*, which has a bug to cause OVMF debug to fail.
# The libslirp dependency is for QEMU's network backend.
WORKDIR /root
RUN wget -O qemu.tar.xz https://download.qemu.org/qemu-8.1.1.tar.xz \
RUN wget -O qemu.tar.xz https://download.qemu.org/qemu-8.2.1.tar.xz \
&& mkdir /root/qemu \
&& tar xf qemu.tar.xz --strip-components=1 -C /root/qemu \
&& rm qemu.tar.xz
@ -123,7 +123,7 @@ FROM build-ovmf as ovmf
# Fetch and build OVMF from the EDK2 official source
WORKDIR /root
RUN git clone --depth 1 --branch edk2-stable202311 --recurse-submodules --shallow-submodules https://github.com/tianocore/edk2.git
RUN git clone --depth 1 --branch edk2-stable202402 --recurse-submodules --shallow-submodules https://github.com/tianocore/edk2.git
WORKDIR /root/edk2
RUN source ./edksetup.sh \
&& make -C BaseTools \
@ -142,6 +142,7 @@ RUN apt update && apt-get install -y --no-install-recommends \
flex \
gawk \
gettext \
libfreetype6-dev \
pkg-config
RUN apt clean && rm -rf /var/lib/apt/lists/*
@ -153,13 +154,24 @@ FROM build-grub as grub
# in the GRUB release. The Ubuntu release notoriously modifies the GRUB source code and enforce
# EFI handover boot, which is deprecated. So we have to build GRUB from source.
WORKDIR /root
RUN wget -O grub.tar.xz https://git.savannah.gnu.org/cgit/grub.git/snapshot/grub-grub-2.12-rc1.tar.gz \
RUN wget -O grub.tar.xz https://ftp.gnu.org/gnu/grub/grub-2.12.tar.xz \
&& mkdir /root/grub \
&& tar xf grub.tar.xz --strip-components=1 -C /root/grub \
&& rm grub.tar.xz
# Fetch and install the Unicode font data for grub.
RUN wget -O unifont.pcf.gz https://unifoundry.com/pub/unifont/unifont-15.1.04/font-builds/unifont-15.1.04.pcf.gz \
&& mkdir -pv /usr/share/fonts/unifont \
&& gunzip -c unifont.pcf.gz > /usr/share/fonts/unifont/unifont.pcf \
&& rm unifont.pcf.gz
WORKDIR /root/grub
RUN ./bootstrap \
&& ./configure --target=x86_64 --with-platform=efi --prefix=/usr/local/grub \
RUN echo depends bli part_gpt > grub-core/extra_deps.lst \
&& ./configure \
--target=x86_64 \
--disable-efiemu \
--with-platform=efi \
--enable-grub-mkfont \
--prefix=/usr/local/grub \
--disable-werror \
&& make -j \
&& make install
WORKDIR /root
@ -188,11 +200,12 @@ RUN make defconfig \
FROM build-base as rust
# Install Rust
# Install Rust with both nightly and stable
ENV PATH="/root/.cargo/bin:${PATH}"
ARG ASTER_RUST_VERSION
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain ${ASTER_RUST_VERSION} -y \
&& rustup toolchain install stable \
&& rm -rf /root/.cargo/registry && rm -rf /root/.cargo/git \
&& cargo -V \
&& rustup component add rust-src rustc-dev llvm-tools-preview