Skip to content

Commit c2fc4a0

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 28fb73a commit c2fc4a0

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
@@ -108,14 +108,11 @@ On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a f
108108
- [x] CCG5 PD (11th Gen TigerLake) (`--pd-bin`)
109109
- [x] CCG6 PD (Intel systems, Framework Desktop) (`--pd-bin`)
110110
- [x] CCG8 PD (AMD Laptops) (`--pd-bin`)
111-
- [x] H2O BIOS Capsule (`--h2o-capsule`)
112-
- [x] BIOS Version
113-
- [x] EC Version
114-
- [x] CCG5/CCG6/CCG8 PD Version
115111
- [x] UEFI Capsule (`--capsule`)
116-
- [x] Parse metadata from capsule binary
117-
- [x] Determine type (GUID) of capsule binary
118-
- [x] Extract bitmap image from winux capsule to file
112+
- [x] Determine type (GUID) of capsule binary
113+
- [x] Extract embedded BIOS, EC, and PD versions
114+
- [x] Extract bitmap image from winux capsule to file
115+
- [x] Fallback to raw H2O BIOS files without capsule header
119116
- [x] Get firmware version from system (`--versions`)
120117
- [x] BIOS
121118
- [x] EC

framework_lib/src/commandline/clap_std.rs

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

142-
/// Parse UEFI Capsule information from binary file
143-
#[arg(long)]
144-
h2o_capsule: Option<std::path::PathBuf>,
145-
146142
/// Dump EC flash contents
147143
#[arg(long)]
148144
dump_ec_flash: Option<std::path::PathBuf>,
@@ -500,9 +496,6 @@ pub fn parse(args: &[String]) -> Cli {
500496
.capsule
501497
.map(|x| x.into_os_string().into_string().unwrap()),
502498
dump: args.dump.map(|x| x.into_os_string().into_string().unwrap()),
503-
h2o_capsule: args
504-
.h2o_capsule
505-
.map(|x| x.into_os_string().into_string().unwrap()),
506499
dump_ec_flash: args
507500
.dump_ec_flash
508501
.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_full_ec: Option<String>,
190189
pub flash_ec: Option<String>,
@@ -274,7 +273,6 @@ pub fn parse(args: &[String]) -> Cli {
274273
ec_bin: cli.ec_bin,
275274
capsule: cli.capsule,
276275
dump: cli.dump,
277-
h2o_capsule: cli.h2o_capsule,
278276
// dump_ec_flash
279277
// flash_full_ec
280278
// flash_ec
@@ -1701,41 +1699,29 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
17011699
}
17021700
}
17031701
} else {
1704-
println!("Capsule is invalid.");
1705-
}
1706-
}
1707-
} else if let Some(capsule_path) = &args.h2o_capsule {
1708-
#[cfg(feature = "uefi")]
1709-
let data = crate::fw_uefi::fs::shell_read_file(capsule_path);
1710-
#[cfg(not(feature = "uefi"))]
1711-
let data = match fs::read(capsule_path) {
1712-
Ok(data) => Some(data),
1713-
// TODO: Perhaps a more user-friendly error
1714-
Err(e) => {
1715-
println!("Error {:?}", e);
1716-
None
1717-
}
1718-
};
1719-
1720-
if let Some(data) = data {
1721-
println!("File");
1722-
println!(" Size: {:>20} B", data.len());
1723-
println!(" Size: {:>20} KB", data.len() / 1024);
1724-
if let Some(cap) = find_bios_version(&data) {
1725-
println!(" BIOS Platform:{:>18}", cap.platform);
1726-
println!(" BIOS Version: {:>18}", cap.version);
1727-
}
1728-
if let Some(ec_bin) = find_ec_in_bios_cap(&data) {
1729-
debug!("Found EC binary in BIOS capsule");
1730-
analyze_ec_fw(ec_bin);
1731-
} else {
1732-
debug!("Didn't find EC binary in BIOS capsule");
1733-
}
1734-
if let Some(pd_bin) = find_pd_in_bios_cap(&data) {
1735-
debug!("Found PD binary in BIOS capsule");
1736-
analyze_ccgx_pd_fw(pd_bin);
1737-
} else {
1738-
debug!("Didn't find PD binary in BIOS capsule");
1702+
// No valid capsule header - try to extract embedded firmware directly
1703+
// This handles raw H2O BIOS files that aren't wrapped in a UEFI capsule
1704+
println!("No valid capsule header, searching for embedded firmware...");
1705+
let mut found_any = false;
1706+
if let Some(cap) = find_bios_version(&data) {
1707+
found_any = true;
1708+
println!("BIOS");
1709+
println!(" Platform: {:>18}", cap.platform);
1710+
println!(" Version: {:>18}", cap.version);
1711+
}
1712+
if let Some(ec_bin) = find_ec_in_bios_cap(&data) {
1713+
found_any = true;
1714+
println!("Embedded EC");
1715+
analyze_ec_fw(ec_bin);
1716+
}
1717+
if let Some(pd_bin) = find_pd_in_bios_cap(&data) {
1718+
found_any = true;
1719+
println!("Embedded PD");
1720+
analyze_ccgx_pd_fw(pd_bin);
1721+
}
1722+
if !found_any {
1723+
println!("No embedded firmware found.");
1724+
}
17391725
}
17401726
}
17411727
} else if let Some(dump_path) = &args.dump_ec_flash {
@@ -1863,7 +1849,6 @@ Options:
18631849
--ec-bin <EC_BIN> Parse versions from EC firmware binary file
18641850
--capsule <CAPSULE> Parse UEFI Capsule information from binary file
18651851
--dump <DUMP> Dump extracted UX capsule bitmap image to a file
1866-
--h2o-capsule <H2O_CAPSULE> Parse UEFI Capsule information from binary file
18671852
--dump-ec-flash <DUMP_EC_FLASH> Dump EC flash contents
18681853
--flash-ec <FLASH_EC> Flash EC with new firmware from file
18691854
--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
@@ -64,7 +64,6 @@ pub fn parse(args: &[String]) -> Cli {
6464
flash_rw_ec: None,
6565
capsule: None,
6666
dump: None,
67-
h2o_capsule: None,
6867
intrusion: false,
6968
inputdeck: false,
7069
inputdeck_mode: None,
@@ -643,14 +642,6 @@ pub fn parse(args: &[String]) -> Cli {
643642
None
644643
};
645644
found_an_option = true;
646-
} else if arg == "--h2o-capsule" {
647-
cli.h2o_capsule = if args.len() > i + 1 {
648-
Some(args[i + 1].clone())
649-
} else {
650-
println!("--h2o-capsule requires extra argument to denote input file");
651-
None
652-
};
653-
found_an_option = true;
654645
} else if arg == "--dump-ec-flash" {
655646
cli.dump_ec_flash = if args.len() > i + 1 {
656647
Some(args[i + 1].clone())

framework_tool/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 --pdports-chromebook --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-full-ec --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 --pdports-chromebook --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-full-ec --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

framework_tool/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-full-ec -d 'Flash full EC flash with new firmware from file - may render your hardware unbootable!' -r -F
2625
complete -c framework_tool -l flash-ec -d 'Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable!' -r -F

framework_tool/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-full-ec=[Flash full EC flash with new firmware from file - may render your hardware unbootable!]:FLASH_FULL_EC:_files' \
3635
'--flash-ec=[Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable!]:FLASH_EC:_files' \

0 commit comments

Comments
 (0)