Skip to content

Commit

Permalink
s390x: add support for IBM Z DASD disks
Browse files Browse the repository at this point in the history
Installation on DASD disks is a bit tricky,
this patch makes coreos-installer able to format,
create partitions, and finally install CoreOS on s390x.

Signed-off-by: Nikita Dubrovskii <[email protected]>
  • Loading branch information
nikita-dubrovskii committed Apr 29, 2020
1 parent 65ba0d5 commit 02917e1
Show file tree
Hide file tree
Showing 8 changed files with 800 additions and 7 deletions.
229 changes: 226 additions & 3 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ path = "src/main.rs"
[profile.release]
lto = true

[target.'cfg(target_arch = "s390x")'.dependencies]
dd-lib = "0.2.1"
walkdir = "2.3.1"
fdisk="^0.1.1"
tempfile = "^3.1.0"

[dependencies]
byte-unit = "^3.0"
clap = "^2.33"
Expand Down
20 changes: 16 additions & 4 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,16 @@ fn write_disk(
dest: &mut File,
ignition: Option<File>,
) -> Result<()> {
// Get sector size of destination, for comparing with image
let sector_size = get_sector_size(dest)?;

// copy the image
write_image(source, dest, true, Some(sector_size))?;
if cfg!(target_arch = "s390x") && config.device.contains("dasd") {
#[cfg(target_arch = "s390x")]
crate::s390x::dasd::write_image_s390(config, source)?;
} else {
// Get sector size of destination, for comparing with image
let sector_size = get_sector_size(dest)?;
write_image(source, dest, true, Some(sector_size))?;
}

reread_partition_table(dest)?;
udev_settle()?;

Expand All @@ -172,6 +177,7 @@ fn write_disk(
|| config.firstboot_kargs.is_some()
|| config.platform.is_some()
|| config.network_config.is_some()
|| cfg!(target_arch = "s390x")
{
let mount = mount_partition_by_label(&config.device, "boot", mount::MsFlags::empty())?;
if let Some(ignition) = ignition {
Expand All @@ -188,6 +194,12 @@ fn write_disk(
if let Some(network_config) = config.network_config.as_ref() {
copy_network_config(mount.mountpoint(), network_config)?;
}
#[cfg(target_arch = "s390x")]
crate::s390x::zipl::install_bootloader(
mount.mountpoint(),
&config.device,
&config.firstboot_kargs,
)?;
}

Ok(())
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ mod download;
mod errors;
mod install;
mod iso;
#[cfg(target_arch = "s390x")]
mod s390x;
mod source;
mod verify;

Expand Down
10 changes: 10 additions & 0 deletions src/s390x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# CoreOS installation on IBM Z

IBM s390x machines usually have DASD (Direct Access Storage Devices) disks.

To use DASD as a Linux harddisk we have to pass thru several steps:
1) Using `dasdfmt` tool we have to low-level format it
2) Using `fdasd` tool we have to create partition(s) on it
3) Copy each partition from CoreOS image to corresponding partition on DASD)
4) Using `zipl` tool install boot loader
5) Using `chreipl` tool mark DASD as next boot devcie
Loading

0 comments on commit 02917e1

Please sign in to comment.