<commit_before>require tegra-binaries-${PV}.inc
require tegra-shared-binaries.inc

COMPATIBLE_MACHINE = "(tegra)"
PACKAGE_ARCH = "${SOC_FAMILY_PKGARCH}"

inherit systemd

do_configure() {
	tar -C ${B} -x -f ${S}/nv_tegra/nv_tools.tbz2 usr/sbin
        tar -C ${B} -x -f ${S}/nv_tegra/config.tbz2 etc
}

do_compile() {
	:
}

do_install() {
	install -d ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/nvbootctrl ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/nv_bootloader_payload_updater ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/nv_update_engine ${D}${sbindir}
	install -d ${D}${systemd_system_unitdir}
	install -m 0644 ${B}/etc/systemd/system/nv_update_verifier.service ${D}${systemd_system_unitdir}
	sed -i -e's,^After=nv\.service,After=nvstartup.service,' ${D}${systemd_system_unitdir}/nv_update_verifier.service
	install -d ${D}/opt/ota_package
}

do_install_append_tegra186() {
	install -d ${D}${datadir}/nv_tegra/rollback/t18x
	install -m 0644 ${S}/bootloader/rollback/t18x/rollback.cfg ${D}${datadir}/nv_tegra/rollback/t18x/
}

do_install_append_tegra194() {
	install -d ${D}${datadir}/nv_tegra/rollback/t19x
	install -m 0644 ${S}/bootloader/rollback/t19x/rollback.cfg ${D}${datadir}/nv_tegra/rollback/t19x/
}

do_install_tegra210() {
	install -d ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/l4t_payload_updater_t210 ${D}${sbindir}
	sed -i -e's,^#!/usr/bin/python,#!/usr/bin/env python2,' ${D}${sbindir}/l4t_payload_updater_t210
	install -d ${D}/opt/ota_package
}

INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_SYSROOT_STRIP = "1"
PACKAGES = "${PN}-nvbootctrl ${PN} ${PN}-dev"
FILES_${PN}-nvbootctrl = "${sbindir}/nvbootctrl"
FILES_${PN} += "/opt/ota_package"
FILES_${PN}-dev = "${datadir}/nv_tegra/rollback"
SYSTEMD_SERVICE_${PN} = "nv_update_verifier.service"
SYSTEMD_SERVICE_${PN}_tegra210 = ""
RDEPENDS_${PN}-nvbootctrl = "setup-nv-boot-control"
RDEPENDS_${PN}-nvbootctrl_tegra210 = ""
ALLOW_EMPTY_${PN}-nvbootctrl_tegra210 = "1"
RDEPENDS_${PN} = "${PN}-nvbootctrl setup-nv-boot-control-service"
RDEPENDS_${PN}_tegra210 = "setup-nv-boot-control-service python-argparse python-core python-subprocess python-textutils python-shell"
INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN}-nvbootctrl = "ldflags"<commit_msg>tegra-redundant-boot: use python3 for t210 updates<commit_after>require tegra-binaries-${PV}.inc
require tegra-shared-binaries.inc

COMPATIBLE_MACHINE = "(tegra)"
PACKAGE_ARCH = "${SOC_FAMILY_PKGARCH}"

DEPENDS = "tegra-binaries-patches quilt-native"

inherit systemd

do_configure() {
	rm -rf ${B}/usr/sbin ${B}/etc ${B}/patches ${B}/.pc
	tar -C ${B} -x -f ${S}/nv_tegra/nv_tools.tbz2 usr/sbin
        tar -C ${B} -x -f ${S}/nv_tegra/config.tbz2 etc
}

do_configure_append_tegra210() {
	quilt import ${STAGING_DATADIR}/l4t-patches-${PV}/Convert-l4t_payload_updater_t210-to-Python3.patch
        quilt push
}

do_compile() {
	:
}

do_install() {
	install -d ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/nvbootctrl ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/nv_bootloader_payload_updater ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/nv_update_engine ${D}${sbindir}
	install -d ${D}${systemd_system_unitdir}
	install -m 0644 ${B}/etc/systemd/system/nv_update_verifier.service ${D}${systemd_system_unitdir}
	sed -i -e's,^After=nv\.service,After=nvstartup.service,' ${D}${systemd_system_unitdir}/nv_update_verifier.service
	install -d ${D}/opt/ota_package
}

do_install_append_tegra186() {
	install -d ${D}${datadir}/nv_tegra/rollback/t18x
	install -m 0644 ${S}/bootloader/rollback/t18x/rollback.cfg ${D}${datadir}/nv_tegra/rollback/t18x/
}

do_install_append_tegra194() {
	install -d ${D}${datadir}/nv_tegra/rollback/t19x
	install -m 0644 ${S}/bootloader/rollback/t19x/rollback.cfg ${D}${datadir}/nv_tegra/rollback/t19x/
}

do_install_tegra210() {
	install -d ${D}${sbindir}
	install -m 0755 ${B}/usr/sbin/l4t_payload_updater_t210 ${D}${sbindir}
	install -d ${D}/opt/ota_package
}

INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_SYSROOT_STRIP = "1"
PACKAGES = "${PN}-nvbootctrl ${PN} ${PN}-dev"
FILES_${PN}-nvbootctrl = "${sbindir}/nvbootctrl"
FILES_${PN} += "/opt/ota_package"
FILES_${PN}-dev = "${datadir}/nv_tegra/rollback"
SYSTEMD_SERVICE_${PN} = "nv_update_verifier.service"
SYSTEMD_SERVICE_${PN}_tegra210 = ""
RDEPENDS_${PN}-nvbootctrl = "setup-nv-boot-control"
RDEPENDS_${PN}-nvbootctrl_tegra210 = ""
ALLOW_EMPTY_${PN}-nvbootctrl_tegra210 = "1"
RDEPENDS_${PN} = "${PN}-nvbootctrl setup-nv-boot-control-service"
RDEPENDS_${PN}_tegra210 = "setup-nv-boot-control-service python3-core"
INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN}-nvbootctrl = "ldflags"
{'fraction_non_alphanumeric': 0.18109216490394991, 'fraction_numerical': 0.03475070148931578, 'mean_word_length': 5.784773060029282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4737459', 'n_tokens_mistral': 2130, 'n_tokens_neox': 2006, 'n_words': 276}