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/*", |
| 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 | |
| 37 | genrule { |
| 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 | |
| 46 | genrule { |
| 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 | |
| 59 | prebuilt_etc_host { |
| 60 | name: "openwrt_rootfs", |
| 61 | src: ":combined_openwrt_rootfs", |
| 62 | sub_dir: "openwrt/images", |
| 63 | visibility: ["//device/google/cuttlefish/build"], |
| 64 | } |
| 65 | |
| 66 | prebuilt_etc_host { |
| 67 | name: "openwrt_kernel", |
| 68 | src: "images/openwrt-21.02.0-x86-64-generic-kernel.bin", |
| 69 | sub_dir: "openwrt/images", |
| 70 | visibility: ["//device/google/cuttlefish/build"], |
Bob Badour | e08326e | 2021-10-14 10:48:02 -0700 | [diff] [blame] | 71 | } |