From d5ab76f9db450343b119d41681a08f8f6b275938 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 18 Mar 2019 12:19:30 -0600 Subject: [PATCH] Add binaries for models, generate README.md from README.md.in --- README.md | 13 +++-- README.md.in | 3 ++ apps/README.md | 6 ++- apps/README.md.in | 1 + libs/README.md | 14 ++++-- libs/README.md.in | 1 + models/README.md | 12 +++-- models/README.md.in | 1 + models/darp5/README.md | 12 +++++ models/darp5/README.md.in | 3 ++ models/darp5/ec.rom | 3 ++ models/darp5/fd.rom | 3 ++ models/darp5/me.rom | 3 ++ models/darp5/microcode.rom | 3 ++ models/darp5/vbt.rom | 3 ++ models/galp2/README.md | 12 +++++ models/galp2/README.md.in | 3 ++ models/galp2/ec.rom | 3 ++ models/galp2/fd.rom | 3 ++ models/galp2/me.rom | 3 ++ models/galp2/vbt.rom | 3 ++ models/galp3-b/README.md | 12 +++++ models/galp3-b/README.md.in | 3 ++ models/galp3-b/ec.rom | 3 ++ models/galp3-b/fd.rom | 3 ++ models/galp3-b/me.rom | 3 ++ models/galp3-b/vbt.rom | 3 ++ models/galp3-c/README.md | 12 +++++ models/galp3-c/README.md.in | 3 ++ models/galp3-c/ec.rom | 3 ++ models/galp3-c/fd.rom | 3 ++ models/galp3-c/me.rom | 3 ++ models/galp3-c/microcode.rom | 3 ++ models/galp3-c/vbt.rom | 3 ++ models/galp3/README.md | 12 +++++ models/galp3/README.md.in | 3 ++ models/galp3/ec.rom | 3 ++ models/galp3/fd.rom | 3 ++ models/galp3/me.rom | 3 ++ models/galp3/vbt.rom | 3 ++ readmes.sh | 35 ------------- scripts/models.sh | 18 +++++++ scripts/modeltool/.gitignore | 1 + scripts/modeltool/Cargo.lock | 44 ++++++++++++++++ scripts/modeltool/Cargo.toml | 9 ++++ scripts/modeltool/src/main.rs | 86 ++++++++++++++++++++++++++++++++ scripts/readmes.sh | 76 ++++++++++++++++++++++++++++ remotes.sh => scripts/remotes.sh | 0 tools/README.md | 12 +++-- tools/README.md.in | 1 + 50 files changed, 418 insertions(+), 56 deletions(-) create mode 100644 README.md.in create mode 100644 apps/README.md.in create mode 100644 libs/README.md.in create mode 100644 models/README.md.in create mode 100644 models/darp5/README.md.in create mode 100644 models/darp5/ec.rom create mode 100644 models/darp5/fd.rom create mode 100644 models/darp5/me.rom create mode 100644 models/darp5/microcode.rom create mode 100644 models/darp5/vbt.rom create mode 100644 models/galp2/README.md.in create mode 100755 models/galp2/ec.rom create mode 100644 models/galp2/fd.rom create mode 100644 models/galp2/me.rom create mode 100644 models/galp2/vbt.rom create mode 100644 models/galp3-b/README.md.in create mode 100755 models/galp3-b/ec.rom create mode 100644 models/galp3-b/fd.rom create mode 100644 models/galp3-b/me.rom create mode 100644 models/galp3-b/vbt.rom create mode 100644 models/galp3-c/README.md.in create mode 100644 models/galp3-c/ec.rom create mode 100644 models/galp3-c/fd.rom create mode 100644 models/galp3-c/me.rom create mode 100644 models/galp3-c/microcode.rom create mode 100644 models/galp3-c/vbt.rom create mode 100644 models/galp3/README.md.in create mode 100644 models/galp3/ec.rom create mode 100644 models/galp3/fd.rom create mode 100644 models/galp3/me.rom create mode 100644 models/galp3/vbt.rom delete mode 100755 readmes.sh create mode 100755 scripts/models.sh create mode 100644 scripts/modeltool/.gitignore create mode 100644 scripts/modeltool/Cargo.lock create mode 100644 scripts/modeltool/Cargo.toml create mode 100644 scripts/modeltool/src/main.rs create mode 100755 scripts/readmes.sh rename remotes.sh => scripts/remotes.sh (100%) create mode 100644 tools/README.md.in diff --git a/README.md b/README.md index 33d3ed5..44b7cb6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,12 @@ System76 Open Source Firmware -- [Applications](./apps) -- [Libraries](./libs) -- [Models](./models) -- [Tools](./tools) +## Contents +- [Applications](./apps/) +- [coreboot README](./coreboot/) +- [edk2](./edk2/) +- [edk2-platforms](./edk2-platforms/) +- [Libraries](./libs/) +- [Models](./models/) +- [scripts](./scripts/) +- [Tools](./tools/) diff --git a/README.md.in b/README.md.in new file mode 100644 index 0000000..ce606b3 --- /dev/null +++ b/README.md.in @@ -0,0 +1,3 @@ +# firmware-open + +System76 Open Source Firmware diff --git a/apps/README.md b/apps/README.md index 78129ea..d72d282 100644 --- a/apps/README.md +++ b/apps/README.md @@ -1,3 +1,5 @@ # Applications -- [System76 Firmware Setup](https://github.com/system76/firmware-setup.git) -- [System76 Firmware Update](https://github.com/system76/firmware-update.git) + +## Contents +- [System76 Firmware Setup](./firmware-setup/) +- [System76 Firmware Update](./firmware-update/) diff --git a/apps/README.md.in b/apps/README.md.in new file mode 100644 index 0000000..598ebba --- /dev/null +++ b/apps/README.md.in @@ -0,0 +1 @@ +# Applications diff --git a/libs/README.md b/libs/README.md index c604091..cf8b237 100644 --- a/libs/README.md +++ b/libs/README.md @@ -1,6 +1,10 @@ # Libraries -- [coreboot-table](https://gitlab.redox-os.org/redox-os/coreboot-table.git) -- [ecflash](https://github.com/system76/ecflash.git) -- [intelflash](https://gitlab.redox-os.org/redox-os/intelflash.git) -- [intel-spi](https://github.com/system76/intel-spi.git) -- [uefi_std](https://gitlab.redox-os.org/redox-os/uefi_std.git) + +## Contents +- [coreboot-table](./coreboot-table/) +- [ecflash](./ecflash/) +- [intelflash](./intelflash/) +- [intel-spi](./intel-spi/) +- [uefi](./uefi/) +- [uefi_alloc](./uefi_alloc/) +- [uefi_std](./uefi_std/) diff --git a/libs/README.md.in b/libs/README.md.in new file mode 100644 index 0000000..3290d70 --- /dev/null +++ b/libs/README.md.in @@ -0,0 +1 @@ +# Libraries diff --git a/models/README.md b/models/README.md index 8dc806f..1443882 100644 --- a/models/README.md +++ b/models/README.md @@ -1,6 +1,8 @@ # Models -- [System76 Darter Pro (darp5)](./darp5) -- [System76 Galago Pro (galp2)](./galp2) -- [System76 Galago Pro (galp3-b)](./galp3-b) -- [System76 Galago Pro (galp3-c)](./galp3-c) -- [System76 Galago Pro (galp3)](./galp3) + +## Contents +- [System76 Darter Pro (darp5)](./darp5/) +- [System76 Galago Pro (galp2)](./galp2/) +- [System76 Galago Pro (galp3)](./galp3/) +- [System76 Galago Pro (galp3-b)](./galp3-b/) +- [System76 Galago Pro (galp3-c)](./galp3-c/) diff --git a/models/README.md.in b/models/README.md.in new file mode 100644 index 0000000..9136172 --- /dev/null +++ b/models/README.md.in @@ -0,0 +1 @@ +# Models diff --git a/models/darp5/README.md b/models/darp5/README.md index 9ee0e3d..0252a11 100644 --- a/models/darp5/README.md +++ b/models/darp5/README.md @@ -1,3 +1,15 @@ # System76 Darter Pro (darp5) https://system76.com/guides/darp5 + +## Contents +- [EC](./ec.rom) + - Size: 128 KB + - Model: N150ZU + - Version: 1.07.04 +- [FD](./fd.rom) + - Size: 4 KB + - HAP: false +- [ME](./me.rom) + - Size: 6140 KB + - Version: 12.0.8.1123 diff --git a/models/darp5/README.md.in b/models/darp5/README.md.in new file mode 100644 index 0000000..9ee0e3d --- /dev/null +++ b/models/darp5/README.md.in @@ -0,0 +1,3 @@ +# System76 Darter Pro (darp5) + +https://system76.com/guides/darp5 diff --git a/models/darp5/ec.rom b/models/darp5/ec.rom new file mode 100644 index 0000000..616c7ec --- /dev/null +++ b/models/darp5/ec.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:503411330b3be18510e8fededd35437944d704a1f65017810f7bdf83f9fab837 +size 131072 diff --git a/models/darp5/fd.rom b/models/darp5/fd.rom new file mode 100644 index 0000000..018b6e6 --- /dev/null +++ b/models/darp5/fd.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c228fb832201a670c8b15b4002d2e07d73b808fc51b9df80c0815d5fa5798727 +size 4096 diff --git a/models/darp5/me.rom b/models/darp5/me.rom new file mode 100644 index 0000000..c42f63a --- /dev/null +++ b/models/darp5/me.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:235b5db5ac2d77cf2478913604236dd95796581fe50f7285afad413a92a92db7 +size 6287360 diff --git a/models/darp5/microcode.rom b/models/darp5/microcode.rom new file mode 100644 index 0000000..30d4022 --- /dev/null +++ b/models/darp5/microcode.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d3a41053e25ba20a67bef77bb3d2a2b32b0db6e6f4eb3816996ce30c17634e6 +size 98304 diff --git a/models/darp5/vbt.rom b/models/darp5/vbt.rom new file mode 100644 index 0000000..834b817 --- /dev/null +++ b/models/darp5/vbt.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f04ba76b34aeb7e99e61b51bb4af64731b0aed1ca1c75284c029461e4eca47dd +size 4608 diff --git a/models/galp2/README.md b/models/galp2/README.md index 58e2c34..b7fdab8 100644 --- a/models/galp2/README.md +++ b/models/galp2/README.md @@ -1,3 +1,15 @@ # System76 Galago Pro (galp2) https://system76.com/guides/galp2 + +## Contents +- [EC](./ec.rom) + - Size: 128 KB + - Model: N130BU + - Version: 1.05.06 +- [FD](./fd.rom) + - Size: 4 KB + - HAP: false +- [ME](./me.rom) + - Size: 2044 KB + - Version: 11.8.50.3434 diff --git a/models/galp2/README.md.in b/models/galp2/README.md.in new file mode 100644 index 0000000..58e2c34 --- /dev/null +++ b/models/galp2/README.md.in @@ -0,0 +1,3 @@ +# System76 Galago Pro (galp2) + +https://system76.com/guides/galp2 diff --git a/models/galp2/ec.rom b/models/galp2/ec.rom new file mode 100755 index 0000000..2f7bef0 --- /dev/null +++ b/models/galp2/ec.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ba7d58c7632b2150072003dc5a910d0349ae787f138c1e2ef2c1917090c3b7d +size 131072 diff --git a/models/galp2/fd.rom b/models/galp2/fd.rom new file mode 100644 index 0000000..e0a2041 --- /dev/null +++ b/models/galp2/fd.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0127a4ed9eaee3b4af37d8b4add5110a5a5babd9bef3b3798e97268125f2b545 +size 4096 diff --git a/models/galp2/me.rom b/models/galp2/me.rom new file mode 100644 index 0000000..bba0c16 --- /dev/null +++ b/models/galp2/me.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13b9b0c84cb68a85c4da41ecd179590f8ef7a52f082a1f710633eb2de883d12f +size 2093056 diff --git a/models/galp2/vbt.rom b/models/galp2/vbt.rom new file mode 100644 index 0000000..5a0ae03 --- /dev/null +++ b/models/galp2/vbt.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b7c95db633e1a9409ce5ad3c2ee8545e1a79851562fa75fc50326aa9ff007d3 +size 4608 diff --git a/models/galp3-b/README.md b/models/galp3-b/README.md index 1de3e4e..6e4a014 100644 --- a/models/galp3-b/README.md +++ b/models/galp3-b/README.md @@ -1,3 +1,15 @@ # System76 Galago Pro (galp3-b) https://system76.com/guides/galp3 + +## Contents +- [EC](./ec.rom) + - Size: 128 KB + - Model: N140WU + - Version: 1.07.03 +- [FD](./fd.rom) + - Size: 4 KB + - HAP: false +- [ME](./me.rom) + - Size: 2044 KB + - Version: 11.8.50.3434 diff --git a/models/galp3-b/README.md.in b/models/galp3-b/README.md.in new file mode 100644 index 0000000..1de3e4e --- /dev/null +++ b/models/galp3-b/README.md.in @@ -0,0 +1,3 @@ +# System76 Galago Pro (galp3-b) + +https://system76.com/guides/galp3 diff --git a/models/galp3-b/ec.rom b/models/galp3-b/ec.rom new file mode 100755 index 0000000..d99cebf --- /dev/null +++ b/models/galp3-b/ec.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e6d9b05a35ddcd6ff4146865ba2d4b5aa466bd6af88f7d17d89d461761d0f32 +size 131072 diff --git a/models/galp3-b/fd.rom b/models/galp3-b/fd.rom new file mode 100644 index 0000000..e0a2041 --- /dev/null +++ b/models/galp3-b/fd.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0127a4ed9eaee3b4af37d8b4add5110a5a5babd9bef3b3798e97268125f2b545 +size 4096 diff --git a/models/galp3-b/me.rom b/models/galp3-b/me.rom new file mode 100644 index 0000000..bba0c16 --- /dev/null +++ b/models/galp3-b/me.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13b9b0c84cb68a85c4da41ecd179590f8ef7a52f082a1f710633eb2de883d12f +size 2093056 diff --git a/models/galp3-b/vbt.rom b/models/galp3-b/vbt.rom new file mode 100644 index 0000000..19b350d --- /dev/null +++ b/models/galp3-b/vbt.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c13212baaca2786a5d1025462b7a8a1de8d303a7f1bf1f8eed06079d0f44a80 +size 4608 diff --git a/models/galp3-c/README.md b/models/galp3-c/README.md index c8fa804..a83cafb 100644 --- a/models/galp3-c/README.md +++ b/models/galp3-c/README.md @@ -1,3 +1,15 @@ # System76 Galago Pro (galp3-c) https://system76.com/guides/galp3 + +## Contents +- [EC](./ec.rom) + - Size: 128 KB + - Model: N130ZU + - Version: 1.07.02 +- [FD](./fd.rom) + - Size: 4 KB + - HAP: false +- [ME](./me.rom) + - Size: 6140 KB + - Version: 12.0.8.1123 diff --git a/models/galp3-c/README.md.in b/models/galp3-c/README.md.in new file mode 100644 index 0000000..c8fa804 --- /dev/null +++ b/models/galp3-c/README.md.in @@ -0,0 +1,3 @@ +# System76 Galago Pro (galp3-c) + +https://system76.com/guides/galp3 diff --git a/models/galp3-c/ec.rom b/models/galp3-c/ec.rom new file mode 100644 index 0000000..21a6f23 --- /dev/null +++ b/models/galp3-c/ec.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75a9fac02910913f272be251730ef4354ca674623c14bfbe83850822fc275dba +size 131072 diff --git a/models/galp3-c/fd.rom b/models/galp3-c/fd.rom new file mode 100644 index 0000000..341512f --- /dev/null +++ b/models/galp3-c/fd.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b70cad89e49a0362dbcea7af882294cb50b015ce6e50a2c37aa5bbbbb2cd6fe3 +size 4096 diff --git a/models/galp3-c/me.rom b/models/galp3-c/me.rom new file mode 100644 index 0000000..8d1beaa --- /dev/null +++ b/models/galp3-c/me.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e1a0f36277f088c66107761dc95077f0dc8e949687bac054eec43274c293bac +size 6287360 diff --git a/models/galp3-c/microcode.rom b/models/galp3-c/microcode.rom new file mode 100644 index 0000000..30d4022 --- /dev/null +++ b/models/galp3-c/microcode.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d3a41053e25ba20a67bef77bb3d2a2b32b0db6e6f4eb3816996ce30c17634e6 +size 98304 diff --git a/models/galp3-c/vbt.rom b/models/galp3-c/vbt.rom new file mode 100644 index 0000000..834b817 --- /dev/null +++ b/models/galp3-c/vbt.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f04ba76b34aeb7e99e61b51bb4af64731b0aed1ca1c75284c029461e4eca47dd +size 4608 diff --git a/models/galp3/README.md b/models/galp3/README.md index 174c3ee..6395814 100644 --- a/models/galp3/README.md +++ b/models/galp3/README.md @@ -1,3 +1,15 @@ # System76 Galago Pro (galp3) https://system76.com/guides/galp3 + +## Contents +- [EC](./ec.rom) + - Size: 128 KB + - Model: N130WU + - Version: 1.05.03MI1 +- [FD](./fd.rom) + - Size: 4 KB + - HAP: false +- [ME](./me.rom) + - Size: 2044 KB + - Version: 11.8.50.3399 diff --git a/models/galp3/README.md.in b/models/galp3/README.md.in new file mode 100644 index 0000000..174c3ee --- /dev/null +++ b/models/galp3/README.md.in @@ -0,0 +1,3 @@ +# System76 Galago Pro (galp3) + +https://system76.com/guides/galp3 diff --git a/models/galp3/ec.rom b/models/galp3/ec.rom new file mode 100644 index 0000000..cdc3895 --- /dev/null +++ b/models/galp3/ec.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c932e7fab09d75fbf65984abf42adcea7fcc027a682d61f5327310ce8a7fda40 +size 131072 diff --git a/models/galp3/fd.rom b/models/galp3/fd.rom new file mode 100644 index 0000000..e0a2041 --- /dev/null +++ b/models/galp3/fd.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0127a4ed9eaee3b4af37d8b4add5110a5a5babd9bef3b3798e97268125f2b545 +size 4096 diff --git a/models/galp3/me.rom b/models/galp3/me.rom new file mode 100644 index 0000000..14dbaad --- /dev/null +++ b/models/galp3/me.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72238c305382cf2ffd9b8206b95b6f6ac5bf194a3e20415149f92369879555c0 +size 2093056 diff --git a/models/galp3/vbt.rom b/models/galp3/vbt.rom new file mode 100644 index 0000000..6f37823 --- /dev/null +++ b/models/galp3/vbt.rom @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0446f851c4fb38b6c6076f1e6e30b6f6fcb939d52aaf0a30a9c5a608558d25fa +size 4608 diff --git a/readmes.sh b/readmes.sh deleted file mode 100755 index fa719fc..0000000 --- a/readmes.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -READMES=( - "apps Applications" - "libs Libraries" - "models Models" - "tools Tools" -) - -function recursive_readme { - pushd "$1" > /dev/null - echo -e "\x1B[1m$1\x1B[0m" - echo "# $2" > README.md - for readme in */README.md - do - # Get first line, removing the trailing pounds and spaces - description="$(head -n 1 "$readme" | sed -e 's/^[#[:space:]]*//')" - # Get submodule, if applicable - dir="$(dirname "$readme")" - submodule="$(git submodule status "$dir" | cut -d ' ' -f 3)" - if [ "$submodule" == "$dir" ] - then - origin="$(git -C "$dir" remote get-url origin)" - echo "- [$description]($origin)" >> README.md - else - echo "- [$description](./$dir)" >> README.md - fi - done - popd > /dev/null -} - -for readme in "${READMES[@]}" -do - recursive_readme $readme -done diff --git a/scripts/models.sh b/scripts/models.sh new file mode 100755 index 0000000..aa4fddc --- /dev/null +++ b/scripts/models.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -e + +cargo build --manifest-path "scripts/modeltool/Cargo.toml" --release + +MODELTOOL="$(realpath "scripts/modeltool/target/release/modeltool")" + +for dir in models/*/ +do + pushd "$dir" > /dev/null + model="$(basename "$dir")" + echo -e "\x1B[1m$model\x1B[0m" + cp README.md.in README.md + echo "## Firmware Versions" >> README.md + "$MODELTOOL" . | tee -a README.md + popd > /dev/null +done diff --git a/scripts/modeltool/.gitignore b/scripts/modeltool/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/scripts/modeltool/.gitignore @@ -0,0 +1 @@ +target diff --git a/scripts/modeltool/Cargo.lock b/scripts/modeltool/Cargo.lock new file mode 100644 index 0000000..19357dc --- /dev/null +++ b/scripts/modeltool/Cargo.lock @@ -0,0 +1,44 @@ +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "modeltool" +version = "0.1.0" +dependencies = [ + "redox_intelflash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "system76_ecflash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_intelflash" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_uefi 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_uefi" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "system76_ecflash" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +"checksum redox_intelflash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49e6f45d8c070090589005869e0b776f52c735f9b5411fca369229135fa1dbd8" +"checksum redox_uefi 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dafc50645c27c55ca19d27645a6d91e2a8cbc7aabb2ed024ce914512c75e1217" +"checksum system76_ecflash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2a81b23cd826ce944029420978cce3be94363188ed87ff8cc0778f80adac547" diff --git a/scripts/modeltool/Cargo.toml b/scripts/modeltool/Cargo.toml new file mode 100644 index 0000000..d0140fe --- /dev/null +++ b/scripts/modeltool/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "modeltool" +version = "0.1.0" +authors = ["Jeremy Soller "] +edition = "2018" + +[dependencies] +redox_intelflash = "0.1.0" +system76_ecflash = "0.1.0" diff --git a/scripts/modeltool/src/main.rs b/scripts/modeltool/src/main.rs new file mode 100644 index 0000000..bcf8d20 --- /dev/null +++ b/scripts/modeltool/src/main.rs @@ -0,0 +1,86 @@ +use ecflash::{Ec, EcFile}; +use intelflash::{Me, Rom}; +use std::{env, fs, process}; +use std::path::Path; + +fn ec(path: &Path) { + println!("- [EC]({})", path.display()); + match fs::read(path) { + Ok(data) => { + println!(" - Size: {} KB", data.len() / 1024); + { + let mut ec = EcFile::new(data); + println!(" - Model: {}", ec.project()); + println!(" - Version: {}", ec.version()); + } + }, + Err(err) => { + println!(" - *Read Error: {}*", err); + } + } +} + +fn fd(path: &Path) { + println!("- [FD]({})", path.display()); + match fs::read(path) { + Ok(data) => { + println!(" - Size: {} KB", data.len() / 1024); + match Rom::new(&data) { + Ok(rom) => { + match rom.high_assurance_platform() { + Ok(hap) => { + println!(" - HAP: {}", hap); + }, + Err(err) => { + println!(" - *HAP Error: {}*", err); + } + } + }, + Err(err) => { + println!(" - *Parse Error: {}*", err); + } + } + }, + Err(err) => { + println!(" - *Read Error: {}*", err); + } + } +} + +fn me(path: &Path) { + println!("- [ME]({})", path.display()); + match fs::read(path) { + Ok(data) => { + println!(" - Size: {} KB", data.len() / 1024); + match Me::new(&data) { + Ok(me) => { + if let Some(version) = me.version() { + println!(" - Version: {}", version); + } + }, + Err(err) => { + println!(" - *Parse Error: {}*", err); + } + } + }, + Err(err) => { + println!(" - *Read Error: {}*", err); + } + } +} + +fn main() { + let args: Vec = env::args().skip(1).collect(); + if args.is_empty() { + println!("modeltool [model directory]..."); + process::exit(1); + } + + for arg in args { + let path = Path::new(&arg); + + ec(&path.join("ec.rom")); + fd(&path.join("fd.rom")); + me(&path.join("me.rom")); + } +} diff --git a/scripts/readmes.sh b/scripts/readmes.sh new file mode 100755 index 0000000..4825dc3 --- /dev/null +++ b/scripts/readmes.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +README_DIRS=( + apps + libs + models + tools + . +) + +set -e + +cargo build --manifest-path "scripts/modeltool/Cargo.toml" --release + +MODELTOOL="$(realpath "scripts/modeltool/target/release/modeltool")" + +function readme_model { + echo -e "\x1B[1m$1\x1B[0m" >&2 + + pushd "$1" > /dev/null + cp README.md.in README.md + + echo >> README.md + echo "## Contents" >> README.md + "$MODELTOOL" . >> README.md + popd > /dev/null +} + +for dir in models/*/ +do + readme_model "${dir%/}" +done + +function readme_line { + echo -e " \x1B[1m$1\x1B[0m" >&2 + + if [ -f "$1/README.md" ] + then + # Get first line, removing the trailing pounds and spaces + description="$(head -n 1 "$1/README.md" | sed -e 's/^[#[:space:]]*//')" + else + # Use the directory name as the description + description="$(basename "$1")" + fi + + submodule="$(git submodule status "$1" 2> /dev/null | cut -d ' ' -f 3 || true)" + if [ "$submodule" == "$dir" ] + then + # Link to submodule URL + origin="$(git -C "$dir" remote get-url origin)" + echo "- [$description]($origin)" + else + # Link to directory + echo "- [$description](./$dir)" + fi +} + +function readme_dir { + echo -e "\x1B[1m$1\x1B[0m" >&2 + + pushd "$1" > /dev/null + cp README.md.in README.md + + echo >> README.md + echo "## Contents" >> README.md + for dir in */ + do + readme_line "${dir%/}" >> README.md + done + popd > /dev/null +} + +for dir in "${README_DIRS[@]}" +do + readme_dir "$dir" +done diff --git a/remotes.sh b/scripts/remotes.sh similarity index 100% rename from remotes.sh rename to scripts/remotes.sh diff --git a/tools/README.md b/tools/README.md index d1ddee0..ca7a51b 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,6 +1,8 @@ # Tools -- [coreboot-collector](https://github.com/system76/coreboot-collector.git) -- [ME Analyzer](https://github.com/platomav/MEAnalyzer.git) -- [UEFITool](https://github.com/LongSoft/UEFITool.git) -- [Intel ME 11.x Firmware Images Unpacker](https://github.com/ptresearch/unME11.git) -- [Intel ME 12.x Firmware Images Unpacker](https://github.com/ptresearch/unME12.git) + +## Contents +- [coreboot-collector](./coreboot-collector/) +- [ME Analyzer](./MEAnalyzer/) +- [UEFITool](./UEFITool/) +- [Intel ME 11.x Firmware Images Unpacker](./unME11/) +- [Intel ME 12.x Firmware Images Unpacker](./unME12/) diff --git a/tools/README.md.in b/tools/README.md.in new file mode 100644 index 0000000..40986fa --- /dev/null +++ b/tools/README.md.in @@ -0,0 +1 @@ +# Tools