blob: a477379f2147c733d99149fe4a3377a65364ff10 [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/*",
Jeongik Cha86b522d2021-12-06 12:27:49 +000023 "config/*",
Jeongik Cha8e0bf132021-10-07 22:16:00 +090024 ],
25 out: ["customization.img"],
26 cmd: "mkdir -p $(genDir)/root/upper/etc/uci-defaults && " +
27 "mkdir -p $(genDir)/root/upper/ipks && " +
Jeongik Cha86b522d2021-12-06 12:27:49 +000028 "mkdir -p $(genDir)/root/upper/etc/config && " +
Jeongik Cha8e0bf132021-10-07 22:16:00 +090029 "cp $(in) $(genDir)/ && " +
30 "mv $(genDir)/*.ipk $(genDir)/root/upper/ipks && " +
31 "mv $(genDir)/LICENSE $(genDir)/HOW_TO_GET_SOURCE_CODE $(genDir)/root/upper && " +
Jeongik Cha86b522d2021-12-06 12:27:49 +000032 "mv $(genDir)/0_default_config $(genDir)/root/upper/etc/uci-defaults && " +
33 "find $(genDir) -maxdepth 1 -type f -exec mv {} $(genDir)/root/upper/etc/config \\; && " +
Jeongik Cha8e0bf132021-10-07 22:16:00 +090034 "ln -s 2 $(genDir)/root/.fs_state && " +
35 "truncate -s 128M $(out) && " +
36 "$(location make_f2fs) $(out) && " +
37 "$(location sload_f2fs) -f $(genDir)/root -t / $(out)",
38}
39
40genrule {
41 name: "openwrt_rootfs_base_img",
42 srcs: [
43 "images/openwrt-21.02.0-x86-64-generic-squashfs-rootfs.img.gz",
44 ],
45 out: ["base_rootfs.img"],
46 cmd: "cp $(in) $(genDir) && gzip -d $(genDir)/* && cp $(genDir)/* $(out)",
47}
48
49genrule {
50 name: "combined_openwrt_rootfs",
51 tools: [
52 "append_squashfs_overlay",
53 ],
54 srcs: [
55 ":openwrt_rootfs_base_img",
56 ":openwrt_customization",
57 ],
58 out: ["openwrt_rootfs.img"],
59 cmd: "$(location append_squashfs_overlay) $(in) $(out) -w",
60}
61
62prebuilt_etc_host {
63 name: "openwrt_rootfs",
64 src: ":combined_openwrt_rootfs",
65 sub_dir: "openwrt/images",
66 visibility: ["//device/google/cuttlefish/build"],
67}
68
69prebuilt_etc_host {
Jeongik Cha426c7f02021-11-05 14:15:12 +090070 name: "kernel_for_openwrt",
Jeongik Cha8e0bf132021-10-07 22:16:00 +090071 src: "images/openwrt-21.02.0-x86-64-generic-kernel.bin",
72 sub_dir: "openwrt/images",
73 visibility: ["//device/google/cuttlefish/build"],
Bob Badoure08326e2021-10-14 10:48:02 -070074}