developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 1 | inherit rdk-image |
| 2 | |
| 3 | IMAGE_FEATURES_remove = "read-only-rootfs" |
developer | feea77e | 2022-07-11 18:10:33 +0800 | [diff] [blame] | 4 | IMAGE_FSTYPES_remove= "tar.gz" |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 5 | SYSTEMD_TOOLS = "systemd-analyze systemd-bootchart" |
| 6 | # systemd-bootchart doesn't currently build with musl libc |
| 7 | SYSTEMD_TOOLS_remove_libc-musl = "systemd-bootchart" |
| 8 | |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 9 | DEPENDS += "cryptsetup-native" |
| 10 | |
developer | c27ead3 | 2023-01-03 16:32:58 +0800 | [diff] [blame] | 11 | IMAGE_INSTALL += " \ |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 12 | ${SYSTEMD_TOOLS} \ |
developer | b76f9f3 | 2022-10-31 14:09:44 +0800 | [diff] [blame] | 13 | ethtool \ |
| 14 | ebtables \ |
| 15 | regs \ |
| 16 | mii-mgr \ |
| 17 | mtd \ |
| 18 | smp \ |
| 19 | mtk-factory-rw \ |
| 20 | ${@bb.utils.contains('DISTRO_FEATURES','switch_gsw_mode','switch','',d)} \ |
| 21 | mtd-utils-ubifs \ |
| 22 | u-boot-fw-utils \ |
| 23 | fw-upgrade \ |
| 24 | init-filogic \ |
| 25 | mac-sec \ |
| 26 | mtkhnat-util \ |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 27 | network-hotplug \ |
| 28 | libmcrypt \ |
developer | 3d785cd | 2022-05-05 16:20:47 +0800 | [diff] [blame] | 29 | coreutils \ |
| 30 | util-linux-readprofile \ |
| 31 | iputils \ |
| 32 | bc \ |
| 33 | python-core \ |
| 34 | dosfstools \ |
| 35 | pptp-linux \ |
| 36 | rp-pppoe \ |
developer | 08970cc | 2022-07-26 15:13:11 +0800 | [diff] [blame] | 37 | xl2tpd \ |
developer | a66c201 | 2022-11-01 19:16:16 +0800 | [diff] [blame] | 38 | strongswan \ |
| 39 | libpcap \ |
developer | 761278a | 2022-11-01 19:27:22 +0800 | [diff] [blame] | 40 | tcpdump \ |
| 41 | perf \ |
developer | c27ead3 | 2023-01-03 16:32:58 +0800 | [diff] [blame] | 42 | ${@bb.utils.contains('DISTRO_FEATURES','mt76','packagegroup-filogic-mt76','',d)} \ |
| 43 | ${@bb.utils.contains('DISTRO_FEATURES','logan','packagegroup-filogic-logan','',d)} \ |
| 44 | ${@bb.utils.contains('DISTRO_FEATURES','mtk_easymesh','packagegroup-filogic-mtk-easymesh','',d)} \ |
developer | cbfd34a | 2023-01-17 17:08:24 +0800 | [diff] [blame] | 45 | ${@bb.utils.contains('DISTRO_FEATURES','emmc','e2fsprogs f2fs-tools','',d)} \ |
developer | e8f1a74 | 2023-02-10 15:00:10 +0800 | [diff] [blame] | 46 | util-linux-blkid \ |
developer | 8693013 | 2023-02-13 17:52:00 +0800 | [diff] [blame] | 47 | util-linux-blockdev \ |
developer | 053257b | 2023-02-15 13:18:40 +0800 | [diff] [blame] | 48 | ${@bb.utils.contains('DISTRO_FEATURES','secure_boot','dmsetup','',d)} \ |
| 49 | ${@bb.utils.contains('DISTRO_FEATURES','efuse_tools','mtk-efuse-nl-drv mtk-efuse-nl-tool','',d)} \ |
developer | f1063ab | 2023-03-09 11:02:02 +0800 | [diff] [blame] | 50 | ${@bb.utils.contains('DISTRO_FEATURES','flow_offload','flowtable','',d)} \ |
| 51 | ${@bb.utils.contains('DISTRO_FEATURES','samba','ksmbd ksmbd-tools','',d)} \ |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 52 | " |
developer | 2bf53a9 | 2022-06-06 12:08:58 +0800 | [diff] [blame] | 53 | #IMAGE_INSTALL += " opensync openvswitch mesh-agent e2fsprogs " |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 54 | |
developer | 8118c82 | 2023-10-17 18:03:39 +0800 | [diff] [blame^] | 55 | IMAGE_INSTALL_append_mt7988 += " marvell-eth-firmware mediatek-eth-firmware " |
developer | ec94159 | 2022-11-18 14:34:39 +0800 | [diff] [blame] | 56 | |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 57 | |
developer | 15a4331 | 2022-04-12 11:23:23 +0800 | [diff] [blame] | 58 | BB_HASH_IGNORE_MISMATCH = "1" |
| 59 | IMAGE_NAME[vardepsexclude] = "DATETIME" |
| 60 | |
| 61 | #ESDK-CHANGES |
| 62 | do_populate_sdk_ext_prepend() { |
| 63 | builddir = d.getVar('TOPDIR') |
| 64 | if os.path.exists(builddir + '/conf/templateconf.cfg'): |
| 65 | with open(builddir + '/conf/templateconf.cfg', 'w') as f: |
| 66 | f.write('meta/conf\n') |
| 67 | } |
| 68 | |
| 69 | sdk_ext_postinst_append() { |
| 70 | echo "ln -s $target_sdk_dir/layers/openembedded-core/meta-rdk $target_sdk_dir/layers/openembedded-core/../meta-rdk \n" >> $env_setup_script |
| 71 | } |
| 72 | |
| 73 | PRSERV_HOST = "localhost:0" |
| 74 | INHERIT += "buildhistory" |
| 75 | BUILDHISTORY_COMMIT = "1" |
| 76 | |
| 77 | |
| 78 | |
| 79 | require image-exclude-files.inc |
| 80 | |
| 81 | remove_unused_file() { |
| 82 | for i in ${REMOVED_FILE_LIST} ; do rm -rf ${IMAGE_ROOTFS}/$i ; done |
| 83 | } |
| 84 | |
| 85 | ROOTFS_POSTPROCESS_COMMAND_append = "remove_unused_file; " |
developer | 23de003 | 2022-06-01 19:34:29 +0800 | [diff] [blame] | 86 | |
| 87 | do_filogic_gen_image(){ |
| 88 | if ${@bb.utils.contains('DISTRO_FEATURES','kernel_in_ubi','true','false',d)}; then |
developer | 23de003 | 2022-06-01 19:34:29 +0800 | [diff] [blame] | 89 | # create sysupgrade image align to openwrt |
| 90 | |
| 91 | rm -rf ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE} |
| 92 | rm -rf ${IMGDEPLOYDIR}/${PN}-${MACHINE}-sysupgrade.bin |
| 93 | |
| 94 | mkdir ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE} |
| 95 | |
| 96 | cp ${DEPLOY_DIR_IMAGE}/fitImage ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE}/kernel |
| 97 | cp ${IMGDEPLOYDIR}/${PN}-${MACHINE}.squashfs-xz ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE}/root |
| 98 | |
| 99 | cd ${IMGDEPLOYDIR} |
| 100 | tar cvf ${PN}-${MACHINE}-sysupgrade.bin sysupgrade-${PN}-${MACHINE} |
| 101 | mv ${PN}-${MACHINE}-sysupgrade.bin ${DEPLOY_DIR_IMAGE}/ |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 102 | |
| 103 | if ${@bb.utils.contains('DISTRO_FEATURES','secure_boot','true','false',d)}; then |
developer | 23de003 | 2022-06-01 19:34:29 +0800 | [diff] [blame] | 104 | |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 105 | rm -rf ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE}-sb |
| 106 | rm -rf ${IMGDEPLOYDIR}/${PN}-${MACHINE}-sb-sysupgrade.bin |
developer | 23de003 | 2022-06-01 19:34:29 +0800 | [diff] [blame] | 107 | |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 108 | mkdir ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE}-sb |
developer | 23de003 | 2022-06-01 19:34:29 +0800 | [diff] [blame] | 109 | |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 110 | cp ${DEPLOY_DIR_IMAGE}/fitImage-sb ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE}-sb/kernel |
| 111 | cp ${IMGDEPLOYDIR}/${PN}-${MACHINE}.squashfs-xz ${IMGDEPLOYDIR}/sysupgrade-${PN}-${MACHINE}-sb/root |
developer | 23de003 | 2022-06-01 19:34:29 +0800 | [diff] [blame] | 112 | |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 113 | cd ${IMGDEPLOYDIR} |
| 114 | tar cvf ${PN}-${MACHINE}-sb-sysupgrade.bin sysupgrade-${PN}-${MACHINE}-sb |
| 115 | mv ${PN}-${MACHINE}-sb-sysupgrade.bin ${DEPLOY_DIR_IMAGE}/ |
| 116 | fi |
developer | 23de003 | 2022-06-01 19:34:29 +0800 | [diff] [blame] | 117 | fi |
| 118 | |
| 119 | } |
| 120 | addtask filogic_gen_image after do_image_complete before do_populate_lic_deploy |
developer | 8777631 | 2022-12-02 10:29:28 +0800 | [diff] [blame] | 121 | |
| 122 | python do_hash_rootfs (){ |
| 123 | deploy_path = d.getVar('IMGDEPLOYDIR', d, 1) |
| 124 | PN = d.getVar('PN', d, 1) |
| 125 | MACHINE = d.getVar('MACHINE', d, 1) |
| 126 | SQUASHFS_FILE_PATH="%s/%s-%s.squashfs-xz" %(deploy_path, PN, MACHINE) |
| 127 | DEPLOY_DIR_IMAGE = d.getVar('DEPLOY_DIR_IMAGE', d, 1) |
| 128 | SUMMARY_FILE="%s/hash-summary" %(DEPLOY_DIR_IMAGE) |
| 129 | FILE_SIZE = os.path.getsize(SQUASHFS_FILE_PATH) |
| 130 | BLOCK_SIZE= int(d.getVar('NAND_PAGE_SIZE', d, 1)) |
| 131 | DATA_BLOCKS= FILE_SIZE / BLOCK_SIZE |
| 132 | |
| 133 | if ((FILE_SIZE % BLOCK_SIZE) != 0): |
| 134 | DATA_BLOCKS = DATA_BLOCKS+1 |
| 135 | |
| 136 | HASH_OFFSET=DATA_BLOCKS * BLOCK_SIZE |
| 137 | |
| 138 | import subprocess |
| 139 | subprocess.Popen("veritysetup format --data-blocks=%d --hash-offset=%d %s %s > %s" %(DATA_BLOCKS, HASH_OFFSET, SQUASHFS_FILE_PATH, SQUASHFS_FILE_PATH, SUMMARY_FILE), shell=True) |
| 140 | } |
| 141 | |
| 142 | addtask hash_rootfs after do_image_complete before do_filogic_gen_image |
| 143 | |
| 144 | python __anonymous () { |
| 145 | d.appendVarFlag('do_filogic_gen_image', 'depends', ' linux-mediatek:do_deploy') |
| 146 | } |