From c11a051571e871f38b1df2a6d2ba1c6a1645c951 Mon Sep 17 00:00:00 2001 From: Ben Stoltz Date: Fri, 9 Aug 2024 13:27:36 -0700 Subject: [PATCH] deprecate ImageHeader version and epoch --- Cargo.lock | 310 +++++++++++++++++++++++--- Cargo.toml | 12 +- app/gimlet/base.toml | 1 - app/gimletlet/base-gimletlet2.toml | 2 - app/grapefruit/app.toml | 2 - app/oxide-rot-1/app-dev.toml | 2 - app/oxide-rot-1/app.toml | 2 - app/rot-carrier/app.toml | 2 - build/xtask/src/config.rs | 13 -- build/xtask/src/dist.rs | 12 +- drv/lpc55-update-server/build.rs | 13 -- drv/lpc55-update-server/src/images.rs | 39 +--- drv/lpc55-update-server/src/main.rs | 6 +- drv/sprot-api/README.md | 2 +- drv/stm32h7-update-server/build.rs | 13 -- drv/stm32h7-update-server/src/main.rs | 6 +- sys/abi/src/lib.rs | 14 +- 17 files changed, 319 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e042616105..859361c23d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,6 +48,54 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.66" @@ -80,6 +128,15 @@ dependencies = [ "cortex-m", ] +[[package]] +name = "array-init" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" +dependencies = [ + "nodrop", +] + [[package]] name = "arrayvec" version = "0.7.4" @@ -445,13 +502,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "bitflags 1.3.2", - "clap_derive", - "clap_lex", + "clap_derive 3.2.18", + "clap_lex 0.2.4", "indexmap 1.9.1", "once_cell", "textwrap", ] +[[package]] +name = "clap" +version = "4.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84ed82781cea27b43c9b106a979fe450a13a31aab0500595fb3fc06616de08e6" +dependencies = [ + "clap_builder", + "clap_derive 4.4.2", +] + +[[package]] +name = "clap_builder" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" +dependencies = [ + "anstream", + "anstyle", + "clap_lex 0.5.1", + "strsim", + "terminal_size", +] + [[package]] name = "clap_derive" version = "3.2.18" @@ -465,6 +545,18 @@ dependencies = [ "syn 1.0.94", ] +[[package]] +name = "clap_derive" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -474,6 +566,18 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + [[package]] name = "colored" version = "2.0.0" @@ -753,9 +857,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.3" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b10af9f9f9f2134a42d3f8aa74658660f2e0234b0eb81bd171df8aa32779ed" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "der_derive", @@ -766,14 +870,13 @@ dependencies = [ [[package]] name = "der_derive" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63898447d5453a504531990fb79708be1087effb2da9b2704f54dbdf8b6890e4" +checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.94", + "syn 2.0.52", ] [[package]] @@ -2476,6 +2579,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "errno-dragonfly" version = "0.1.2" @@ -2539,7 +2652,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "gateway-messages" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/management-gateway-service#1885b52b0601f4215c020cb17516c6a7fa1e2c9d" +source = "git+https://github.com/oxidecomputer/management-gateway-service#e1e84897878a8574030d9e85d1e2a0f5a4358a5d" dependencies = [ "bitflags 2.6.0", "hubpack", @@ -2813,9 +2926,10 @@ dependencies = [ [[package]] name = "hubtools" -version = "0.4.1" -source = "git+https://github.com/oxidecomputer/hubtools#712a370b077c1481cea6db23ee4573a232779633" +version = "0.4.7" +source = "git+https://github.com/oxidecomputer/hubtools#088527fa3d8747c502ce3069ec210a0d3fbb15b1" dependencies = [ + "hex", "lpc55_areas", "lpc55_sign", "object", @@ -2943,7 +3057,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -2954,8 +3068,8 @@ checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix", - "windows-sys", + "rustix 0.36.9", + "windows-sys 0.45.0", ] [[package]] @@ -3099,6 +3213,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "lock_api" version = "0.4.5" @@ -3217,10 +3337,11 @@ dependencies = [ [[package]] name = "lpc55_areas" -version = "0.2.2" -source = "git+https://github.com/oxidecomputer/lpc55_support#32cf8b50889d5aab3efe4e98949c888276a4c8a7" +version = "0.2.5" +source = "git+https://github.com/oxidecomputer/lpc55_support#131520fc913ecce9b80557e854751953f743a7d2" dependencies = [ "bitfield 0.14.0", + "clap 4.4.3", "packed_struct", "serde", ] @@ -3238,8 +3359,8 @@ dependencies = [ [[package]] name = "lpc55_sign" -version = "0.3.0" -source = "git+https://github.com/oxidecomputer/lpc55_support#32cf8b50889d5aab3efe4e98949c888276a4c8a7" +version = "0.3.4" +source = "git+https://github.com/oxidecomputer/lpc55_support#131520fc913ecce9b80557e854751953f743a7d2" dependencies = [ "byteorder", "const-oid", @@ -3254,6 +3375,7 @@ dependencies = [ "pem-rfc7468", "rsa", "serde", + "serde-hex", "sha2", "thiserror", "x509-cert", @@ -3289,6 +3411,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "medusa" version = "0.1.0" @@ -3363,6 +3491,12 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + [[package]] name = "num" version = "0.4.0" @@ -3389,7 +3523,8 @@ dependencies = [ "num-iter", "num-traits", "rand", - "smallvec", + "serde", + "smallvec 1.10.0", "zeroize", ] @@ -3962,6 +4097,7 @@ dependencies = [ "pkcs1", "pkcs8", "rand_core", + "serde", "sha2", "signature", "subtle", @@ -3993,11 +4129,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" dependencies = [ "bitflags 1.3.2", - "errno", + "errno 0.2.8", + "io-lifetimes", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.37.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" +dependencies = [ + "bitflags 1.3.2", + "errno 0.3.9", "io-lifetimes", "libc", - "linux-raw-sys", - "windows-sys", + "linux-raw-sys 0.3.8", + "windows-sys 0.45.0", ] [[package]] @@ -4138,6 +4288,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde-hex" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca37e3e4d1b39afd7ff11ee4e947efae85adfddf4841787bfa47c470e96dc26d" +dependencies = [ + "array-init", + "serde", + "smallvec 0.6.14", +] + [[package]] name = "serde_derive" version = "1.0.195" @@ -4277,6 +4438,15 @@ dependencies = [ "rand_core", ] +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.10.0" @@ -4614,7 +4784,6 @@ dependencies = [ "drv-auxflash-api", "drv-caboose", "drv-caboose-pos", - "drv-gimlet-hf-api", "drv-gimlet-seq-api", "drv-hf-api", "drv-ignition-api", @@ -4756,8 +4925,8 @@ dependencies = [ "byteorder", "cfg-if", "cortex-m", - "drv-gimlet-hf-api", "drv-hash-api", + "drv-hf-api", "drv-i2c-api", "drv-lpc55-gpio-api", "drv-sp-ctrl-api", @@ -5399,6 +5568,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" +dependencies = [ + "rustix 0.37.7", + "windows-sys 0.48.0", +] + [[package]] name = "test-api" version = "0.1.0" @@ -5776,6 +5955,12 @@ dependencies = [ "zerocopy 0.6.6", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "1.10.0" @@ -5979,6 +6164,24 @@ dependencies = [ "windows-targets 0.42.2", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -5994,6 +6197,21 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.4" @@ -6015,6 +6233,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.4" @@ -6027,6 +6251,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.4" @@ -6039,6 +6269,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.4" @@ -6051,6 +6287,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.4" @@ -6063,6 +6305,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.4" @@ -6075,6 +6323,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.4" @@ -6087,6 +6341,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.4" @@ -6133,7 +6393,7 @@ dependencies = [ "byteorder", "bzip2-rs", "cargo_metadata", - "clap", + "clap 3.2.23", "colored", "ctrlc", "dunce", diff --git a/Cargo.toml b/Cargo.toml index 2def2b99f0..54d1e05c91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -120,20 +120,14 @@ zip = { version = "0.6", default-features = false, features = ["bzip2"] } # Oxide forks and repos attest-data = { git = "https://github.com/oxidecomputer/dice-util", default-features = false, version = "0.3.0" } dice-mfg-msgs = { git = "https://github.com/oxidecomputer/dice-util", default-features = false, version = "0.2.1" } -#gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["smoltcp"] } -# XXX fix before push -gateway-messages = { path = "/home/stoltz/Oxide/src/mgs/epoch/gateway-messages", default-features = false, features = ["smoltcp"] } +gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["smoltcp"] } gimlet-inspector-protocol = { git = "https://github.com/oxidecomputer/gimlet-inspector-protocol", version = "0.1.0" } hif = { git = "https://github.com/oxidecomputer/hif", default-features = false } humpty = { git = "https://github.com/oxidecomputer/humpty", default-features = false, version = "0.1.3" } -#hubtools = { git = "https://github.com/oxidecomputer/hubtools", default-features = false, version = "0.4.1" } -# XXX fix before push -# hubtools = { git = "https://github.com/oxidecomputer/hubtools", default-features = false, branch = "epoch", version = "0.4.7" } -hubtools = { path = "/home/stoltz/Oxide/src/hubtools/epoch/hubtools" } +hubtools = { git = "https://github.com/oxidecomputer/hubtools", default-features = false, version = "0.4.7" } idol = { git = "https://github.com/oxidecomputer/idolatry.git", default-features = false } idol-runtime = { git = "https://github.com/oxidecomputer/idolatry.git", default-features = false } -#lpc55_sign = { git = "https://github.com/oxidecomputer/lpc55_support", default-features = false } -lpc55_sign = { path = "/home/stoltz/Oxide/src/lpc55_support/lpc55_sign", default-features = false } +lpc55_sign = { git = "https://github.com/oxidecomputer/lpc55_support", default-features = false } ordered-toml = { git = "https://github.com/oxidecomputer/ordered-toml", default-features = false } pmbus = { git = "https://github.com/oxidecomputer/pmbus", default-features = false } salty = { version = "0.3", default-features = false } diff --git a/app/gimlet/base.toml b/app/gimlet/base.toml index d9c5bcac6f..6a271cf4e5 100644 --- a/app/gimlet/base.toml +++ b/app/gimlet/base.toml @@ -3,7 +3,6 @@ chip = "../../chips/stm32h7" memory = "memory-large.toml" stacksize = 896 fwid = true -epoch = 0 [kernel] name = "gimlet" diff --git a/app/gimletlet/base-gimletlet2.toml b/app/gimletlet/base-gimletlet2.toml index 6775222986..7f71220073 100644 --- a/app/gimletlet/base-gimletlet2.toml +++ b/app/gimletlet/base-gimletlet2.toml @@ -3,8 +3,6 @@ target = "thumbv7em-none-eabihf" chip = "../../chips/stm32h7" memory = "memory-large.toml" stacksize = 896 -epoch = 0 -version = 0 fwid = true [kernel] diff --git a/app/grapefruit/app.toml b/app/grapefruit/app.toml index 09ba4d2bcb..0e5a2c217b 100644 --- a/app/grapefruit/app.toml +++ b/app/grapefruit/app.toml @@ -4,8 +4,6 @@ target = "thumbv7em-none-eabihf" chip = "../../chips/stm32h7" memory = "memory-large.toml" stacksize = 896 -epoch = 0 -version = 0 fwid = true [kernel] diff --git a/app/oxide-rot-1/app-dev.toml b/app/oxide-rot-1/app-dev.toml index 6fd034046d..a4ba89e958 100644 --- a/app/oxide-rot-1/app-dev.toml +++ b/app/oxide-rot-1/app-dev.toml @@ -4,8 +4,6 @@ board = "oxide-rot-1" chip = "../../chips/lpc55" stacksize = 1024 image-names = ["a", "b"] -epoch = 0 -version = 0 fwid = true [kernel] diff --git a/app/oxide-rot-1/app.toml b/app/oxide-rot-1/app.toml index 41a05d5646..7d76c20332 100644 --- a/app/oxide-rot-1/app.toml +++ b/app/oxide-rot-1/app.toml @@ -5,8 +5,6 @@ board = "oxide-rot-1" chip = "../../chips/lpc55" stacksize = 1024 image-names = ["a", "b"] -epoch = 0 -version = 0 fwid = true [kernel] diff --git a/app/rot-carrier/app.toml b/app/rot-carrier/app.toml index f1182218da..b9f222b11d 100644 --- a/app/rot-carrier/app.toml +++ b/app/rot-carrier/app.toml @@ -4,8 +4,6 @@ board = "rot-carrier-2" chip = "../../chips/lpc55" stacksize = 1024 image-names = ["a", "b"] -epoch = 0 -version = 0 fwid = true [kernel] diff --git a/build/xtask/src/config.rs b/build/xtask/src/config.rs index d728448b65..a439a95a41 100644 --- a/build/xtask/src/config.rs +++ b/build/xtask/src/config.rs @@ -24,10 +24,6 @@ struct RawConfig { board: String, chip: String, #[serde(default)] - epoch: u32, - #[serde(default)] - version: u32, - #[serde(default)] fwid: bool, memory: Option, #[serde(default)] @@ -50,8 +46,6 @@ pub struct Config { pub target: String, pub board: String, pub chip: String, - pub epoch: u32, - pub version: u32, pub fwid: bool, pub image_names: Vec, pub signing: Option, @@ -174,8 +168,6 @@ impl Config { board: toml.board, image_names: img_names, chip: toml.chip, - epoch: toml.epoch, - version: toml.version, fwid: toml.fwid, signing: toml.signing, stacksize: toml.stacksize, @@ -254,11 +246,6 @@ impl Config { let task_names = self.tasks.keys().cloned().collect::>().join(","); env.insert("HUBRIS_TASKS".to_string(), task_names); - env.insert( - "HUBRIS_BUILD_VERSION".to_string(), - format!("{}", self.version), - ); - env.insert("HUBRIS_BUILD_EPOCH".to_string(), format!("{}", self.epoch)); env.insert("HUBRIS_BOARD".to_string(), self.board.to_string()); env.insert( "HUBRIS_APP_TOML".to_string(), diff --git a/build/xtask/src/dist.rs b/build/xtask/src/dist.rs index da2d657af4..279c062d8a 100644 --- a/build/xtask/src/dist.rs +++ b/build/xtask/src/dist.rs @@ -1251,7 +1251,7 @@ fn build_kernel( /// Returns true if the header was found and updated, /// false otherwise. fn update_image_header( - cfg: &PackageConfig, + _cfg: &PackageConfig, input: &Path, output: &Path, map: &IndexMap>, @@ -1290,16 +1290,8 @@ fn update_image_header( // `xtask build kernel`, we need a result from this calculation // but `end` will be `None`. Substitute a placeholder: let end = end.unwrap_or(flash.start); - let len = end - flash.start; - - let header = abi::ImageHeader { - version: cfg.toml.version, - epoch: cfg.toml.epoch, - magic: abi::HEADER_MAGIC, - total_image_len: len, - ..Default::default() - }; + let header = abi::ImageHeader::new(len); header .write_to_prefix( diff --git a/drv/lpc55-update-server/build.rs b/drv/lpc55-update-server/build.rs index 05130a8377..623f6553bd 100644 --- a/drv/lpc55-update-server/build.rs +++ b/drv/lpc55-update-server/build.rs @@ -2,9 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use std::fs::File; -use std::io::Write; - fn main() -> Result<(), Box> { build_util::expose_target_board(); build_util::build_notifications()?; @@ -18,15 +15,5 @@ fn main() -> Result<(), Box> { "server_stub.rs", idol::server::ServerStyle::InOrder, )?; - - let out = build_util::out_dir(); - let mut ver_file = File::create(out.join("consts.rs")).unwrap(); - - let version: u32 = build_util::env_var("HUBRIS_BUILD_VERSION")?.parse()?; - let epoch: u32 = build_util::env_var("HUBRIS_BUILD_EPOCH")?.parse()?; - - writeln!(ver_file, "const HUBRIS_BUILD_VERSION: u32 = {};", version)?; - writeln!(ver_file, "const HUBRIS_BUILD_EPOCH: u32 = {};", epoch)?; - Ok(()) } diff --git a/drv/lpc55-update-server/src/images.rs b/drv/lpc55-update-server/src/images.rs index 741a77322f..ca36803e47 100644 --- a/drv/lpc55-update-server/src/images.rs +++ b/drv/lpc55-update-server/src/images.rs @@ -185,7 +185,7 @@ impl TryFrom<&[u8]> for ImageVectorsLpc55 { /// the end of optional caboose and the beginning of the signature block. pub fn validate_header_block( header_access: &ImageAccess<'_>, -) -> Result<(Option, u32), UpdateError> { +) -> Result { let mut vectors = ImageVectorsLpc55::new_zeroed(); let mut header = ImageHeader::new_zeroed(); @@ -212,17 +212,14 @@ pub fn validate_header_block( // Note that `ImageHeader.epoch` is used by rollback protection for early // rejection of invalid images. // TODO: Improve estimate of where the first executable instruction can be. - let (code_offset, epoch) = if header.magic == HEADER_MAGIC { + let code_offset = if header.magic == HEADER_MAGIC { if header.total_image_len != vectors.nxp_offset_to_specific_header { // ImageHeader disagrees with LPC55 vectors. return Err(UpdateError::InvalidHeaderBlock); } - ( - IMAGE_HEADER_OFFSET + (core::mem::size_of::() as u32), - Some(Epoch::from(header.epoch)), - ) + IMAGE_HEADER_OFFSET + (core::mem::size_of::() as u32) } else { - (IMAGE_HEADER_OFFSET, None) + IMAGE_HEADER_OFFSET }; if vectors.nxp_image_length as usize > header_access.at_runtime().len() { @@ -249,7 +246,7 @@ pub fn validate_header_block( return Err(UpdateError::InvalidHeaderBlock); } - Ok((epoch, vectors.nxp_offset_to_specific_header)) + Ok(vectors.nxp_offset_to_specific_header) } /// Get the range of the caboose contained within an image if it exists. @@ -266,7 +263,7 @@ pub fn caboose_slice( // // In this context, NoImageHeader actually means that the image // is not well formed. - let (_epoch, image_end_offset) = validate_header_block(image) + let image_end_offset = validate_header_block(image) .map_err(|_| RawCabooseError::NoImageHeader)?; // By construction, the last word of the caboose is its size as a `u32` @@ -651,33 +648,17 @@ pub fn check_rollback_policy( fn get_image_epoch( image: &ImageAccess<'_>, ) -> Result, UpdateError> { - let (header_epoch, _caboose_offset) = validate_header_block(image)?; - if let Ok(span) = caboose_slice(image) { let mut block = [0u8; BLOCK_SIZE_BYTES]; let caboose = block[0..span.len()].as_bytes_mut(); image.read_bytes(span.start, caboose)?; let reader = CabooseReader::new(caboose); - let caboose_epoch = if let Ok(epoc) = reader.get(CABOOSE_TAG_EPOC) { - Some(Epoch::from(epoc)) + if let Ok(epoc) = reader.get(CABOOSE_TAG_EPOC) { + Ok(Some(Epoch::from(epoc))) } else { - None - }; - match (header_epoch, caboose_epoch) { - (None, None) => Ok(None), - (Some(header_epoch), None) => Ok(Some(header_epoch)), - (None, Some(caboose_epoch)) => Ok(Some(caboose_epoch)), - (Some(header_epoch), Some(caboose_epoch)) => { - if caboose_epoch == header_epoch { - Ok(Some(caboose_epoch)) - } else { - // Epochs present in both and not matching is invalid. - // The image will be rejected after epoch 0. - Ok(Some(Epoch::from(0u32))) - } - } + Ok(None) } } else { - Ok(header_epoch) + Ok(None) } } diff --git a/drv/lpc55-update-server/src/main.rs b/drv/lpc55-update-server/src/main.rs index 5e63dc28e3..2e3d5a4761 100644 --- a/drv/lpc55-update-server/src/main.rs +++ b/drv/lpc55-update-server/src/main.rs @@ -289,13 +289,14 @@ impl idl::InOrderUpdateImpl for ServerImpl<'_> { // TODO(AJS): Remove this in favor of `status`, once SP code is updated. // This has ripple effects up through control-plane-agent. + /// Deprecated. The version and epoch are in the Caboose fn current_version( &mut self, _: &RecvMessage, ) -> Result> { Ok(ImageVersion { - epoch: HUBRIS_BUILD_EPOCH, - version: HUBRIS_BUILD_VERSION, + epoch: 0, + version: 0, }) } @@ -1312,7 +1313,6 @@ fn main() -> ! { } } -include!(concat!(env!("OUT_DIR"), "/consts.rs")); include!(concat!(env!("OUT_DIR"), "/notifications.rs")); mod idl { use super::{ diff --git a/drv/sprot-api/README.md b/drv/sprot-api/README.md index 3d17d88013..98194b4035 100644 --- a/drv/sprot-api/README.md +++ b/drv/sprot-api/README.md @@ -461,7 +461,7 @@ SpRot.status() => Status { } ``` -Update API, retrieve current version. +Update API, retrieve current version (deprecated) This information is redundant with information in the Status structure. ```sh $ humility hiffy -c SpRot.current_version diff --git a/drv/stm32h7-update-server/build.rs b/drv/stm32h7-update-server/build.rs index b5eef47308..da633af332 100644 --- a/drv/stm32h7-update-server/build.rs +++ b/drv/stm32h7-update-server/build.rs @@ -2,9 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use std::fs::File; -use std::io::Write; - fn main() -> Result<(), Box> { build_util::build_notifications()?; idol::Generator::new() @@ -16,15 +13,5 @@ fn main() -> Result<(), Box> { "server_stub.rs", idol::server::ServerStyle::InOrder, )?; - - let out = build_util::out_dir(); - let mut ver_file = File::create(out.join("consts.rs")).unwrap(); - - let version: u32 = build_util::env_var("HUBRIS_BUILD_VERSION")?.parse()?; - let epoch: u32 = build_util::env_var("HUBRIS_BUILD_EPOCH")?.parse()?; - - writeln!(ver_file, "const HUBRIS_BUILD_VERSION: u32 = {};", version)?; - writeln!(ver_file, "const HUBRIS_BUILD_EPOCH: u32 = {};", epoch)?; - Ok(()) } diff --git a/drv/stm32h7-update-server/src/main.rs b/drv/stm32h7-update-server/src/main.rs index ce7a73fead..353d750eae 100644 --- a/drv/stm32h7-update-server/src/main.rs +++ b/drv/stm32h7-update-server/src/main.rs @@ -416,13 +416,14 @@ impl idl::InOrderUpdateImpl for ServerImpl<'_> { Ok(BLOCK_SIZE_BYTES) } + /// Deprecated. The version and epoch values are in the Caboose. fn current_version( &mut self, _: &RecvMessage, ) -> Result> { Ok(ImageVersion { - epoch: HUBRIS_BUILD_EPOCH, - version: HUBRIS_BUILD_VERSION, + epoch: 0, + version: 0, }) } @@ -569,7 +570,6 @@ fn main() -> ! { } } -include!(concat!(env!("OUT_DIR"), "/consts.rs")); mod idl { use super::{CabooseError, ImageVersion, SlotId}; diff --git a/sys/abi/src/lib.rs b/sys/abi/src/lib.rs index 4563b4b438..79958cbe64 100644 --- a/sys/abi/src/lib.rs +++ b/sys/abi/src/lib.rs @@ -521,8 +521,18 @@ pub struct ImageHeader { pub magic: u32, pub total_image_len: u32, pub _pad: [u32; 16], // previous location of SAU entries - pub version: u32, - pub epoch: u32, + pub _version: u32, + pub _epoch: u32, +} + +impl ImageHeader { + pub fn new(total_image_len: u32) -> Self { + ImageHeader { + magic: HEADER_MAGIC, + total_image_len, + ..Default::default() + } + } } // Corresponds to the ARM vector table, limited to what we need