blob: 0385e1cba11072865e81f619eb9fedc23b197359 [file] [log] [blame]
Bob Badoure08326e2021-10-14 10:48:02 -07001package {
2 // See: http://go/android-license-faq
3 // A large-scale-change added 'default_applicable_licenses' to import
4 // all of the 'license_kinds' from "openwrt_license"
5 // to get the below license kinds:
6 // SPDX-license-identifier-Apache-2.0
7 // SPDX-license-identifier-BSD
8 // SPDX-license-identifier-GPL-2.0
9 default_applicable_licenses: ["openwrt_license"],
10}
11
Jeongik Cha8e0bf132021-10-07 22:16:00 +090012genrule {
13 name: "openwrt_customization",
14 tools: [
15 "make_f2fs",
16 "sload_f2fs",
17 ],
18 srcs: [
19 ":openwrt_license_files",
20 "kmods/*",
21 "packages/*",
22 "uci-defaults/*",
23 ],
24 out: ["customization.img"],
25 cmd: "mkdir -p $(genDir)/root/upper/etc/uci-defaults && " +
26 "mkdir -p $(genDir)/root/upper/ipks && " +
27 "cp $(in) $(genDir)/ && " +
28 "mv $(genDir)/*.ipk $(genDir)/root/upper/ipks && " +
29 "mv $(genDir)/LICENSE $(genDir)/HOW_TO_GET_SOURCE_CODE $(genDir)/root/upper && " +
30 "mv $(genDir)/0_network_config $(genDir)/root/upper/etc/uci-defaults && " +
31 "ln -s 2 $(genDir)/root/.fs_state && " +
32 "truncate -s 128M $(out) && " +
33 "$(location make_f2fs) $(out) && " +
34 "$(location sload_f2fs) -f $(genDir)/root -t / $(out)",
35}
36
37genrule {
38 name: "openwrt_rootfs_base_img",
39 srcs: [
40 "images/openwrt-21.02.0-x86-64-generic-squashfs-rootfs.img.gz",
41 ],
42 out: ["base_rootfs.img"],
43 cmd: "cp $(in) $(genDir) && gzip -d $(genDir)/* && cp $(genDir)/* $(out)",
44}
45
46genrule {
47 name: "combined_openwrt_rootfs",
48 tools: [
49 "append_squashfs_overlay",
50 ],
51 srcs: [
52 ":openwrt_rootfs_base_img",
53 ":openwrt_customization",
54 ],
55 out: ["openwrt_rootfs.img"],
56 cmd: "$(location append_squashfs_overlay) $(in) $(out) -w",
57}
58
59prebuilt_etc_host {
60 name: "openwrt_rootfs",
61 src: ":combined_openwrt_rootfs",
62 sub_dir: "openwrt/images",
63 visibility: ["//device/google/cuttlefish/build"],
64}
65
66prebuilt_etc_host {
Jeongik Cha426c7f02021-11-05 14:15:12 +090067 name: "kernel_for_openwrt",
Jeongik Cha8e0bf132021-10-07 22:16:00 +090068 src: "images/openwrt-21.02.0-x86-64-generic-kernel.bin",
69 sub_dir: "openwrt/images",
70 visibility: ["//device/google/cuttlefish/build"],
Bob Badoure08326e2021-10-14 10:48:02 -070071}