Skip to content
Open
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
39 changes: 39 additions & 0 deletions devices/loongson/2k0300/base.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
aosc-aaa
zstd
zlib
gcc-runtime
wpa-supplicant
net-tools
less
xz
bash
apt
curl
kbd
gzip
dbus
networkmanager
wget
dpkg
shadow
sudo
iw
oma
iproute2
util-linux
which
kmod
procps
findutils
psmisc
diffutils
sed
grep
tar
gawk
coreutils
nano
vim
inetutils
systemd
binutils
31 changes: 31 additions & 0 deletions devices/loongson/2k0300/device.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
id = "2k0300"

vendor = "loongson"

arch = "loong_arch64"

name = "Generic LS2K0300 Board"

bsp_packages = [
"linux-kernel-loongarch-2k0300-6.12.35"
]

initrdless = true

partition_map = "dos"

num_partitions = 1

[size]
base = 4096
desktop = 4096
server = 4096

[[partition]]
no = 1
type = "linux"
size_in_sectors = 0
mountpoint = "/"
filesystem = "ext4"
usage = "rootfs"
fs_label = "AOSC OS"
2 changes: 2 additions & 0 deletions devices/loongson/2k0300/sources.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deb https://repo-hk.aosc.io/debs stable bsp-loongarch64-nosimd
deb [arch=all] https://repo-hk.aosc.io/debs stable main
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,15 @@ fn try_main(cmdline: Cmdline) -> Result<()> {
.file_path
.parent()
.expect("device.toml should have a parent dir");

let sources_list_path = dir.join("sources.list");
let sources_list: Option<PathBuf> =
sources_list_path.exists().then_some(sources_list_path);

let recipe_list_path = dir.join(&format!("{}.lst", variant_str));
let recipe_list: Option<PathBuf> =
recipe_list_path.exists().then_some(recipe_list_path);

if !bootstrap_path.is_dir() || !(bootstrap_path.join("etc/os-release")).exists()
{
bootstrap_distribution(
Expand All @@ -436,6 +442,7 @@ fn try_main(cmdline: Cmdline) -> Result<()> {
arch,
Some(&cmdline.mirror),
sources_list,
recipe_list,
)?;
}
}
Expand Down
18 changes: 13 additions & 5 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,21 @@ pub fn bootstrap_distribution<P: AsRef<Path>, S: AsRef<str>>(
arch: DeviceArch,
mirror: Option<S>,
sources_list: Option<P>,
recipe_list: Option<P>,
) -> Result<()> {
let path = path.as_ref();
let mirror = mirror.as_ref();
let sources_list = sources_list.as_ref();
let recipe_list = recipe_list.as_ref();

if sources_list.is_some() && mirror.is_some() {
info!("--sources-list is provided, will ignore mirror option...");
}

if recipe_list.is_some() {
info!("recipe.lst is provided, will ignore varient...");
}

// Display a progressbar
setup_scroll_region();

Expand Down Expand Up @@ -131,9 +137,11 @@ pub fn bootstrap_distribution<P: AsRef<Path>, S: AsRef<str>>(
if sources_list.is_none() {
command.args(["-s", &format!("{}/{}", AB_DIR, "scripts/reset-repo.sh")]);
}
command
.args(["-s", &format!("{}/{}", AB_DIR, "scripts/enable-dkms.sh")])
.args([
command.args(["-s", &format!("{}/{}", AB_DIR, "scripts/enable-dkms.sh")]);
let command = if let Some(recipe_list) = recipe_list {
command.args(["--include-files", recipe_list.as_ref().to_str().unwrap()])
} else {
command.args([
"--include-files",
&format!(
"{}/recipes/mainline/{}-common.lst",
Expand All @@ -143,8 +151,8 @@ pub fn bootstrap_distribution<P: AsRef<Path>, S: AsRef<str>>(
_ => variant.to_string().to_lowercase(),
}
),
]);

])
};
debug!("Running command {:?} ...", command);
let status = command.status().context("Failed to run aoscbootstrap")?;
// Recover the terminal
Expand Down