Bob Badour | e08326e | 2021-10-14 10:48:02 -0700 | [diff] [blame] | 1 | package { |
| 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 Cha | 8e0bf13 | 2021-10-07 22:16:00 +0900 | [diff] [blame] | 12 | genrule { |
| 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 Cha | 86b522d | 2021-12-06 12:27:49 +0000 | [diff] [blame] | 23 | "config/*", |
Jeongik Cha | 8e0bf13 | 2021-10-07 22:16:00 +0900 | [diff] [blame] | 24 | ], |
| 25 | out: ["customization.img"], |
| 26 | cmd: "mkdir -p $(genDir)/root/upper/etc/uci-defaults && " + |
| 27 | "mkdir -p $(genDir)/root/upper/ipks && " + |
Jeongik Cha | 86b522d | 2021-12-06 12:27:49 +0000 | [diff] [blame] | 28 | "mkdir -p $(genDir)/root/upper/etc/config && " + |
Jeongik Cha | 8e0bf13 | 2021-10-07 22:16:00 +0900 | [diff] [blame] | 29 | "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 Cha | 86b522d | 2021-12-06 12:27:49 +0000 | [diff] [blame] | 32 | "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 Cha | 8e0bf13 | 2021-10-07 22:16:00 +0900 | [diff] [blame] | 34 | "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 | |
| 40 | genrule { |
| 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 | |
| 49 | genrule { |
| 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 | |
| 62 | prebuilt_etc_host { |
| 63 | name: "openwrt_rootfs", |
| 64 | src: ":combined_openwrt_rootfs", |
| 65 | sub_dir: "openwrt/images", |
| 66 | visibility: ["//device/google/cuttlefish/build"], |
| 67 | } |
| 68 | |
| 69 | prebuilt_etc_host { |
Jeongik Cha | 426c7f0 | 2021-11-05 14:15:12 +0900 | [diff] [blame] | 70 | name: "kernel_for_openwrt", |
Jeongik Cha | 8e0bf13 | 2021-10-07 22:16:00 +0900 | [diff] [blame] | 71 | src: "images/openwrt-21.02.0-x86-64-generic-kernel.bin", |
| 72 | sub_dir: "openwrt/images", |
| 73 | visibility: ["//device/google/cuttlefish/build"], |
Bob Badour | e08326e | 2021-10-14 10:48:02 -0700 | [diff] [blame] | 74 | } |