Skip to content

Commit cf6813c

Browse files
committed
--h2o-capsule: Remove and replace with --capsule
All behavior is implemented in --capsule now. No need to make it two separate commands. Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent fb8dcba commit cf6813c

8 files changed

Lines changed: 28 additions & 70 deletions

File tree

EXAMPLES.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ Options:
6767
Parse UEFI Capsule information from binary file
6868
--dump <DUMP>
6969
Dump extracted UX capsule bitmap image to a file
70-
--h2o-capsule <H2O_CAPSULE>
71-
Parse UEFI Capsule information from binary file
7270
--dump-ec-flash <DUMP_EC_FLASH>
7371
Dump EC flash contents
7472
--flash-ec <FLASH_EC>

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,11 @@ On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a f
9090
- [x] CCG5 PD (11th Gen TigerLake) (`--pd-bin`)
9191
- [x] CCG6 PD (Intel systems, Framework Desktop) (`--pd-bin`)
9292
- [x] CCG8 PD (AMD Laptops) (`--pd-bin`)
93-
- [x] H2O BIOS Capsule (`--h2o-capsule`)
94-
- [x] BIOS Version
95-
- [x] EC Version
96-
- [x] CCG5/CCG6/CCG8 PD Version
9793
- [x] UEFI Capsule (`--capsule`)
98-
- [x] Parse metadata from capsule binary
99-
- [x] Determine type (GUID) of capsule binary
100-
- [x] Extract bitmap image from winux capsule to file
94+
- [x] Determine type (GUID) of capsule binary
95+
- [x] Extract embedded BIOS, EC, and PD versions
96+
- [x] Extract bitmap image from winux capsule to file
97+
- [x] Fallback to raw H2O BIOS files without capsule header
10198
- [x] Get firmware version from system (`--versions`)
10299
- [x] BIOS
103100
- [x] EC

completions/bash/framework_tool

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _framework_tool() {
2323

2424
case "${cmd}" in
2525
framework_tool)
26-
opts="-v -q -t -f -h --flash-gpu-descriptor --verbose --quiet --versions --version --features --esrt --device --compare-version --power --thermal --sensors --fansetduty --fansetrpm --autofanctrl --pdports --info --meinfo --pd-info --pd-reset --pd-disable --pd-enable --dp-hdmi-info --dp-hdmi-update --audio-card-info --privacy --pd-bin --ec-bin --capsule --dump --h2o-capsule --dump-ec-flash --flash-ec --flash-ro-ec --flash-rw-ec --intrusion --inputdeck --inputdeck-mode --expansion-bay --charge-limit --charge-current-limit --charge-rate-limit --get-gpio --fp-led-level --fp-brightness --kblight --remap-key --rgbkbd --ps2-enable --tablet-mode --touchscreen-enable --stylus-battery --console --reboot-ec --ec-hib-delay --uptimeinfo --s0ix-counter --hash --driver --pd-addrs --pd-ports --test --test-retimer --boardid --force --dry-run --flash-gpu-descriptor-file --dump-gpu-descriptor-file --nvidia --host-command --generate-completions --help"
26+
opts="-v -q -t -f -h --flash-gpu-descriptor --verbose --quiet --versions --version --features --esrt --device --compare-version --power --thermal --sensors --fansetduty --fansetrpm --autofanctrl --pdports --info --meinfo --pd-info --pd-reset --pd-disable --pd-enable --dp-hdmi-info --dp-hdmi-update --audio-card-info --privacy --pd-bin --ec-bin --capsule --dump --dump-ec-flash --flash-ec --flash-ro-ec --flash-rw-ec --intrusion --inputdeck --inputdeck-mode --expansion-bay --charge-limit --charge-current-limit --charge-rate-limit --get-gpio --fp-led-level --fp-brightness --kblight --remap-key --rgbkbd --ps2-enable --tablet-mode --touchscreen-enable --stylus-battery --console --reboot-ec --ec-hib-delay --uptimeinfo --s0ix-counter --hash --driver --pd-addrs --pd-ports --test --test-retimer --boardid --force --dry-run --flash-gpu-descriptor-file --dump-gpu-descriptor-file --nvidia --host-command --generate-completions --help"
2727
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
2828
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
2929
return 0
@@ -89,10 +89,6 @@ _framework_tool() {
8989
COMPREPLY=($(compgen -f "${cur}"))
9090
return 0
9191
;;
92-
--h2o-capsule)
93-
COMPREPLY=($(compgen -f "${cur}"))
94-
return 0
95-
;;
9692
--dump-ec-flash)
9793
COMPREPLY=($(compgen -f "${cur}"))
9894
return 0

completions/fish/framework_tool.fish

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ complete -c framework_tool -l pd-bin -d 'Parse versions from PD firmware binary
2020
complete -c framework_tool -l ec-bin -d 'Parse versions from EC firmware binary file' -r -F
2121
complete -c framework_tool -l capsule -d 'Parse UEFI Capsule information from binary file' -r -F
2222
complete -c framework_tool -l dump -d 'Dump extracted UX capsule bitmap image to a file' -r -F
23-
complete -c framework_tool -l h2o-capsule -d 'Parse UEFI Capsule information from binary file' -r -F
2423
complete -c framework_tool -l dump-ec-flash -d 'Dump EC flash contents' -r -F
2524
complete -c framework_tool -l flash-ec -d 'Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable!' -r -F
2625
complete -c framework_tool -l flash-ro-ec -d 'Flash EC with new RO firmware from file - may render your hardware unbootable!' -r -F

completions/zsh/_framework_tool

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ _framework_tool() {
3030
'--ec-bin=[Parse versions from EC firmware binary file]:EC_BIN:_files' \
3131
'--capsule=[Parse UEFI Capsule information from binary file]:CAPSULE:_files' \
3232
'--dump=[Dump extracted UX capsule bitmap image to a file]:DUMP:_files' \
33-
'--h2o-capsule=[Parse UEFI Capsule information from binary file]:H2O_CAPSULE:_files' \
3433
'--dump-ec-flash=[Dump EC flash contents]:DUMP_EC_FLASH:_files' \
3534
'--flash-ec=[Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable!]:FLASH_EC:_files' \
3635
'--flash-ro-ec=[Flash EC with new RO firmware from file - may render your hardware unbootable!]:FLASH_RO_EC:_files' \

framework_lib/src/commandline/clap_std.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ struct ClapCli {
135135
#[arg(long)]
136136
dump: Option<std::path::PathBuf>,
137137

138-
/// Parse UEFI Capsule information from binary file
139-
#[arg(long)]
140-
h2o_capsule: Option<std::path::PathBuf>,
141-
142138
/// Dump EC flash contents
143139
#[arg(long)]
144140
dump_ec_flash: Option<std::path::PathBuf>,
@@ -491,9 +487,6 @@ pub fn parse(args: &[String]) -> Cli {
491487
.capsule
492488
.map(|x| x.into_os_string().into_string().unwrap()),
493489
dump: args.dump.map(|x| x.into_os_string().into_string().unwrap()),
494-
h2o_capsule: args
495-
.h2o_capsule
496-
.map(|x| x.into_os_string().into_string().unwrap()),
497490
dump_ec_flash: args
498491
.dump_ec_flash
499492
.map(|x| x.into_os_string().into_string().unwrap()),

framework_lib/src/commandline/mod.rs

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ pub struct Cli {
184184
pub ec_bin: Option<String>,
185185
pub capsule: Option<String>,
186186
pub dump: Option<String>,
187-
pub h2o_capsule: Option<String>,
188187
pub dump_ec_flash: Option<String>,
189188
pub flash_ec: Option<String>,
190189
pub flash_ro_ec: Option<String>,
@@ -272,7 +271,6 @@ pub fn parse(args: &[String]) -> Cli {
272271
ec_bin: cli.ec_bin,
273272
capsule: cli.capsule,
274273
dump: cli.dump,
275-
h2o_capsule: cli.h2o_capsule,
276274
// dump_ec_flash
277275
// flash_ec
278276
// flash_ro_ec
@@ -1678,41 +1676,29 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
16781676
}
16791677
}
16801678
} else {
1681-
println!("Capsule is invalid.");
1682-
}
1683-
}
1684-
} else if let Some(capsule_path) = &args.h2o_capsule {
1685-
#[cfg(feature = "uefi")]
1686-
let data = crate::fw_uefi::fs::shell_read_file(capsule_path);
1687-
#[cfg(not(feature = "uefi"))]
1688-
let data = match fs::read(capsule_path) {
1689-
Ok(data) => Some(data),
1690-
// TODO: Perhaps a more user-friendly error
1691-
Err(e) => {
1692-
println!("Error {:?}", e);
1693-
None
1694-
}
1695-
};
1696-
1697-
if let Some(data) = data {
1698-
println!("File");
1699-
println!(" Size: {:>20} B", data.len());
1700-
println!(" Size: {:>20} KB", data.len() / 1024);
1701-
if let Some(cap) = find_bios_version(&data) {
1702-
println!(" BIOS Platform:{:>18}", cap.platform);
1703-
println!(" BIOS Version: {:>18}", cap.version);
1704-
}
1705-
if let Some(ec_bin) = find_ec_in_bios_cap(&data) {
1706-
debug!("Found EC binary in BIOS capsule");
1707-
analyze_ec_fw(ec_bin);
1708-
} else {
1709-
debug!("Didn't find EC binary in BIOS capsule");
1710-
}
1711-
if let Some(pd_bin) = find_pd_in_bios_cap(&data) {
1712-
debug!("Found PD binary in BIOS capsule");
1713-
analyze_ccgx_pd_fw(pd_bin);
1714-
} else {
1715-
debug!("Didn't find PD binary in BIOS capsule");
1679+
// No valid capsule header - try to extract embedded firmware directly
1680+
// This handles raw H2O BIOS files that aren't wrapped in a UEFI capsule
1681+
println!("No valid capsule header, searching for embedded firmware...");
1682+
let mut found_any = false;
1683+
if let Some(cap) = find_bios_version(&data) {
1684+
found_any = true;
1685+
println!("BIOS");
1686+
println!(" Platform: {:>18}", cap.platform);
1687+
println!(" Version: {:>18}", cap.version);
1688+
}
1689+
if let Some(ec_bin) = find_ec_in_bios_cap(&data) {
1690+
found_any = true;
1691+
println!("Embedded EC");
1692+
analyze_ec_fw(ec_bin);
1693+
}
1694+
if let Some(pd_bin) = find_pd_in_bios_cap(&data) {
1695+
found_any = true;
1696+
println!("Embedded PD");
1697+
analyze_ccgx_pd_fw(pd_bin);
1698+
}
1699+
if !found_any {
1700+
println!("No embedded firmware found.");
1701+
}
17161702
}
17171703
}
17181704
} else if let Some(dump_path) = &args.dump_ec_flash {
@@ -1829,7 +1815,6 @@ Options:
18291815
--ec-bin <EC_BIN> Parse versions from EC firmware binary file
18301816
--capsule <CAPSULE> Parse UEFI Capsule information from binary file
18311817
--dump <DUMP> Dump extracted UX capsule bitmap image to a file
1832-
--h2o-capsule <H2O_CAPSULE> Parse UEFI Capsule information from binary file
18331818
--dump-ec-flash <DUMP_EC_FLASH> Dump EC flash contents
18341819
--flash-ec <FLASH_EC> Flash EC with new firmware from file
18351820
--flash-ro-ec <FLASH_EC> Flash EC with new firmware from file

framework_lib/src/commandline/uefi.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ pub fn parse(args: &[String]) -> Cli {
6262
flash_rw_ec: None,
6363
capsule: None,
6464
dump: None,
65-
h2o_capsule: None,
6665
intrusion: false,
6766
inputdeck: false,
6867
inputdeck_mode: None,
@@ -623,14 +622,6 @@ pub fn parse(args: &[String]) -> Cli {
623622
None
624623
};
625624
found_an_option = true;
626-
} else if arg == "--h2o-capsule" {
627-
cli.h2o_capsule = if args.len() > i + 1 {
628-
Some(args[i + 1].clone())
629-
} else {
630-
println!("--h2o-capsule requires extra argument to denote input file");
631-
None
632-
};
633-
found_an_option = true;
634625
} else if arg == "--dump-ec-flash" {
635626
cli.dump_ec_flash = if args.len() > i + 1 {
636627
Some(args[i + 1].clone())

0 commit comments

Comments
 (0)