summaryrefslogtreecommitdiff
path: root/x86/Android.bp
blob: 0385e1cba11072865e81f619eb9fedc23b197359 (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
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "openwrt_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    //   SPDX-license-identifier-BSD
    //   SPDX-license-identifier-GPL-2.0
    default_applicable_licenses: ["openwrt_license"],
}

genrule {
    name: "openwrt_customization",
    tools: [
        "make_f2fs",
        "sload_f2fs",
    ],
    srcs: [
        ":openwrt_license_files",
        "kmods/*",
        "packages/*",
        "uci-defaults/*",
    ],
    out: ["customization.img"],
    cmd: "mkdir -p $(genDir)/root/upper/etc/uci-defaults && " +
         "mkdir -p $(genDir)/root/upper/ipks && " +
         "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_network_config $(genDir)/root/upper/etc/uci-defaults && " +
         "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_base_img",
    srcs: [
        "images/openwrt-21.02.0-x86-64-generic-squashfs-rootfs.img.gz",
    ],
    out: ["base_rootfs.img"],
    cmd: "cp $(in) $(genDir) && gzip -d $(genDir)/* && cp $(genDir)/* $(out)",
}

genrule {
    name: "combined_openwrt_rootfs",
    tools: [
        "append_squashfs_overlay",
    ],
    srcs: [
        ":openwrt_rootfs_base_img",
        ":openwrt_customization",
    ],
    out: ["openwrt_rootfs.img"],
    cmd: "$(location append_squashfs_overlay) $(in) $(out) -w",
}

prebuilt_etc_host {
    name: "openwrt_rootfs",
    src: ":combined_openwrt_rootfs",
    sub_dir: "openwrt/images",
    visibility: ["//device/google/cuttlefish/build"],
}

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