Add support for only creating redoxfs partition installer.

This commit is contained in:
4lDO2
2025-03-27 14:25:23 +01:00
parent a78377da19
commit d85eceac71
3 changed files with 18 additions and 1 deletions
+1
View File
@@ -305,6 +305,7 @@ fn main() {
bootloader_efi: &bootloader_efi,
password_opt: password_opt.as_ref().map(|x| x.as_bytes()),
efi_partition_size: None,
skip_partitions: false, // TODO?
};
let res = with_whole_disk(&disk_path, &disk_option, |mount_path| -> Result<()> {
let mut config: Config = Config::from_file(&root_path.join("filesystem.toml"))?;
+2
View File
@@ -5,6 +5,7 @@ pub struct GeneralConfig {
pub repo_binary: Option<bool>,
pub filesystem_size: Option<u32>, //MiB
pub efi_partition_size: Option<u32>, //MiB
pub skip_partitions: Option<bool>,
}
impl GeneralConfig {
@@ -13,5 +14,6 @@ impl GeneralConfig {
self.repo_binary = other.repo_binary.or(self.repo_binary);
self.filesystem_size = other.filesystem_size.or(self.filesystem_size);
self.efi_partition_size = other.efi_partition_size.or(self.efi_partition_size);
self.skip_partitions = other.skip_partitions.or(self.skip_partitions);
}
}
+15 -1
View File
@@ -33,6 +33,7 @@ pub struct DiskOption<'a> {
pub bootloader_efi: &'a [u8],
pub password_opt: Option<&'a [u8]>,
pub efi_partition_size: Option<u32>, //MiB
pub skip_partitions: bool,
}
fn get_target() -> String {
@@ -539,12 +540,24 @@ where
bail!("target '{target}' not supported");
}
};
// Open disk and read metadata
eprintln!("Opening disk {}", disk_path.as_ref().display());
let mut disk_file = DiskWrapper::open(disk_path.as_ref())?;
let disk_size = disk_file.size();
let block_size = disk_file.block_size() as u64;
if disk_option.skip_partitions {
return with_redoxfs(
DiskIo(fscommon::StreamSlice::new(
disk_file,
0,
disk_size.next_multiple_of(block_size),
)?),
disk_option.password_opt,
callback,
);
}
let gpt_block_size = match block_size {
512 => gpt::disk::LogicalBlockSize::Lb512,
_ => {
@@ -711,6 +724,7 @@ fn install_inner(config: Config, output: &Path, cookbook: Option<&str>, live: bo
bootloader_efi: &bootloader_efi,
password_opt: None,
efi_partition_size: config.general.efi_partition_size,
skip_partitions: config.general.skip_partitions.unwrap_or(false),
};
with_whole_disk(output, &disk_option, move |mount_path| {
install_dir(config, mount_path, cookbook)