From 28254c332df533ce557633785dce2069593910f5 Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Mon, 24 Apr 2023 16:24:01 +0100 Subject: Create no_std builds of ciborium and dependencies pvmfw, which is no_std (but with alloc) needs to be able to read & write CBOR (for the DICE chain), so we need a no_std version of ciborium. Bug: 266172411 Test: atest MicrodroidTests (cherry picked from https://android-review.googlesource.com/q/commit:6cb80b001e92d1ce3be758caa43a9db787070562) Merged-In: I3d2a1f4185a6ec41ba8205f2306e37e6823998b6 Change-Id: I3d2a1f4185a6ec41ba8205f2306e37e6823998b6 --- Android.bp | 19 +++++++++++++++++++ cargo2android.json | 1 + cargo2android_nostd.bp | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 cargo2android_nostd.bp diff --git a/Android.bp b/Android.bp index 17c243e..156a5cc 100644 --- a/Android.bp +++ b/Android.bp @@ -37,3 +37,22 @@ rust_library { product_available: true, vendor_available: true, } + +rust_library_rlib { + name: "libciborium_io_nostd", + crate_name: "ciborium_io", + cargo_env_compat: true, + cargo_pkg_version: "0.2.0", + srcs: ["src/lib.rs"], + edition: "2021", + prefer_rlib: true, + no_stdlibs: true, + stdlibs: [ + "libcompiler_builtins.rust_sysroot", + "libcore.rust_sysroot", + ], + apex_available: [ + "//apex_available:platform", + "//apex_available:anyapex", + ], +} diff --git a/cargo2android.json b/cargo2android.json index 4a369d5..eb19901 100644 --- a/cargo2android.json +++ b/cargo2android.json @@ -1,4 +1,5 @@ { + "add-toplevel-block": "cargo2android_nostd.bp", "device": true, "features": "alloc,std,", "run": true, diff --git a/cargo2android_nostd.bp b/cargo2android_nostd.bp new file mode 100644 index 0000000..6ec59a8 --- /dev/null +++ b/cargo2android_nostd.bp @@ -0,0 +1,18 @@ +rust_library_rlib { + name: "libciborium_io_nostd", + crate_name: "ciborium_io", + cargo_env_compat: true, + cargo_pkg_version: "0.2.0", + srcs: ["src/lib.rs"], + edition: "2021", + prefer_rlib: true, + no_stdlibs: true, + stdlibs: [ + "libcompiler_builtins.rust_sysroot", + "libcore.rust_sysroot", + ], + apex_available: [ + "//apex_available:platform", + "//apex_available:anyapex", + ], +} -- cgit v1.2.3 From 58a3496d6999119f298503f38da5ea48dd0a3874 Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Tue, 2 May 2023 10:06:50 +0100 Subject: Add alloc to ciborium-io no_std This makes the interface for serialization more convenient. (Note that the main module, ciborium, already has an alloc dependency via half and serde.) Bug: 266172411 Test: Builds (cherry picked from https://android-review.googlesource.com/q/commit:275646277700efc41ab7e914810b53d65fd0e1a7) Merged-In: Ia684b7dd3a18d6f77a5db02f68f4e1c67046c740 Change-Id: Ia684b7dd3a18d6f77a5db02f68f4e1c67046c740 --- Android.bp | 2 ++ cargo2android_nostd.bp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Android.bp b/Android.bp index 156a5cc..1610254 100644 --- a/Android.bp +++ b/Android.bp @@ -45,9 +45,11 @@ rust_library_rlib { cargo_pkg_version: "0.2.0", srcs: ["src/lib.rs"], edition: "2021", + features: ["alloc"], prefer_rlib: true, no_stdlibs: true, stdlibs: [ + "liballoc.rust_sysroot", "libcompiler_builtins.rust_sysroot", "libcore.rust_sysroot", ], diff --git a/cargo2android_nostd.bp b/cargo2android_nostd.bp index 6ec59a8..9712ce9 100644 --- a/cargo2android_nostd.bp +++ b/cargo2android_nostd.bp @@ -5,9 +5,11 @@ rust_library_rlib { cargo_pkg_version: "0.2.0", srcs: ["src/lib.rs"], edition: "2021", + features: ["alloc"], prefer_rlib: true, no_stdlibs: true, stdlibs: [ + "liballoc.rust_sysroot", "libcompiler_builtins.rust_sysroot", "libcore.rust_sysroot", ], -- cgit v1.2.3