summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungjae Yoo <seungjaeyoo@google.com>2022-12-28 13:24:47 +0900
committerSeungjae Yoo <seungjaeyoo@google.com>2022-12-29 11:01:20 +0900
commit38e0d5b3b4398346c549bc7ab116d5d754adc11e (patch)
tree6a14dc9e7c83e9b656c129f47e643453991cb1fd
parent62d3c860f99e5734642fabb51e6f03c4063ef8c0 (diff)
downloadopenwrt-prebuilts-38e0d5b3b4398346c549bc7ab116d5d754adc11e.tar.gz
Add default build rules and reduce duplication
Bug: 263697604 Test: launch_cvd with checking wifi for x86_64 and arm64 Change-Id: I561e7ad0c798f68f6a7bcbc70c44152dbf14fe8c
-rw-r--r--Android.bp91
1 files changed, 44 insertions, 47 deletions
diff --git a/Android.bp b/Android.bp
index 8f77b67..eebf86a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -38,38 +38,40 @@ license {
],
}
+genrule_defaults {
+ name: "openwrt_rootfs_base_defaults",
+ cmd: "cp $(in) $(genDir) && gzip -d $(genDir)/* && cp $(genDir)/* $(out)",
+}
+
genrule {
- name: "openwrt_rootfs_base_img_x86_64",
+ name: "openwrt_rootfs_base_x86_64",
srcs: [
"x86_64/images/openwrt-22.03.2-x86-64-generic-squashfs-rootfs.img.gz",
],
- out: ["base_rootfs_x86_64.img"],
- cmd: "cp $(in) $(genDir) && gzip -d $(genDir)/* && cp $(genDir)/* $(out)",
+ out: ["openwrt_rootfs_base_x86_64.img"],
+ defaults: ["openwrt_rootfs_base_defaults"],
}
genrule {
- name: "openwrt_rootfs_base_img_aarch64",
+ name: "openwrt_rootfs_base_aarch64",
srcs: [
"arm64/images/openwrt-22.03.2-armvirt-64-rootfs-squashfs.img.gz",
],
- out: ["base_rootfs_aarch64.img"],
- cmd: "cp $(in) $(genDir) && gzip -d $(genDir)/* && cp $(genDir)/* $(out)",
+ out: ["openwrt_rootfs_base_aarch64.img"],
+ defaults: ["openwrt_rootfs_base_defaults"],
}
-genrule {
- name: "openwrt_customization_x86_64",
+genrule_defaults {
+ name: "openwrt_rootfs_customization_defaults",
tools: [
"make_f2fs",
"sload_f2fs",
],
srcs: [
":openwrt_license_files",
- "x86_64/kmods/*",
- "x86_64/packages/*",
"shared/uci-defaults/*",
"shared/config/*",
],
- out: ["customization_x86_64.img"],
cmd: "mkdir -p $(genDir)/root/upper/etc/uci-defaults && " +
"mkdir -p $(genDir)/root/upper/ipks && " +
"mkdir -p $(genDir)/root/upper/etc/config && " +
@@ -85,69 +87,64 @@ genrule {
}
genrule {
- name: "openwrt_customization_aarch64",
- tools: [
- "make_f2fs",
- "sload_f2fs",
+ name: "openwrt_rootfs_customization_x86_64",
+ srcs: [
+ "x86_64/kmods/*",
+ "x86_64/packages/*",
],
+ out: ["openwrt_rootfs_customization_x86_64.img"],
+ defaults: ["openwrt_rootfs_customization_defaults"],
+}
+
+genrule {
+ name: "openwrt_rootfs_customization_aarch64",
srcs: [
- ":openwrt_license_files",
"arm64/kmods/*",
"arm64/packages/*",
- "shared/uci-defaults/*",
- "shared/config/*",
],
- out: ["customization_aarch64.img"],
- cmd: "mkdir -p $(genDir)/root/upper/etc/uci-defaults && " +
- "mkdir -p $(genDir)/root/upper/ipks && " +
- "mkdir -p $(genDir)/root/upper/etc/config && " +
- "cp $(in) $(genDir)/ && " +
- "mv $(genDir)/*.ipk $(genDir)/root/upper/ipks && " +
- "mv $(genDir)/LICENSE $(genDir)/HOW_TO_GET_SOURCE_CODE $(genDir)/root/upper && " +
- "mv $(genDir)/0_default_config $(genDir)/root/upper/etc/uci-defaults && " +
- "find $(genDir) -maxdepth 1 -type f -exec mv {} $(genDir)/root/upper/etc/config \\; && " +
- "ln -s 2 $(genDir)/root/.fs_state && " +
- "truncate -s 128M $(out) && " +
- "$(location make_f2fs) $(out) && " +
- "$(location sload_f2fs) -f $(genDir)/root -t / $(out)",
+ out: ["openwrt_rootfs_customization_aarch64.img"],
+ defaults: ["openwrt_rootfs_customization_defaults"],
}
-genrule {
- name: "combined_openwrt_rootfs_x86_64",
+genrule_defaults {
+ name: "openwrt_rootfs_combined_defaults",
tools: [
"append_squashfs_overlay",
],
- srcs: [
- ":openwrt_rootfs_base_img_x86_64",
- ":openwrt_customization_x86_64",
- ],
- out: ["openwrt_rootfs_x86_64.img"],
cmd: "$(location append_squashfs_overlay) $(in) $(out) -w",
}
genrule {
- name: "combined_openwrt_rootfs_aarch64",
- tools: [
- "append_squashfs_overlay",
+ name: "openwrt_rootfs_combined_x86_64",
+ srcs: [
+ ":openwrt_rootfs_base_x86_64",
+ ":openwrt_rootfs_customization_x86_64",
],
+ out: ["openwrt_rootfs_combined_x86_64.img"],
+ defaults: ["openwrt_rootfs_combined_defaults"],
+
+}
+
+genrule {
+ name: "openwrt_rootfs_combined_aarch64",
srcs: [
- ":openwrt_rootfs_base_img_aarch64",
- ":openwrt_customization_aarch64",
+ ":openwrt_rootfs_base_aarch64",
+ ":openwrt_rootfs_customization_aarch64",
],
- out: ["openwrt_rootfs_aarch64.img"],
- cmd: "$(location append_squashfs_overlay) $(in) $(out) -w",
+ out: ["openwrt_rootfs_combined_aarch64.img"],
+ defaults: ["openwrt_rootfs_combined_defaults"],
}
prebuilt_etc_host {
name: "openwrt_rootfs_x86_64",
- src: ":combined_openwrt_rootfs_x86_64",
+ src: ":openwrt_rootfs_combined_x86_64",
sub_dir: "openwrt/images",
visibility: ["//device/google/cuttlefish/build"],
}
prebuilt_etc_host {
name: "openwrt_rootfs_aarch64",
- src: ":combined_openwrt_rootfs_aarch64",
+ src: ":openwrt_rootfs_combined_aarch64",
sub_dir: "openwrt/images",
visibility: ["//device/google/cuttlefish/build"],
}