summaryrefslogtreecommitdiff
path: root/Android.bp
blob: a3fab202069241871ca77a25d61c859992aa208b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "external_openwrt-prebuilts_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    //   SPDX-license-identifier-BSD
    //   SPDX-license-identifier-GPL-2.0
    default_visibility: ["//visibility:private"],
    default_applicable_licenses: ["external_openwrt-prebuilts_license"],
}

filegroup {
    name: "openwrt_license_files",
    visibility: [":__subpackages__"],
    srcs: [
        "LICENSE",
        "HOW_TO_GET_SOURCE_CODE",
    ],
}

license {
    name: "external_openwrt-prebuilts_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
        "SPDX-license-identifier-BSD",
        "SPDX-license-identifier-GPL-2.0",
        "SPDX-license-identifier-GPL-3.0",
        "SPDX-license-identifier-LGPL-2.1",
        "SPDX-license-identifier-MIT",
        "SPDX-license-identifier-ISC",
        "SPDX-license-identifier-OpenSSL",
    ],
    license_text: [
        "LICENSE",
        "HOW_TO_GET_SOURCE_CODE",
    ],
}

genrule_defaults {
    name: "openwrt_rootfs_base_defaults",
    cmd: "cp $(in) $(genDir) && gzip -d $(genDir)/* && cp $(genDir)/* $(out)",
}

genrule {
    name: "openwrt_rootfs_base_x86_64",
    srcs: [
        "x86_64/images/openwrt-22.03.3-x86-64-generic-squashfs-rootfs.img.gz",
    ],
    out: ["openwrt_rootfs_base_x86_64.img"],
    defaults: ["openwrt_rootfs_base_defaults"],
}

genrule {
    name: "openwrt_rootfs_base_aarch64",
    srcs: [
        "arm64/images/openwrt-22.03.3-armvirt-64-rootfs-squashfs.img.gz",
    ],
    out: ["openwrt_rootfs_base_aarch64.img"],
    defaults: ["openwrt_rootfs_base_defaults"],
}

genrule_defaults {
    name: "openwrt_rootfs_customization_defaults",
    tools: [
        "make_f2fs",
        "sload_f2fs",
    ],
    srcs: [
        ":openwrt_license_files",
        "shared/uci-defaults/*",
        "shared/config/*",
    ],
    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)/INFO $(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)",
}

genrule {
    name: "openwrt_rootfs_customization_x86_64",
    srcs: [
        "x86_64/kmods/*",
        "x86_64/packages/*",
        "x86_64/INFO",
    ],
    out: ["openwrt_rootfs_customization_x86_64.img"],
    defaults: ["openwrt_rootfs_customization_defaults"],
}

genrule {
    name: "openwrt_rootfs_customization_aarch64",
    srcs: [
        "arm64/kmods/*",
        "arm64/packages/*",
        "arm64/INFO",
    ],
    out: ["openwrt_rootfs_customization_aarch64.img"],
    defaults: ["openwrt_rootfs_customization_defaults"],
}

genrule_defaults {
    name: "openwrt_rootfs_combined_defaults",
    tools: [
        "append_squashfs_overlay",
    ],
    cmd: "$(location append_squashfs_overlay) $(in) $(out) -w",
}

genrule {
    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_aarch64",
        ":openwrt_rootfs_customization_aarch64",
    ],
    out: ["openwrt_rootfs_combined_aarch64.img"],
    defaults: ["openwrt_rootfs_combined_defaults"],
}

prebuilt_etc_host {
    name: "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: ":openwrt_rootfs_combined_aarch64",
    sub_dir: "openwrt/images",
    visibility: ["//device/google/cuttlefish/build"],
}

prebuilt_etc_host {
    name: "openwrt_kernel_x86_64",
    src: "x86_64/images/openwrt-22.03.3-x86-64-generic-kernel.bin",
    sub_dir: "openwrt/images",
    visibility: ["//device/google/cuttlefish/build"],
}

prebuilt_etc_host {
    name: "openwrt_kernel_aarch64",
    src: "arm64/images/openwrt-22.03.3-armvirt-64-Image",
    sub_dir: "openwrt/images",
    visibility: ["//device/google/cuttlefish/build"],
}