From 80c756c3a4a3507ed14a63adbb5433176b0acfea Mon Sep 17 00:00:00 2001
From: GavinDarkglider <31815002+GavinDarkglider@users.noreply.github.com>
Date: Fri, 9 Jun 2023 17:16:27 -0700
Subject: [PATCH] L4T/Ayn: upstream changes from 5.x
Lakka 5.x Switch changes (#1853)
Lakka v5.x switchroot 5.1.2 (#1871)
Fix Switch Issue's in upstream 5.x (#1888)
Minor Switch Changes (#1893)
Lakka v5.x switch 3 (#1895)
Lakka v5.x switch 4 (#1898)
L4T: Xorg-server: Fix build issue (#1924)
Switch: remove ra patch
Lakka v5.x switch 6 (#1926)
Cleanups, More LibreELEC Stuff, more permission fixes, Misc switch stuff. (#1930)
Switch: U-Boot: bump version to 2024-NX02 (#1946)
L4T/Switch post-upstreaming fixes
- retroarch_joypad_autoconfig: remove spaces from file names
- retroarch: remove Switch specific patch merged upstream
- libXv: move to L4T packages folder (package removed in upstream)
- bring some packages from v5.x to L4T packages
- ffmpeg: remove vulkan
- remove stella core from Switch build (missing C++ headers)
- Ayn/Odin: use proper kernel arg to not hide kernel messages in console
---
packages/audio/pulseaudio-configs/package.mk | 1 +
.../pulseaudio-configs/pulse/client.conf | 6 +-
.../audio/pulseaudio-configs/pulse/default.pa | 3 +-
packages/devel/libcec/package.mk | 4 +-
packages/graphics/libdrm/package.mk | 6 +-
packages/lakka/lakka_tools/joycond/package.mk | 6 +-
.../lakka_tools/wii-u-gc-adapter/package.mk | 4 +
packages/lakka/libretro_cores/package.mk | 2 +
.../lakka/libretro_cores/ppsspp/package.mk | 5 +
packages/lakka/package.mk | 2 +-
.../lakka/retroarch_base/retroarch/package.mk | 14 +-
.../retroarch/scripts/retroarch-config | 12 -
.../udev/Nintendo_Switch_Left_Joy-Con.cfg | 18 +
.../udev/Nintendo_Switch_Lite_Gamepad.cfg | 29 +
.../udev/Nintendo_Switch_Right_Joy-Con.cfg | 18 +
packages/linux/package.mk | 11 +-
.../peripheral.joystick/package.mk | 7 +
packages/mediacenter/kodi/package.mk | 6 +
packages/multimedia/ffmpeg/package.mk | 28 +-
...d-nvv4l2-codec-for-Nvidia-Tegra-SOCs.patch | 180 +-
...2-fftools-libavformat-Enforce-nvv4l2.patch | 59 +-
.../0003-codecs-nvv4l2-avoid-probing.patch | 4 +-
...mat-remove-nvv4l2-probing-mitigation.patch | 20 +-
...s-nvv4l2-do-not-use-external-headers.patch | 12 +-
...6-codecs-nvv4l2-use-atomics-for-pool.patch | 4 +-
...d-new-functions-and-update-context-a.patch | 4 +-
...pport-multiple-L4T-versions-with-sin.patch | 4 +-
...odecs-nvv4l2-align-line-width-to-64B.patch | 4 +-
...nvv4l2-add-two-pass-cbr-mode-support.patch | 4 +-
.../0011-codecs-nvv4l2-various-bugfixes.patch | 4 +-
...x-hanging-on-event-wait-if-no-full-f.patch | 4 +-
...4l2-use-sessions-for-transformations.patch | 4 +-
...4l2-support-all-different-timestamps.patch | 4 +-
...015-codecs-nvv4l2-BSP-34.1.x-remarks.patch | 4 +-
...4l2-support-BT709-BT2020-colorspaces.patch | 4 +-
...v4l2-reorder-capture-buffer-queueing.patch | 4 +-
...4l2-align-encoder-plane-width-to-64B.patch | 4 +-
...ign-enc-plane-width-per-format-plane.patch | 4 +-
.../L4T/0020-codecs-nvv4l2-fix-memleak.patch | 4 +-
...021-codecs-nvv4l2-fix-use-after-free.patch | 39 +
.../L4T/0021-fix-libreelec-build-issue.patch | 26 -
...l2-rename-AVCodec-to-fit-API-renames.patch | 101 +
...omment-structs-redefined-in-nvv4l2.h.patch | 92 +
...decs-nvv4l2-More-API-related-changes.patch | 68 +
...d-encode.h-header-needed-for-ff_allo.patch | 25 +
...-fix-missing-comma-in-FFCodec-struct.patch | 25 +
...move-second-size-argument-as-it-is-u.patch | 26 +
...do-struct-commenting-due-to-OpenBuil.patch | 56 +
...nvv4l2-enforcing-Now-non-supported-p.patch | 222 +
.../0030-nvv4l2-add-yuv420p10-support.patch | 41 +
...supported-pixel-formats-NVDEC-only-s.patch | 127 +
...bit-HEVC-The-only-hw-support-for-10-.patch | 92 +
...re-rename-AVCodec-to-fit-API-renames.patch | 29 +
.../0034-codecs-nvv4l2-more-API-renames.patch | 58 +
...nd_codec_or_die-to-find_codec-API-re.patch | 82 +
...-codecs-nvv4l2-update-for-ABI-rework.patch | 30 +
...-codecs-nvv4l2-update-for-ABI-rework.patch | 31 +
...v4l2-find_codec_or_die-to-find_codec.patch | 83 +
...set-find_codec_or_die-logctx-to-NULL.patch | 25 +
...040-nvv4l2-do-not-override-key_frame.patch | 43 +
.../L4T/0041-fix-libreelec-configure.patch | 25 +
packages/multimedia/libva/package.mk | 5 +-
.../media-driver/patches/1648.patch | 288 +
packages/network/bluez/package.mk | 4 +-
...2-libreeelc-add-dbus-policy-for-user.patch | 38 +
packages/network/connman/package.mk | 10 +-
...-fix-libreelec-user-dbus-permissions.patch | 18 +
packages/sysutils/busybox/package.mk | 4 +
packages/sysutils/busybox/scripts/init | 6 +-
packages/sysutils/dbus/package.mk | 4 +-
packages/sysutils/libgudev/package.mk | 17 +
.../mergerfs-02_Fix_Makefile_issue.patch | 12 +
packages/sysutils/systemd/package.mk | 39 +-
.../systemd/system.d/remount_flash_ro.service | 12 +
packages/sysutils/upower/package.mk | 23 +
packages/x11/util/xdotool/package.mk | 2 +-
.../files/boot/EFI/debian/grub.cfg | 2 +-
.../devices/Switch/initramfs/platform_init | 8 +-
.../devices/Switch/linux/linux.aarch64.conf | 129 +-
projects/L4T/devices/Switch/options | 53 +-
.../packages/kodi/system.d/kodi.service | 25 +
.../retroarch/system.d/retroarch.service | 4 +-
.../switch-alsa-ucm-configs/package.mk | 11 -
.../postinit/00-tegra.conf | 131 -
.../postinit/01-tegra-rt565x.conf | 70 -
.../assets/README_CONFIG.txt | 169 +-
.../switch-bootloader/assets/boot.txt | 271 +-
.../packages/switch-bootloader/package.mk | 23 +-
.../switch-bsp/modprobe.d/xpadneo.conf | 6 +
.../Switch/packages/switch-bsp/package.mk | 30 +
.../scripts/dock-hotplug | 35 +-
.../scripts/fix-sysfs-permissions.sh | 27 +
.../switch-bsp/scripts/pair-joycon.sh | 216 +
.../sleep.d/99-Nintendo-Switch-Suspend.sh | 0
.../system.d/alsa-init.service | 0
.../system.d/fix-permissions.service | 15 +
.../system.d/pair-joycon.service | 2 +-
.../system.d/var-bluetoothconfig.mount | 0
.../system.d/xorg-configure-switch.service | 0
.../tmpfiles.d/mount-bluez-fs.conf | 0
.../ucm_data/tegra-snd-t210r/HiFi.conf | 0
.../tegra-snd-t210r/tegra-snd-t210r.conf | 0
.../udev.d/50-xpadneo-fixup-steamlink.rules | 2 +
.../switch-bsp/udev.d/60-xpadneo.rules | 2 +
.../udev.d/93-dock_hotplug.rules | 0
.../packages/switch-cpu-profile/package.mk | 15 -
.../switch-cpu-profile/scripts/cpu-profile | 135 -
.../system.d/switch-cpu-profile.service | 15 -
.../packages/switch-gpu-profile/package.mk | 16 -
.../switch-gpu-profile/scripts/gpu-profile | 126 -
.../system.d/switch-gpu-profile.service | 15 -
.../package.mk | 18 -
.../scripts/pair-joycon.sh | 130 -
.../Switch/packages/switch-u-boot/package.mk | 4 +-
.../packages/usb-gadget-scripts/package.mk | 1 +
.../joycond/01-Fix-cmake-install.patch | 2 +-
...ext-definition-to-uapi-signcontext.h.patch | 62 -
.../linux/0001-Fix-Volume-Mappings.patch | 24 +-
.../patches/linux/0004-fix-libcec-build.patch | 304 +
.../linux/0005-fix-libcec-build-2.patch | 12 +
.../Switch/patches/linux/0006-debug-cec.patch | 31 -
.../01-use-real-vendor-product-id.patch | 48 +
.../02-fix-axis-when-not-aligned-on-0.patch | 36 +
...ectly-all-buttons-even-if-not-mapped.patch | 28 +
...orrectly-the-uninitialized-joysticks.patch | 46 +
.../05-Add-Switch-joycon-mappings.patch | 214 +
projects/L4T/options | 45 +-
.../packages/busybox/config/busybox-host.conf | 1164 +
.../packages/busybox/config/busybox-init.conf | 1188 +
.../busybox/config/busybox-target.conf | 1184 +
projects/L4T/packages/busybox/config/inputrc | 66 +
projects/L4T/packages/busybox/config/profile | 34 +
.../busybox/config/suspend-modules.conf | 1 +
.../L4T/packages/busybox/default.d/crond.conf | 0
projects/L4T/packages/busybox/package.mk | 253 +
.../patches/busybox-00_halt_no_init.patch | 12 +
...box-02_silence-crond-startup-logging.patch | 20 +
.../busybox-03-make_unicode_printable.patch | 26 +
.../busybox-04-revert-dd-fsync-change.patch | 34 +
...-05-update-shadow-or-passwd-not-both.patch | 12 +
.../busybox-06-prevent-root-weak-passwd.patch | 12 +
.../busybox-07-hwclock_fix_settimeofday.patch | 58 +
.../busybox/profile.d/98-busybox.conf | 20 +
projects/L4T/packages/busybox/scripts/apt-get | 26 +
.../packages/busybox/scripts/create-edid-cpio | 36 +
.../L4T/packages/busybox/scripts/createlog | 180 +
.../packages/busybox/scripts/createlog-lakka | 195 +
.../L4T/packages/busybox/scripts/dthelper | 92 +
.../busybox/scripts/dump-active-edids-drm | 42 +
.../L4T/packages/busybox/scripts/fs-resize | 58 +
.../L4T/packages/busybox/scripts/functions | 156 +
projects/L4T/packages/busybox/scripts/getedid | 247 +
.../L4T/packages/busybox/scripts/getedid-drm | 55 +
projects/L4T/packages/busybox/scripts/init | 1177 +
.../busybox/scripts/kernel-overlays-setup | 85 +
projects/L4T/packages/busybox/scripts/ledfix | 16 +
.../scripts/libreelec-target-generator | 49 +
.../L4T/packages/busybox/scripts/lsb_release | 8 +
.../L4T/packages/busybox/scripts/pastebinit | 11 +
.../busybox/scripts/rpi-flash-firmware | 42 +
projects/L4T/packages/busybox/scripts/sudo | 17 +
.../scripts/update-bootloader-edid-rpi | 95 +
.../sleep.d.serial/99-suspend-modules.sh | 93 +
.../busybox/sysctl.d/99-coredump.conf | 1 +
.../L4T/packages/busybox/sysctl.d/cdrom.conf | 2 +
.../L4T/packages/busybox/sysctl.d/memory.conf | 1 +
.../system.d.opt/cron-defaults.service | 11 +
.../busybox/system.d.opt/cron.service | 16 +
.../busybox/system.d/fs-resize.service | 10 +
.../busybox/system.d/fs-resize.target | 5 +
.../packages/busybox/system.d/ledfix.service | 14 +
.../system.d/rpi-flash-firmware.service | 12 +
.../system.d/rpi-flash-firmware.target | 5 +
.../packages/busybox/system.d/shell.service | 23 +
.../busybox/system.d/show-version.service | 13 +
.../busybox/system.d/storage-log.service | 10 +
.../packages/busybox/system.d/textmode.target | 6 +
.../packages/busybox/system.d/var-log.mount | 14 +
.../L4T/packages/busybox/system.d/var.mount | 21 +
.../busybox/tmpfiles.d/z_01_busybox.conf | 11 +
projects/L4T/packages/curl/package.mk | 84 +
projects/L4T/packages/flycast/package.mk | 63 -
.../packages/glibc/patches/fix_autoconf.patch | 12 -
projects/L4T/packages/gptfdisk/package.mk | 20 +
...h-of-sgdisk-when-compiled-with-lates.patch | 57 +
...to-deal-with-minor-change-in-libuuid.patch | 39 +
...-man-pages-to-HTTPS-rather-than-HTTP.patch | 115 +
...ence-when-duplicating-string-argumen.patch | 40 +
...05-Use-64bit-time_t-on-linux-as-well.patch | 34 +
...dynamically-allocated-by-largest-new.patch | 38 +
.../patches/0007-Document-recent-merge.patch | 31 +
.../0008-Document-recent-mergest.patch | 49 +
...-casts-in-gptcurses.cc-to-eliminate-.patch | 69 +
...-decimal-inputs-e.g.-9.5G-becomes-9G.patch | 49 +
.../0011-Document-previous-merge.patch | 44 +
...e-cleanup-based-on-valgrind-analysis.patch | 38 +
.../L4T/packages}/libXv/package.mk | 4 +-
projects/L4T/packages/systemd/package.mk | 19 +-
.../packages/tegra-bsp/assets/10-monitor.conf | 3 +
.../v4l-utils/config/rc_keymaps/README | 3 +
.../config/rc_keymaps/protocols/README | 3 +
.../v4l-utils/config/rc_maps.cfg.sample | 20 +
.../packages/v4l-utils/keymaps/beelink.toml | 32 +
.../packages/v4l-utils/keymaps/cubox_i.toml | 13 +
.../packages/v4l-utils/keymaps/minix_neo.toml | 16 +
.../packages/v4l-utils/keymaps/pine64.toml | 29 +
.../packages/v4l-utils/keymaps/xbox_360.toml | 70 +
.../packages/v4l-utils/keymaps/xbox_one.toml | 37 +
.../L4T/packages/v4l-utils/keymaps/zotac.toml | 48 +
projects/L4T/packages/v4l-utils/package.mk | 116 +
...tils-001-disable-doxygen-in-automake.patch | 26 +
...l-utils-002-enable-bpf-without-clang.patch | 40 +
.../v4l-utils/udev.d/70-infrared.rules | 19 +
.../wpa_supplicant/config/makefile.config | 35 +
.../L4T/packages/wpa_supplicant/package.mk | 36 +
.../wpa_supplicant-2.4-libnl3-includes.patch | 12 +
.../packages/xf86-input-libinput/package.mk | 22 +
projects/L4T/packages/xorg-server/package.mk | 2 +-
...fig-value-field-from-bool-to-boolean.patch | 153 +
.../linux/0001-add-wireguard-support.patch | 51709 ++++++++++++++++
...stateful-object-reference-expression.patch | 206 +
...ilter-nf_tables-add-stateful-objects.patch | 849 +
scripts/get_l4t-kernel-sources | 5 +-
scripts/image | 4 +-
224 files changed, 64729 insertions(+), 1426 deletions(-)
create mode 100644 packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Left_Joy-Con.cfg
create mode 100644 packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Lite_Gamepad.cfg
create mode 100644 packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Right_Joy-Con.cfg
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0021-codecs-nvv4l2-fix-use-after-free.patch
delete mode 100644 packages/multimedia/ffmpeg/patches/L4T/0021-fix-libreelec-build-issue.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0022-codecs-nvv4l2-rename-AVCodec-to-fit-API-renames.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0023-codecs-nvv4l2-comment-structs-redefined-in-nvv4l2.h.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0024-codecs-nvv4l2-More-API-related-changes.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0025-codecs-nvv4l2-add-encode.h-header-needed-for-ff_allo.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0026-codecs-nvv4l2-fix-missing-comma-in-FFCodec-struct.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0027-codecs-nvv4l2-remove-second-size-argument-as-it-is-u.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0028-codecs-nvv4l2-undo-struct-commenting-due-to-OpenBuil.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0029-fftools-improve-nvv4l2-enforcing-Now-non-supported-p.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0030-nvv4l2-add-yuv420p10-support.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0031-nvv4l2-handle-unsupported-pixel-formats-NVDEC-only-s.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0032-nvv4l2-allow-10-bit-HEVC-The-only-hw-support-for-10-.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0033-codecs-nvv4l2-more-rename-AVCodec-to-fit-API-renames.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0034-codecs-nvv4l2-more-API-renames.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0035-codecs-nvv4l2-find_codec_or_die-to-find_codec-API-re.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0036-codecs-nvv4l2-update-for-ABI-rework.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0037-Revert-codecs-nvv4l2-update-for-ABI-rework.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0038-Revert-codecs-nvv4l2-find_codec_or_die-to-find_codec.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0039-fftools-ffmpeg-set-find_codec_or_die-logctx-to-NULL.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0040-nvv4l2-do-not-override-key_frame.patch
create mode 100644 packages/multimedia/ffmpeg/patches/L4T/0041-fix-libreelec-configure.patch
create mode 100644 packages/multimedia/media-driver/patches/1648.patch
create mode 100644 packages/network/bluez/patches/bluez-22-libreeelc-add-dbus-policy-for-user.patch
create mode 100644 packages/network/connman/patches/connman-06-fix-libreelec-user-dbus-permissions.patch
create mode 100644 packages/sysutils/libgudev/package.mk
create mode 100644 packages/sysutils/mergerfs/patches/mergerfs-02_Fix_Makefile_issue.patch
create mode 100644 packages/sysutils/systemd/system.d/remount_flash_ro.service
create mode 100644 packages/sysutils/upower/package.mk
create mode 100644 projects/L4T/devices/Switch/packages/kodi/system.d/kodi.service
delete mode 100644 projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/package.mk
delete mode 100644 projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/00-tegra.conf
delete mode 100644 projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/01-tegra-rt565x.conf
create mode 100644 projects/L4T/devices/Switch/packages/switch-bsp/modprobe.d/xpadneo.conf
create mode 100755 projects/L4T/devices/Switch/packages/switch-bsp/package.mk
rename projects/L4T/devices/Switch/packages/{switch-joycon-bluetooth-dock-configs => switch-bsp}/scripts/dock-hotplug (70%)
create mode 100755 projects/L4T/devices/Switch/packages/switch-bsp/scripts/fix-sysfs-permissions.sh
create mode 100755 projects/L4T/devices/Switch/packages/switch-bsp/scripts/pair-joycon.sh
rename projects/L4T/devices/Switch/packages/{switch-joycon-bluetooth-dock-configs => switch-bsp}/sleep.d/99-Nintendo-Switch-Suspend.sh (100%)
rename projects/L4T/devices/Switch/packages/{switch-alsa-ucm-configs => switch-bsp}/system.d/alsa-init.service (100%)
create mode 100644 projects/L4T/devices/Switch/packages/switch-bsp/system.d/fix-permissions.service
rename projects/L4T/devices/Switch/packages/{switch-joycon-bluetooth-dock-configs => switch-bsp}/system.d/pair-joycon.service (91%)
rename projects/L4T/devices/Switch/packages/{switch-joycon-bluetooth-dock-configs => switch-bsp}/system.d/var-bluetoothconfig.mount (100%)
rename projects/L4T/devices/Switch/packages/{switch-joycon-bluetooth-dock-configs => switch-bsp}/system.d/xorg-configure-switch.service (100%)
rename projects/L4T/devices/Switch/packages/{switch-joycon-bluetooth-dock-configs => switch-bsp}/tmpfiles.d/mount-bluez-fs.conf (100%)
rename projects/L4T/devices/Switch/packages/{switch-alsa-ucm-configs => switch-bsp}/ucm_data/tegra-snd-t210r/HiFi.conf (100%)
rename projects/L4T/devices/Switch/packages/{switch-alsa-ucm-configs => switch-bsp}/ucm_data/tegra-snd-t210r/tegra-snd-t210r.conf (100%)
create mode 100644 projects/L4T/devices/Switch/packages/switch-bsp/udev.d/50-xpadneo-fixup-steamlink.rules
create mode 100644 projects/L4T/devices/Switch/packages/switch-bsp/udev.d/60-xpadneo.rules
rename projects/L4T/devices/Switch/packages/{switch-joycon-bluetooth-dock-configs => switch-bsp}/udev.d/93-dock_hotplug.rules (100%)
delete mode 100644 projects/L4T/devices/Switch/packages/switch-cpu-profile/package.mk
delete mode 100755 projects/L4T/devices/Switch/packages/switch-cpu-profile/scripts/cpu-profile
delete mode 100644 projects/L4T/devices/Switch/packages/switch-cpu-profile/system.d/switch-cpu-profile.service
delete mode 100644 projects/L4T/devices/Switch/packages/switch-gpu-profile/package.mk
delete mode 100755 projects/L4T/devices/Switch/packages/switch-gpu-profile/scripts/gpu-profile
delete mode 100644 projects/L4T/devices/Switch/packages/switch-gpu-profile/system.d/switch-gpu-profile.service
delete mode 100755 projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/package.mk
delete mode 100755 projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/scripts/pair-joycon.sh
delete mode 100644 projects/L4T/devices/Switch/patches/l4t-kernel-sources/04-Revert-arm64-32bit-sigcontext-definition-to-uapi-signcontext.h.patch
create mode 100644 projects/L4T/devices/Switch/patches/linux/0004-fix-libcec-build.patch
create mode 100644 projects/L4T/devices/Switch/patches/linux/0005-fix-libcec-build-2.patch
delete mode 100644 projects/L4T/devices/Switch/patches/linux/0006-debug-cec.patch
create mode 100644 projects/L4T/devices/Switch/patches/peripheral.joystick/01-use-real-vendor-product-id.patch
create mode 100644 projects/L4T/devices/Switch/patches/peripheral.joystick/02-fix-axis-when-not-aligned-on-0.patch
create mode 100644 projects/L4T/devices/Switch/patches/peripheral.joystick/03-count-correctly-all-buttons-even-if-not-mapped.patch
create mode 100644 projects/L4T/devices/Switch/patches/peripheral.joystick/04-close-correctly-the-uninitialized-joysticks.patch
create mode 100644 projects/L4T/devices/Switch/patches/peripheral.joystick/05-Add-Switch-joycon-mappings.patch
create mode 100644 projects/L4T/packages/busybox/config/busybox-host.conf
create mode 100644 projects/L4T/packages/busybox/config/busybox-init.conf
create mode 100644 projects/L4T/packages/busybox/config/busybox-target.conf
create mode 100644 projects/L4T/packages/busybox/config/inputrc
create mode 100644 projects/L4T/packages/busybox/config/profile
create mode 100644 projects/L4T/packages/busybox/config/suspend-modules.conf
create mode 100644 projects/L4T/packages/busybox/default.d/crond.conf
create mode 100644 projects/L4T/packages/busybox/package.mk
create mode 100644 projects/L4T/packages/busybox/patches/busybox-00_halt_no_init.patch
create mode 100644 projects/L4T/packages/busybox/patches/busybox-02_silence-crond-startup-logging.patch
create mode 100644 projects/L4T/packages/busybox/patches/busybox-03-make_unicode_printable.patch
create mode 100644 projects/L4T/packages/busybox/patches/busybox-04-revert-dd-fsync-change.patch
create mode 100644 projects/L4T/packages/busybox/patches/busybox-05-update-shadow-or-passwd-not-both.patch
create mode 100644 projects/L4T/packages/busybox/patches/busybox-06-prevent-root-weak-passwd.patch
create mode 100644 projects/L4T/packages/busybox/patches/busybox-07-hwclock_fix_settimeofday.patch
create mode 100644 projects/L4T/packages/busybox/profile.d/98-busybox.conf
create mode 100755 projects/L4T/packages/busybox/scripts/apt-get
create mode 100755 projects/L4T/packages/busybox/scripts/create-edid-cpio
create mode 100755 projects/L4T/packages/busybox/scripts/createlog
create mode 100755 projects/L4T/packages/busybox/scripts/createlog-lakka
create mode 100755 projects/L4T/packages/busybox/scripts/dthelper
create mode 100755 projects/L4T/packages/busybox/scripts/dump-active-edids-drm
create mode 100755 projects/L4T/packages/busybox/scripts/fs-resize
create mode 100755 projects/L4T/packages/busybox/scripts/functions
create mode 100755 projects/L4T/packages/busybox/scripts/getedid
create mode 100755 projects/L4T/packages/busybox/scripts/getedid-drm
create mode 100755 projects/L4T/packages/busybox/scripts/init
create mode 100755 projects/L4T/packages/busybox/scripts/kernel-overlays-setup
create mode 100755 projects/L4T/packages/busybox/scripts/ledfix
create mode 100755 projects/L4T/packages/busybox/scripts/libreelec-target-generator
create mode 100755 projects/L4T/packages/busybox/scripts/lsb_release
create mode 100755 projects/L4T/packages/busybox/scripts/pastebinit
create mode 100755 projects/L4T/packages/busybox/scripts/rpi-flash-firmware
create mode 100755 projects/L4T/packages/busybox/scripts/sudo
create mode 100755 projects/L4T/packages/busybox/scripts/update-bootloader-edid-rpi
create mode 100755 projects/L4T/packages/busybox/sleep.d.serial/99-suspend-modules.sh
create mode 100644 projects/L4T/packages/busybox/sysctl.d/99-coredump.conf
create mode 100644 projects/L4T/packages/busybox/sysctl.d/cdrom.conf
create mode 100644 projects/L4T/packages/busybox/sysctl.d/memory.conf
create mode 100644 projects/L4T/packages/busybox/system.d.opt/cron-defaults.service
create mode 100644 projects/L4T/packages/busybox/system.d.opt/cron.service
create mode 100644 projects/L4T/packages/busybox/system.d/fs-resize.service
create mode 100644 projects/L4T/packages/busybox/system.d/fs-resize.target
create mode 100644 projects/L4T/packages/busybox/system.d/ledfix.service
create mode 100644 projects/L4T/packages/busybox/system.d/rpi-flash-firmware.service
create mode 100644 projects/L4T/packages/busybox/system.d/rpi-flash-firmware.target
create mode 100644 projects/L4T/packages/busybox/system.d/shell.service
create mode 100644 projects/L4T/packages/busybox/system.d/show-version.service
create mode 100644 projects/L4T/packages/busybox/system.d/storage-log.service
create mode 100644 projects/L4T/packages/busybox/system.d/textmode.target
create mode 100644 projects/L4T/packages/busybox/system.d/var-log.mount
create mode 100644 projects/L4T/packages/busybox/system.d/var.mount
create mode 100644 projects/L4T/packages/busybox/tmpfiles.d/z_01_busybox.conf
create mode 100644 projects/L4T/packages/curl/package.mk
delete mode 100644 projects/L4T/packages/flycast/package.mk
delete mode 100644 projects/L4T/packages/glibc/patches/fix_autoconf.patch
create mode 100644 projects/L4T/packages/gptfdisk/package.mk
create mode 100644 projects/L4T/packages/gptfdisk/patches/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0002-Updated-guid.cc-to-deal-with-minor-change-in-libuuid.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0003-Updated-URLs-in-man-pages-to-HTTPS-rather-than-HTTP.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0004-Fix-NULL-dereference-when-duplicating-string-argumen.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0005-Use-64bit-time_t-on-linux-as-well.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0006-Allow-partition-dynamically-allocated-by-largest-new.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0007-Document-recent-merge.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0008-Document-recent-mergest.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0009-Do-some-explicit-casts-in-gptcurses.cc-to-eliminate-.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0010-Truncate-decimal-inputs-e.g.-9.5G-becomes-9G.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0011-Document-previous-merge.patch
create mode 100644 projects/L4T/packages/gptfdisk/patches/0012-Minor-code-cleanup-based-on-valgrind-analysis.patch
rename {packages/x11/lib => projects/L4T/packages}/libXv/package.mk (85%)
create mode 100644 projects/L4T/packages/v4l-utils/config/rc_keymaps/README
create mode 100644 projects/L4T/packages/v4l-utils/config/rc_keymaps/protocols/README
create mode 100644 projects/L4T/packages/v4l-utils/config/rc_maps.cfg.sample
create mode 100644 projects/L4T/packages/v4l-utils/keymaps/beelink.toml
create mode 100644 projects/L4T/packages/v4l-utils/keymaps/cubox_i.toml
create mode 100644 projects/L4T/packages/v4l-utils/keymaps/minix_neo.toml
create mode 100644 projects/L4T/packages/v4l-utils/keymaps/pine64.toml
create mode 100644 projects/L4T/packages/v4l-utils/keymaps/xbox_360.toml
create mode 100644 projects/L4T/packages/v4l-utils/keymaps/xbox_one.toml
create mode 100644 projects/L4T/packages/v4l-utils/keymaps/zotac.toml
create mode 100644 projects/L4T/packages/v4l-utils/package.mk
create mode 100644 projects/L4T/packages/v4l-utils/patches/v4l-utils-001-disable-doxygen-in-automake.patch
create mode 100644 projects/L4T/packages/v4l-utils/patches/v4l-utils-002-enable-bpf-without-clang.patch
create mode 100644 projects/L4T/packages/v4l-utils/udev.d/70-infrared.rules
create mode 100644 projects/L4T/packages/wpa_supplicant/config/makefile.config
create mode 100644 projects/L4T/packages/wpa_supplicant/package.mk
create mode 100644 projects/L4T/packages/wpa_supplicant/patches/wpa_supplicant-2.4-libnl3-includes.patch
create mode 100644 projects/L4T/packages/xf86-input-libinput/package.mk
create mode 100644 projects/L4T/packages/xorg-server/patches/xorg-server-0002-hw-rename-boolean-config-value-field-from-bool-to-boolean.patch
create mode 100644 projects/L4T/patches/linux/0001-add-wireguard-support.patch
create mode 100644 projects/L4T/patches/linux/0002-netfilter-nf_tables-add-stateful-object-reference-expression.patch
create mode 100644 projects/L4T/patches/linux/0003-netfilter-nf_tables-add-stateful-objects.patch
diff --git a/packages/audio/pulseaudio-configs/package.mk b/packages/audio/pulseaudio-configs/package.mk
index 3e6811f3b43..0572d1f11ab 100644
--- a/packages/audio/pulseaudio-configs/package.mk
+++ b/packages/audio/pulseaudio-configs/package.mk
@@ -1,4 +1,5 @@
PKG_NAME="pulseaudio-configs"
+PKG_VERSION="1.1"
PKG_LICENSE="GPL"
PKG_DEPENDS_TARGET="alsa-plugins pulseaudio"
PKG_LONGDESC="Standard configs for pulseaudio"
diff --git a/packages/audio/pulseaudio-configs/pulse/client.conf b/packages/audio/pulseaudio-configs/pulse/client.conf
index 7a428f7ee95..97974c0a38d 100644
--- a/packages/audio/pulseaudio-configs/pulse/client.conf
+++ b/packages/audio/pulseaudio-configs/pulse/client.conf
@@ -19,10 +19,10 @@
; default-sink =
; default-source =
-; default-server =
+default-server = unix:/tmp/pulse-server
; default-dbus-server =
-; autospawn = yes
+autospawn = no
; daemon-binary = /usr/bin/pulseaudio
; extra-arguments = --log-target=syslog
@@ -33,3 +33,5 @@
; auto-connect-localhost = no
; auto-connect-display = no
+
+enable-memfd = yes
diff --git a/packages/audio/pulseaudio-configs/pulse/default.pa b/packages/audio/pulseaudio-configs/pulse/default.pa
index e36632172a1..4c120a7b66e 100644
--- a/packages/audio/pulseaudio-configs/pulse/default.pa
+++ b/packages/audio/pulseaudio-configs/pulse/default.pa
@@ -72,10 +72,11 @@ load-module module-bluetooth-discover
.endif
### Load several protocols
+load-module module-dbus-protocol
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
-load-module module-native-protocol-unix
+load-module module-native-protocol-unix auth-group=audio socket=/tmp/pulse-server
### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
diff --git a/packages/devel/libcec/package.mk b/packages/devel/libcec/package.mk
index 5d079fe4ab8..f328614a410 100644
--- a/packages/devel/libcec/package.mk
+++ b/packages/devel/libcec/package.mk
@@ -3,8 +3,8 @@
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="libcec"
-PKG_VERSION="4.0.7"
-PKG_SHA256="bcd92c376993a5721d346edcc09eb17289451f9156b1d1d113c9663c2046315a"
+PKG_VERSION="6.0.2"
+PKG_SHA256="090696d7a4fb772d7acebbb06f91ab92e025531c7c91824046b9e4e71ecb3377"
PKG_LICENSE="GPL"
PKG_SITE="http://libcec.pulse-eight.com/"
PKG_URL="https://github.com/Pulse-Eight/libcec/archive/libcec-${PKG_VERSION}.tar.gz"
diff --git a/packages/graphics/libdrm/package.mk b/packages/graphics/libdrm/package.mk
index 5d7c9cb4674..1d1adaddde2 100644
--- a/packages/graphics/libdrm/package.mk
+++ b/packages/graphics/libdrm/package.mk
@@ -45,10 +45,8 @@ listcontains "${GRAPHIC_DRIVERS}" "freedreno" &&
listcontains "${GRAPHIC_DRIVERS}" "etnaviv" &&
PKG_MESON_OPTS_TARGET+=" -Detnaviv=enabled" || PKG_MESON_OPTS_TARGET+=" -Detnaviv=disabled"
-if [ "${DISTRO}" = "Lakka" ]; then
- listcontains "${GRAPHIC_DRIVERS}" "nouveau" &&
- PKG_MESON_OPTS_TARGET="${PKG_MESON_OPTS_TARGET//-Dnouveau=disabled/-Dnouveau=enabled}"
-fi
+listcontains "${GRAPHIC_DRIVERS}" "nouveau" &&
+ PKG_MESON_OPTS_TARGET="${PKG_MESON_OPTS_TARGET//-Dnouveau=disabled/-Dnouveau=enabled}"
post_makeinstall_target() {
# Remove all test programs installed by install-test-programs=true except modetest
diff --git a/packages/lakka/lakka_tools/joycond/package.mk b/packages/lakka/lakka_tools/joycond/package.mk
index e52d1b5fce2..e962da2dbfa 100644
--- a/packages/lakka/lakka_tools/joycond/package.mk
+++ b/packages/lakka/lakka_tools/joycond/package.mk
@@ -2,9 +2,9 @@ PKG_NAME="joycond"
PKG_DEPENDS_TARGET="toolchain cmake:host libevdev systemd"
PKG_SITE="https://github.com/DanielOgorchock/joycond"
if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
- PKG_VERSION="031f04311a912514cea9deb020512ee6d7063398"
- PKG_SHA256="c2681b1f7723acf0e51e318be3194202e3a77627c78aa39e0a70797d0155dcba"
- PKG_URL="https://gitlab.com/switchroot/userspace/joycond/-/archive/c48187fcdacda1b139297e4944a149125e0800b2/joycond-c48187fcdacda1b139297e4944a149125e0800b2.tar.gz"
+ PKG_VERSION="c83539a8995040e8daf6912dab32a11082e75acf"
+ PKG_SHA256="10b043f226e49b17f1025ded37257ca096ed9fac5f22bbe91cd12cd6e7882835"
+ PKG_URL="https://gitlab.com/switchroot/userspace/joycond/-/archive/linux/joycond-linux.tar.gz"
else
PKG_VERSION="2d3f553060291f1bfee2e49fc2ca4a768b289df8"
PKG_SHA256="34ba2a4ffd35f2b2bbebd8ce47d17f2238d991bc6262653d0617b28f864e4b63"
diff --git a/packages/lakka/lakka_tools/wii-u-gc-adapter/package.mk b/packages/lakka/lakka_tools/wii-u-gc-adapter/package.mk
index 48090a808dd..91a9cca8ba1 100644
--- a/packages/lakka/lakka_tools/wii-u-gc-adapter/package.mk
+++ b/packages/lakka/lakka_tools/wii-u-gc-adapter/package.mk
@@ -10,3 +10,7 @@ makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin
cp wii-u-gc-adapter ${INSTALL}/usr/bin/
}
+
+post_install() {
+ enable_service wii-u-gc-adapter.service
+}
diff --git a/packages/lakka/libretro_cores/package.mk b/packages/lakka/libretro_cores/package.mk
index 66f888d28c1..e625cc679cf 100644
--- a/packages/lakka/libretro_cores/package.mk
+++ b/packages/lakka/libretro_cores/package.mk
@@ -222,6 +222,8 @@ elif [ "${PROJECT}" = "Generic" -a "${ARCH}" = "i386" ]; then
EXCLUDE_LIBRETRO_CORES+=" fake_08 openlara"
elif [ "${PROJECT}" = "Ayn" -a "${DEVICE}" = "Odin" ]; then
EXCLUDE_LIBRETRO_CORES+=" lr_moonlight"
+elif [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ EXCLUDE_LIBRETRO_CORES+=" stella"
fi
# disable cores that are only for specific targets
diff --git a/packages/lakka/libretro_cores/ppsspp/package.mk b/packages/lakka/libretro_cores/ppsspp/package.mk
index 7d8d601f6fb..247256e93bd 100644
--- a/packages/lakka/libretro_cores/ppsspp/package.mk
+++ b/packages/lakka/libretro_cores/ppsspp/package.mk
@@ -18,6 +18,11 @@ PKG_CMAKE_OPTS_TARGET="-DLIBRETRO=ON \
-DUSE_DISCORD=OFF \
-DUSE_MINIUPNPC=OFF"
+# for future compatibility - in case other platforms will use system ffmpeg
+if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ PKG_CMAKE_OPTS_TARGET=${PKG_CMAKE_OPTS_TARGET//-DUSE_SYSTEM_FFMPEG=ON/-DUSE_SYSTEM_FFMPEG=OFF}
+fi
+
if [ "${OPENGL_SUPPORT}" = "yes" ]; then
PKG_DEPENDS_TARGET+=" ${OPENGL}"
fi
diff --git a/packages/lakka/package.mk b/packages/lakka/package.mk
index 25a91c8ba29..71f9ee42670 100644
--- a/packages/lakka/package.mk
+++ b/packages/lakka/package.mk
@@ -36,6 +36,6 @@ if [ "${DEVICE}" != "Switch" -a "${DEVICE}" != "RPiZero-GPiCase" -a "${DEVICE}"
PKG_DEPENDS_TARGET+=" xbox360_controllers_shutdown"
fi
-if [ "${CEC_FRAMEWORK_SUPPORT}" = yes ]; then
+if [ "${CEC_FRAMEWORK_SUPPORT}" = yes -a ! "${PROJECT}" = "L4T" ]; then
PKG_DEPENDS_TARGET+=" cec_mini_kb"
fi
diff --git a/packages/lakka/retroarch_base/retroarch/package.mk b/packages/lakka/retroarch_base/retroarch/package.mk
index 7e47c074da9..901c78d0073 100644
--- a/packages/lakka/retroarch_base/retroarch/package.mk
+++ b/packages/lakka/retroarch_base/retroarch/package.mk
@@ -133,12 +133,12 @@ if [ "${PROJECT}" = "L4T" ]; then
fi
fi
-if [ "${LAKKA_NIGHTLY}" = yes ]; then
+if [ "${LAKKA_NIGHTLY}" = "yes" ]; then
PKG_MAKE_OPTS_TARGET+=" HAVE_LAKKA_NIGHTLY=1"
-fi
-
-if [ "${LAKKA_DEVBUILD}" = yes ]; then
+elif [ "${LAKKA_DEVBUILD}" = "yes" ]; then
PKG_MAKE_OPTS_TARGET+=" HAVE_LAKKA_DEVBUILD=1"
+elif [ -n "${LAKKA_CANARY_PATH}" ]; then
+ PKG_MAKE_OPTS_TARGET+=" HAVE_LAKKA_CANARY=\"${LAKKA_CANARY_PATH}\""
fi
pre_configure_target() {
@@ -233,7 +233,8 @@ makeinstall_target() {
echo 'audio_driver = "alsathread"' >> ${INSTALL}/etc/retroarch.cfg
echo 'audio_filter_dir = "/usr/share/audio_filters"' >> ${INSTALL}/etc/retroarch.cfg
- if [ "${DEVICE}" = "Exynos" ]; then # workaround the 55fps bug
+ if [ "${PROJECT}" = "Samsung" -a "${DEVICE}" = "Exynos" ]; then
+ # workaround the 55fps bug
echo 'audio_out_rate = "44100"' >> ${INSTALL}/etc/retroarch.cfg
fi
@@ -337,9 +338,6 @@ makeinstall_target() {
sed -i -e 's|^menu_driver =.*|menu_driver = "ozone"|' ${INSTALL}/etc/retroarch.cfg
if [ ! "${PROJECT}" = "Ayn" -a ! "${DEVICE}" = "Odin" ]; then
- #Set Default Joycon index to Combined Joycons.
- echo 'input_player1_joypad_index = "2"' >> ${INSTALL}/etc/retroarch.cfg
-
#Set Joypad as joypad with analog
echo 'input_libretro_device_p1 = "5"' >> ${INSTALL}/etc/retroarch.cfg
else
diff --git a/packages/lakka/retroarch_base/retroarch/scripts/retroarch-config b/packages/lakka/retroarch_base/retroarch/scripts/retroarch-config
index de4e0615066..f68676fd1bc 100755
--- a/packages/lakka/retroarch_base/retroarch/scripts/retroarch-config
+++ b/packages/lakka/retroarch_base/retroarch/scripts/retroarch-config
@@ -4,15 +4,3 @@ for i in 5 4 3 2 1 0; do [ -e /dev/snd/pcmC${i}D0p ] && export ALSA_CARD=$i; don
echo "ALSA_CARD=\"$ALSA_CARD\"" > /run/libreelec/retroarch.conf
echo "LD_LIBRARY_PATH=\"/usr/lib:/tmp/cores\"" >> /run/libreelec/retroarch.conf
-
-# WAR: Do to everything running as root, udev doesnt properly hide L/R joycon on 3 out of 4 revisions nintendo switch
-# which makes the combined controller index 2, but on Nintendo Switch Lite, on first boot we need to change this to 1
-# or built in gamepad needs user intervention to be used.
-
-SERIAL_PREFIX=$(cat /sys/firmware/devicetree/base/serial-number)
-SERIAL_PREFIX=${SERIAL_PREFIX:0:3}
-
-if [ ${SERIAL_PREFIX} = "NXV" -a ! -f /storage/.config/retroarch/retroarch.cfg ]; then
- cp /etc/retroarch.cfg /storage/.config/retroarch/retroarch.cfg
- sed -i -e 's|input_player1_joypad_index = \"2\"|input_player1_joypad_index = \"0\"|' /storage/.config/retroarch/retroarch.cfg
-fi
diff --git a/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Left_Joy-Con.cfg b/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Left_Joy-Con.cfg
new file mode 100644
index 00000000000..d5ecef57099
--- /dev/null
+++ b/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Left_Joy-Con.cfg
@@ -0,0 +1,18 @@
+input_driver = "udev"
+input_device = "Nintendo Switch Left Joy-Con Test"
+
+input_vendor_id = "1406"
+input_product_id = "8198"
+
+input_b_btn = "9"
+input_y_btn = "7"
+input_select_btn = "5"
+input_start_btn = "0"
+input_up_axis = "+0"
+input_down_axis = "-0"
+input_left_axis = "-1"
+input_right_axis = "+1"
+input_a_btn = "8"
+input_x_btn = "10"
+input_l_btn = "2"
+input_r_btn = "4"
diff --git a/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Lite_Gamepad.cfg b/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Lite_Gamepad.cfg
new file mode 100644
index 00000000000..0398b3b828c
--- /dev/null
+++ b/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Lite_Gamepad.cfg
@@ -0,0 +1,29 @@
+input_driver = "udev"
+input_device = "Nintendo Switch Lite Gamepad"
+input_vendor_id = "1406"
+input_product_id = "61731"
+input_b_btn = "0"
+input_y_btn = "3"
+input_select_btn = "9"
+input_start_btn = "10"
+input_up_btn = "14"
+input_down_btn = "15"
+input_left_btn = "16"
+input_right_btn = "17"
+input_a_btn = "1"
+input_x_btn = "2"
+input_l_btn = "5"
+input_r_btn = "6"
+input_l2_btn = "7"
+input_r2_btn = "8"
+input_l3_btn = "12"
+input_r3_btn = "13"
+input_l_x_plus_axis = "+0"
+input_l_x_minus_axis = "-0"
+input_l_y_plus_axis = "+1"
+input_l_y_minus_axis = "-1"
+input_r_x_plus_axis = "+2"
+input_r_x_minus_axis = "-2"
+input_r_y_plus_axis = "+3"
+input_r_y_minus_axis = "-3"
+input_gun_trigger_mbtn = "1"
diff --git a/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Right_Joy-Con.cfg b/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Right_Joy-Con.cfg
new file mode 100644
index 00000000000..3691bc077c1
--- /dev/null
+++ b/packages/lakka/retroarch_base/retroarch_joypad_autoconfig/joypad_configs/udev/Nintendo_Switch_Right_Joy-Con.cfg
@@ -0,0 +1,18 @@
+input_driver = "udev"
+input_device = "Nintendo Switch Right Joy-Con"
+
+input_vendor_id = "1406"
+input_product_id = "8199"
+
+input_b_btn = "1"
+input_y_btn = "0"
+input_select_btn = "9"
+input_start_btn = "8"
+input_up_axis = "-0"
+input_down_axis = "+0"
+input_left_axis = "+1"
+input_right_axis = "-1"
+input_a_btn = "2"
+input_x_btn = "3"
+input_l_btn = "4"
+input_r_btn = "6"
diff --git a/packages/linux/package.mk b/packages/linux/package.mk
index b813c4d1355..2008614a612 100644
--- a/packages/linux/package.mk
+++ b/packages/linux/package.mk
@@ -30,16 +30,21 @@ case "${LINUX}" in
;;
L4T)
if [ -z "${L4T_KERNEL_VERSION}" ]; then
- echo "${PROJECT}: ${KERNEL} - you must set L4T_KERNEL_VERSION in projects/${PROJECT}/device/${DEVICE}/options"
+ echo -n "${DEVICE:-${PROJECT}}: ${KERNEL} - you must set L4T_KERNEL_VERSION in projects/${PROJECT}/"
+ if [ -z "${DEVICE}" ]; then
+ echo "options"
+ else
+ echo "device/${DEVICE}/options"
+ fi
exit 1
fi
- PKG_VERSION=${DEVICE}-${L4T_KERNEL_VERSION}
+ PKG_VERSION=${DEVICE:-${PROJECT}}-${L4T_KERNEL_VERSION}
PKG_URL="l4t-kernel-sources"
GET_HANDLER_SUPPORT="l4t-kernel-sources"
PKG_PATCH_DIRS="${PROJECT} ${PROJECT}/${DEVICE}"
PKG_SOURCE_NAME="${PKG_NAME}-${PKG_VERSION}.tar.gz"
#Need to find a better way to do this for l4t platforms!
- PKG_SHA256=$L4T_COMBINED_KERNEL_SHA256
+ PKG_SHA256=${L4T_COMBINED_KERNEL_SHA256}
;;
ayn-odin)
PKG_SHA256="9aa25bf492928bc7a4542e87d28919c9ac36d27c"
diff --git a/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk
index 2096b400f78..fd0c21f6a19 100644
--- a/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk
+++ b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk
@@ -18,3 +18,10 @@ PKG_BUILD_FLAGS="+lto"
PKG_IS_ADDON="embedded"
PKG_ADDON_TYPE="kodi.peripheral"
+
+post_install() {
+ if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ # Set UDEV controller driver as active
+ sed -i -e 's|0|1|' ${INSTALL}/usr/share/kodi/addons/peripheral.joystick/resources/settings.xml
+ fi
+}
diff --git a/packages/mediacenter/kodi/package.mk b/packages/mediacenter/kodi/package.mk
index 67c82d1541c..97d9ebad4aa 100644
--- a/packages/mediacenter/kodi/package.mk
+++ b/packages/mediacenter/kodi/package.mk
@@ -10,6 +10,12 @@ PKG_SITE="http://www.kodi.tv"
PKG_URL="https://github.com/xbmc/xbmc/archive/${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain JsonSchemaBuilder:host TexturePacker:host Python3 zlib systemd lzo pcre swig:host libass curl fontconfig fribidi tinyxml tinyxml2 libjpeg-turbo freetype libcdio taglib libxml2 libxslt rapidjson sqlite ffmpeg crossguid libdvdnav libfmt lirc libfstrcmp flatbuffers:host flatbuffers libudfread spdlog"
PKG_DEPENDS_UNPACK="commons-lang3 commons-text groovy"
+
+if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ # Not really sure why u-power was removed, this is required to get battery statistics in kodi.
+ PKG_DEPENDS_TARGET+=" upower"
+fi
+
PKG_DEPENDS_HOST="toolchain"
PKG_LONGDESC="A free and open source cross-platform media player."
PKG_BUILD_FLAGS="+speed"
diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk
index 1fe86f77210..1fa52bc6b41 100644
--- a/packages/multimedia/ffmpeg/package.mk
+++ b/packages/multimedia/ffmpeg/package.mk
@@ -26,6 +26,12 @@ case "${PROJECT}" in
PKG_FFMPEG_RPI="--disable-mmal --enable-sand"
PKG_PATCH_DIRS+=" rpi"
;;
+ L4T)
+ PKG_DEPENDS_TARGET+=" tegra-bsp:host"
+ PKG_PATCH_DIRS+=" L4T"
+ PKG_FFMPEG_NVV4L2="--enable-nvv4l2"
+ EXTRA_CFLAGS="-I${SYSROOT_PREFIX}/usr/src/jetson_multimedia_api/include"
+ ;;
*)
PKG_PATCH_DIRS+=" v4l2-request v4l2-drmprime"
case "${PROJECT}" in
@@ -49,7 +55,7 @@ get_graphicdrivers
PKG_FFMPEG_HWACCEL="--enable-hwaccels"
-if [ "${V4L2_SUPPORT}" = "yes" ]; then
+if [ "${V4L2_SUPPORT}" = "yes" -a ! "${DEVICE}" = "Switch" ]; then
PKG_DEPENDS_TARGET+=" libdrm"
PKG_NEED_UNPACK+=" $(get_pkg_directory libdrm)"
PKG_FFMPEG_V4L2="--enable-v4l2_m2m --enable-libdrm"
@@ -68,7 +74,7 @@ if [ "${V4L2_SUPPORT}" = "yes" ]; then
PKG_FFMPEG_V4L2+=" --disable-libudev --disable-v4l2-request"
fi
else
- PKG_FFMPEG_V4L2="--disable-v4l2_m2m --disable-libudev --disable-v4l2-request"
+ : #PKG_FFMPEG_V4L2="--disable-v4l2_m2m --disable-libudev --disable-v4l2-request"
fi
if [ "${VAAPI_SUPPORT}" = "yes" ]; then
@@ -99,17 +105,6 @@ else
PKG_FFMPEG_DEBUG="--disable-debug --enable-stripping"
fi
-#Re-enable when patches are rebased on newer version of ffmpeg,for now we use old version.
-
-if [ "${PROJECT}" = "L4T" ]; then
- PKG_DEPENDS_TARGET+=" tegra-bsp:host"
- PKG_PATCH_DIRS+=" L4T"
- PKG_FFMPEG_NVV4L2="--enable-nvv4l2"
- EXTRA_CFLAGS="-I${SYSROOT_PREFIX}/usr/src/jetson_multimedia_api/include"
-else
- PKG_FFMPEG_NVV4L2=""
-fi
-
if target_has_feature neon; then
PKG_FFMPEG_FPU="--enable-neon"
else
@@ -128,13 +123,6 @@ else
PKG_FFMPEG_AV1="--disable-libdav1d"
fi
-if [ "${DISTRO}" = "Lakka" -a "${VULKAN_SUPPORT}" = yes ]; then
- PKG_DEPENDS_TARGET+=" ${VULKAN}"
- PKG_FFMPEG_VULKAN="--enable-vulkan"
-else
- PKG_FFMPEG_VULKAN="--disable-vulkan"
-fi
-
pre_configure_target() {
cd ${PKG_BUILD}
rm -rf .${TARGET_NAME}
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0001-codecs-add-nvv4l2-codec-for-Nvidia-Tegra-SOCs.patch b/packages/multimedia/ffmpeg/patches/L4T/0001-codecs-add-nvv4l2-codec-for-Nvidia-Tegra-SOCs.patch
index e75043e9cfd..d8c0a9e7421 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0001-codecs-add-nvv4l2-codec-for-Nvidia-Tegra-SOCs.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0001-codecs-add-nvv4l2-codec-for-Nvidia-Tegra-SOCs.patch
@@ -1,7 +1,7 @@
-From 3368013773dbc2def4b3a33748dc656dc13f3e25 Mon Sep 17 00:00:00 2001
+From 7df787ecf3260cbb9f370290afc13b77de740c4c Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Sat, 5 Mar 2022 03:27:27 +0000
-Subject: [PATCH 01/20] codecs: add nvv4l2 codec for Nvidia Tegra SOCs
+Subject: [PATCH 01/39] codecs: add nvv4l2 codec for Nvidia Tegra SOCs
Use `--enable-nvv4l2` to enable it.
@@ -46,24 +46,24 @@ FPS are halved.
Some formats are supported from Tegra X1 and up.
For more, check the NVDEC/NVENC version support matrix.
---
- configure | 22 +
- libavcodec/Makefile | 9 +
+ configure | 23 +
+ libavcodec/Makefile | 14 +-
libavcodec/allcodecs.c | 8 +
libavcodec/nvv4l2.c | 820 +++++++++++++++++++++++
libavcodec/nvv4l2.h | 324 +++++++++
libavcodec/nvv4l2_dec.c | 1101 +++++++++++++++++++++++++++++++
libavcodec/nvv4l2_enc.c | 1389 +++++++++++++++++++++++++++++++++++++++
- 7 files changed, 3673 insertions(+)
+ 7 files changed, 3678 insertions(+), 1 deletion(-)
create mode 100644 libavcodec/nvv4l2.c
create mode 100644 libavcodec/nvv4l2.h
create mode 100644 libavcodec/nvv4l2_dec.c
create mode 100644 libavcodec/nvv4l2_enc.c
diff --git a/configure b/configure
-index 98113c95fd..29a6d96575 100755
+index 3cd3bdfb44..889b547071 100755
--- a/configure
+++ b/configure
-@@ -333,6 +333,7 @@ External library support:
+@@ -336,6 +336,7 @@ External library support:
--enable-cuda-nvcc enable Nvidia CUDA compiler [no]
--disable-cuda-llvm disable CUDA compilation using clang [autodetect]
--disable-cuvid disable Nvidia CUVID support [autodetect]
@@ -71,7 +71,7 @@ index 98113c95fd..29a6d96575 100755
--disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect]
--disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect]
--disable-ffnvcodec disable dynamically linked Nvidia code [autodetect]
-@@ -1843,6 +1844,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
+@@ -1887,6 +1888,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
ffnvcodec
nvdec
nvenc
@@ -79,27 +79,28 @@ index 98113c95fd..29a6d96575 100755
vaapi
vdpau
videotoolbox
-@@ -3051,6 +3053,8 @@ qsvenc_select="qsv"
+@@ -3129,6 +3131,8 @@ qsvenc_select="qsv"
qsvvpp_select="qsv"
vaapi_encode_deps="vaapi"
v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
+nvv4l2_deps="libv4l2 pthreads linux_videodev2_h nvbuf_utils_h v4l2_nv_extensions_h"
+nvv4l2_extralibs="-lnvbuf_utils"
- hwupload_cuda_filter_deps="ffnvcodec"
- scale_npp_filter_deps="ffnvcodec libnpp"
-@@ -3066,6 +3070,9 @@ amf_deps_any="libdl LoadLibrary"
+ bilateral_cuda_filter_deps="ffnvcodec"
+ bilateral_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
+@@ -3153,6 +3157,10 @@ ddagrab_filter_deps="d3d11va IDXGIOutput1 DXGI_OUTDUPL_FRAME_INFO"
+ amf_deps_any="libdl LoadLibrary"
nvenc_deps="ffnvcodec"
nvenc_deps_any="libdl LoadLibrary"
- nvenc_encoder_deps="nvenc"
++nvenc_encoder_deps="nvenc"
+h264_nvv4l2_encoder_deps="nvv4l2"
+h264_nvv4l2_decoder_deps="nvv4l2"
+h264_nvv4l2_decoder_select="h264_mp4toannexb_bsf"
aac_mf_encoder_deps="mediafoundation"
ac3_mf_encoder_deps="mediafoundation"
-@@ -3098,6 +3105,9 @@ hevc_mediacodec_decoder_deps="mediacodec"
- hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
+@@ -3197,6 +3205,9 @@ hevc_mediacodec_encoder_extralibs="-landroid"
+ hevc_mediacodec_encoder_select="hevc_metadata"
hevc_mf_encoder_deps="mediafoundation"
hevc_nvenc_encoder_deps="nvenc"
+hevc_nvv4l2_encoder_deps="nvv4l2"
@@ -108,7 +109,7 @@ index 98113c95fd..29a6d96575 100755
hevc_nvenc_encoder_select="atsc_a53"
hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
hevc_qsv_encoder_select="hevcparse qsvenc"
-@@ -3121,6 +3131,7 @@ mpeg2_crystalhd_decoder_select="crystalhd"
+@@ -3220,6 +3231,7 @@ mpeg2_crystalhd_decoder_select="crystalhd"
mpeg2_cuvid_decoder_deps="cuvid"
mpeg2_mmal_decoder_deps="mmal"
mpeg2_mediacodec_decoder_deps="mediacodec"
@@ -116,7 +117,7 @@ index 98113c95fd..29a6d96575 100755
mpeg2_qsv_decoder_select="qsvdec"
mpeg2_qsv_encoder_select="qsvenc"
mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
-@@ -3129,6 +3140,7 @@ mpeg4_crystalhd_decoder_select="crystalhd"
+@@ -3228,6 +3240,7 @@ mpeg4_crystalhd_decoder_select="crystalhd"
mpeg4_cuvid_decoder_deps="cuvid"
mpeg4_mediacodec_decoder_deps="mediacodec"
mpeg4_mmal_decoder_deps="mmal"
@@ -124,7 +125,7 @@ index 98113c95fd..29a6d96575 100755
mpeg4_omx_encoder_deps="omx"
mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
-@@ -3142,6 +3154,7 @@ vc1_qsv_decoder_select="qsvdec"
+@@ -3239,6 +3252,7 @@ vc1_qsv_decoder_select="qsvdec"
vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
vp8_cuvid_decoder_deps="cuvid"
vp8_mediacodec_decoder_deps="mediacodec"
@@ -132,7 +133,7 @@ index 98113c95fd..29a6d96575 100755
vp8_qsv_decoder_select="qsvdec"
vp8_rkmpp_decoder_deps="rkmpp"
vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
-@@ -3150,6 +3163,7 @@ vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m"
+@@ -3247,6 +3261,7 @@ vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m"
vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m"
vp9_cuvid_decoder_deps="cuvid"
vp9_mediacodec_decoder_deps="mediacodec"
@@ -140,7 +141,7 @@ index 98113c95fd..29a6d96575 100755
vp9_qsv_decoder_select="qsvdec"
vp9_rkmpp_decoder_deps="rkmpp"
vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
-@@ -3426,6 +3440,7 @@ kmsgrab_indev_deps="libdrm"
+@@ -3537,6 +3552,7 @@ kmsgrab_indev_deps="libdrm"
lavfi_indev_deps="avfilter"
libcdio_indev_deps="libcdio"
libdc1394_indev_deps="libdc1394"
@@ -148,7 +149,7 @@ index 98113c95fd..29a6d96575 100755
openal_indev_deps="openal"
opengl_outdev_deps="opengl"
opengl_outdev_suggest="sdl2"
-@@ -6783,6 +6798,13 @@ if enabled_any nvdec cuvid; then
+@@ -7054,6 +7070,13 @@ if enabled_any nvdec cuvid; then
check_type "ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h" "CUVIDAV1PICPARAMS"
fi
@@ -161,51 +162,54 @@ index 98113c95fd..29a6d96575 100755
+
enabled amf &&
check_cpp_condition amf "AMF/core/Version.h" \
- "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400090000"
+ "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x00010004001c0000"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
-index 33a280cf69..31400f3f2d 100644
+index 389253f5d0..78f43ca9a1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
-@@ -133,6 +133,7 @@ OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
- mpegvideoencdsp.o
- OBJS-$(CONFIG_MSS34DSP) += mss34dsp.o
- OBJS-$(CONFIG_NVENC) += nvenc.o
+@@ -148,6 +148,8 @@ OBJS-$(CONFIG_MSMPEG4DEC) += msmpeg4dec.o msmpeg4.o msmpeg4data.o \
+ OBJS-$(CONFIG_MSMPEG4ENC) += msmpeg4enc.o msmpeg4.o msmpeg4data.o \
+ msmpeg4_vc1_data.o
+ OBJS-$(CONFIG_MSS34DSP) += mss34dsp.o jpegquanttables.o
++OBJS-$(CONFIG_NVENC) += nvenc.o
+OBJS-$(CONFIG_NVV4L2) += nvv4l2.o
OBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
OBJS-$(CONFIG_QPELDSP) += qpeldsp.o
OBJS-$(CONFIG_QSV) += qsv.o
-@@ -372,12 +373,14 @@ OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \
- h264_slice.o h264data.o
+@@ -404,11 +406,15 @@ OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \
+ h264_slice.o h264data.o h274.o
OBJS-$(CONFIG_H264_AMF_ENCODER) += amfenc_h264.o
OBJS-$(CONFIG_H264_CUVID_DECODER) += cuviddec.o
+OBJS-$(CONFIG_H264_NVV4L2_DECODER) += nvv4l2_dec.o
OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
+ OBJS-$(CONFIG_H264_MEDIACODEC_ENCODER) += mediacodecenc.o
OBJS-$(CONFIG_H264_MF_ENCODER) += mfenc.o mf_utils.o
OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o
- OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o
- OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o
- OBJS-$(CONFIG_NVENC_H264_ENCODER) += nvenc_h264.o
+-OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o nvenc.o
++OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o
++OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o
++OBJS-$(CONFIG_NVENC_H264_ENCODER) += nvenc_h264.o
+OBJS-$(CONFIG_H264_NVV4L2_ENCODER) += nvv4l2_enc.o
OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o
OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec.o
OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o
-@@ -395,6 +398,7 @@ OBJS-$(CONFIG_HEVC_DECODER) += hevcdec.o hevc_mvs.o \
- hevcdsp.o hevc_filter.o hevc_data.o
+@@ -430,6 +436,7 @@ OBJS-$(CONFIG_HEVC_DECODER) += hevcdec.o hevc_mvs.o \
+ h274.o
OBJS-$(CONFIG_HEVC_AMF_ENCODER) += amfenc_hevc.o
OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuviddec.o
+OBJS-$(CONFIG_HEVC_NVV4L2_DECODER) += nvv4l2_dec.o
OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o
+ OBJS-$(CONFIG_HEVC_MEDIACODEC_ENCODER) += mediacodecenc.o
OBJS-$(CONFIG_HEVC_MF_ENCODER) += mfenc.o mf_utils.o
- OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o
-@@ -405,6 +409,7 @@ OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o \
- OBJS-$(CONFIG_HEVC_RKMPP_DECODER) += rkmppdec.o
- OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o h265_profile_level.o
+@@ -441,6 +448,7 @@ OBJS-$(CONFIG_HEVC_RKMPP_DECODER) += rkmppdec.o
+ OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o h265_profile_level.o \
+ h2645data.o
OBJS-$(CONFIG_HEVC_V4L2M2M_DECODER) += v4l2_m2m_dec.o
+OBJS-$(CONFIG_HEVC_NVV4L2_ENCODER) += nvv4l2_enc.o
OBJS-$(CONFIG_HEVC_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
+ OBJS-$(CONFIG_HEVC_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
OBJS-$(CONFIG_HNM4_VIDEO_DECODER) += hnm4video.o
- OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
-@@ -495,12 +500,14 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o
+@@ -535,12 +543,14 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
OBJS-$(CONFIG_MPEG2_CUVID_DECODER) += cuviddec.o
@@ -213,23 +217,23 @@ index 33a280cf69..31400f3f2d 100644
OBJS-$(CONFIG_MPEG2_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_MPEG2_VAAPI_ENCODER) += vaapi_encode_mpeg2.o
OBJS-$(CONFIG_MPEG2_V4L2M2M_DECODER) += v4l2_m2m_dec.o
- OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o
+ OBJS-$(CONFIG_MPEG4_DECODER) += mpeg4videodsp.o xvididct.o
OBJS-$(CONFIG_MPEG4_ENCODER) += mpeg4videoenc.o
OBJS-$(CONFIG_MPEG4_CUVID_DECODER) += cuviddec.o
+OBJS-$(CONFIG_MPEG4_NVV4L2_DECODER) += nvv4l2_dec.o
OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o
OBJS-$(CONFIG_MPEG4_V4L2M2M_DECODER) += v4l2_m2m_dec.o
-@@ -715,6 +722,7 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
- OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
- OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
+@@ -763,6 +773,7 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
+ OBJS-$(CONFIG_VP7_DECODER) += vp8.o vpx_rac.o
+ OBJS-$(CONFIG_VP8_DECODER) += vp8.o vpx_rac.o
OBJS-$(CONFIG_VP8_CUVID_DECODER) += cuviddec.o
+OBJS-$(CONFIG_VP8_NVV4L2_DECODER) += nvv4l2_dec.o
OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_VP8_QSV_DECODER) += qsvdec.o
OBJS-$(CONFIG_VP8_RKMPP_DECODER) += rkmppdec.o
-@@ -725,6 +733,7 @@ OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9data.o vp9dsp.o vp9lpf.o vp9r
- vp9block.o vp9prob.o vp9mvs.o vp56rac.o \
+@@ -773,6 +784,7 @@ OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9data.o vp9dsp.o vp9lpf.o vp9r
+ vp9block.o vp9prob.o vp9mvs.o vpx_rac.o \
vp9dsp_8bpp.o vp9dsp_10bpp.o vp9dsp_12bpp.o
OBJS-$(CONFIG_VP9_CUVID_DECODER) += cuviddec.o
+OBJS-$(CONFIG_VP9_NVV4L2_DECODER) += nvv4l2_dec.o
@@ -237,50 +241,50 @@ index 33a280cf69..31400f3f2d 100644
OBJS-$(CONFIG_VP9_RKMPP_DECODER) += rkmppdec.o
OBJS-$(CONFIG_VP9_VAAPI_ENCODER) += vaapi_encode_vp9.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
-index 2e9a3581de..a828e43cfd 100644
+index e593ad19af..8eb911eec2 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
-@@ -141,6 +141,8 @@ extern AVCodec ff_h263i_decoder;
- extern AVCodec ff_h263p_encoder;
- extern AVCodec ff_h263p_decoder;
- extern AVCodec ff_h263_v4l2m2m_decoder;
-+extern AVCodec ff_h264_nvv4l2_encoder;
-+extern AVCodec ff_h264_nvv4l2_decoder;
- extern AVCodec ff_h264_decoder;
- extern AVCodec ff_h264_crystalhd_decoder;
- extern AVCodec ff_h264_v4l2m2m_decoder;
-@@ -150,6 +152,8 @@ extern AVCodec ff_h264_qsv_decoder;
- extern AVCodec ff_h264_rkmpp_decoder;
- extern AVCodec ff_hap_encoder;
- extern AVCodec ff_hap_decoder;
-+extern AVCodec ff_hevc_nvv4l2_encoder;
-+extern AVCodec ff_hevc_nvv4l2_decoder;
- extern AVCodec ff_hevc_decoder;
- extern AVCodec ff_hevc_qsv_decoder;
- extern AVCodec ff_hevc_rkmpp_decoder;
-@@ -194,8 +198,10 @@ extern AVCodec ff_mobiclip_decoder;
- extern AVCodec ff_motionpixels_decoder;
- extern AVCodec ff_mpeg1video_encoder;
- extern AVCodec ff_mpeg1video_decoder;
-+extern AVCodec ff_mpeg2_nvv4l2_decoder;
- extern AVCodec ff_mpeg2video_encoder;
- extern AVCodec ff_mpeg2video_decoder;
-+extern AVCodec ff_mpeg4_nvv4l2_decoder;
- extern AVCodec ff_mpeg4_encoder;
- extern AVCodec ff_mpeg4_decoder;
- extern AVCodec ff_mpeg4_crystalhd_decoder;
-@@ -356,9 +362,11 @@ extern AVCodec ff_vp6_decoder;
- extern AVCodec ff_vp6a_decoder;
- extern AVCodec ff_vp6f_decoder;
- extern AVCodec ff_vp7_decoder;
-+extern AVCodec ff_vp8_nvv4l2_decoder;
- extern AVCodec ff_vp8_decoder;
- extern AVCodec ff_vp8_rkmpp_decoder;
- extern AVCodec ff_vp8_v4l2m2m_decoder;
-+extern AVCodec ff_vp9_nvv4l2_decoder;
- extern AVCodec ff_vp9_decoder;
- extern AVCodec ff_vp9_rkmpp_decoder;
- extern AVCodec ff_vp9_v4l2m2m_decoder;
+@@ -150,6 +150,8 @@ extern const FFCodec ff_h263i_decoder;
+ extern const FFCodec ff_h263p_encoder;
+ extern const FFCodec ff_h263p_decoder;
+ extern const FFCodec ff_h263_v4l2m2m_decoder;
++extern const FFCodec ff_h264_nvv4l2_encoder;
++extern const FFCodec ff_h264_nvv4l2_decoder;
+ extern const FFCodec ff_h264_decoder;
+ extern const FFCodec ff_h264_crystalhd_decoder;
+ extern const FFCodec ff_h264_v4l2m2m_decoder;
+@@ -160,6 +162,8 @@ extern const FFCodec ff_h264_qsv_decoder;
+ extern const FFCodec ff_h264_rkmpp_decoder;
+ extern const FFCodec ff_hap_encoder;
+ extern const FFCodec ff_hap_decoder;
++extern const FFCodec ff_hevc_nvv4l2_encoder;
++extern const FFCodec ff_hevc_nvv4l2_decoder;
+ extern const FFCodec ff_hevc_decoder;
+ extern const FFCodec ff_hevc_qsv_decoder;
+ extern const FFCodec ff_hevc_rkmpp_decoder;
+@@ -205,8 +209,10 @@ extern const FFCodec ff_mobiclip_decoder;
+ extern const FFCodec ff_motionpixels_decoder;
+ extern const FFCodec ff_mpeg1video_encoder;
+ extern const FFCodec ff_mpeg1video_decoder;
++extern const FFCodec ff_mpeg2_nvv4l2_decoder;
+ extern const FFCodec ff_mpeg2video_encoder;
+ extern const FFCodec ff_mpeg2video_decoder;
++extern const FFCodec ff_mpeg4_nvv4l2_decoder;
+ extern const FFCodec ff_mpeg4_encoder;
+ extern const FFCodec ff_mpeg4_decoder;
+ extern const FFCodec ff_mpeg4_crystalhd_decoder;
+@@ -376,9 +382,11 @@ extern const FFCodec ff_vp6_decoder;
+ extern const FFCodec ff_vp6a_decoder;
+ extern const FFCodec ff_vp6f_decoder;
+ extern const FFCodec ff_vp7_decoder;
++extern const FFCodec ff_vp8_nvv4l2_decoder;
+ extern const FFCodec ff_vp8_decoder;
+ extern const FFCodec ff_vp8_rkmpp_decoder;
+ extern const FFCodec ff_vp8_v4l2m2m_decoder;
++extern const FFCodec ff_vp9_nvv4l2_decoder;
+ extern const FFCodec ff_vp9_decoder;
+ extern const FFCodec ff_vp9_rkmpp_decoder;
+ extern const FFCodec ff_vp9_v4l2m2m_decoder;
diff --git a/libavcodec/nvv4l2.c b/libavcodec/nvv4l2.c
new file mode 100644
index 0000000000..b3e4a27823
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0002-fftools-libavformat-Enforce-nvv4l2.patch b/packages/multimedia/ffmpeg/patches/L4T/0002-fftools-libavformat-Enforce-nvv4l2.patch
index e7f6a9b8f1f..23f56db80f7 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0002-fftools-libavformat-Enforce-nvv4l2.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0002-fftools-libavformat-Enforce-nvv4l2.patch
@@ -1,51 +1,20 @@
-From b58c700230430c744470e2fdedc73e2439a51346 Mon Sep 17 00:00:00 2001
+From ffa9de21d7415d53f2f02b674438a41daaeee209 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Sat, 5 Mar 2022 03:30:44 +0000
-Subject: [PATCH 02/20] fftools/libavformat: Enforce nvv4l2
+Subject: [PATCH 02/39] fftools/libavformat: Enforce nvv4l2
This enforces NVV4L2 even if user requests another codec.
Additionally, it forces nvv4l2 to go through software codecs first to get context if needed.
---
- fftools/ffmpeg_opt.c | 19 +++++++++++++++++++
- fftools/ffplay.c | 25 +++++++++++++++++++++++++
- libavformat/utils.c | 13 +++++++++++++
- 3 files changed, 57 insertions(+)
+ fftools/ffplay.c | 25 +++++++++++++++++++++++++
+ libavformat/demux.c | 13 +++++++++++++
+ 2 files changed, 38 insertions(+)
-diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
-index 807e783422..d6f28bda23 100644
---- a/fftools/ffmpeg_opt.c
-+++ b/fftools/ffmpeg_opt.c
-@@ -771,6 +771,25 @@ static const AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVSt
- char *codec_name = NULL;
-
- MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
-+
-+#if CONFIG_NVV4L2
-+ /* Reset requested decoder in order to enforce NVV4L2 if possible. */
-+ if (codec_name) {
-+ if (strcmp(codec_name, "h264") == 0)
-+ return avcodec_find_decoder(st->codecpar->codec_id);
-+ else if (strcmp(codec_name, "hevc") == 0)
-+ return avcodec_find_decoder(st->codecpar->codec_id);
-+ else if (strcmp(codec_name, "mpeg2video") == 0)
-+ return avcodec_find_decoder(st->codecpar->codec_id);
-+ else if (strcmp(codec_name, "mpeg4") == 0)
-+ return avcodec_find_decoder(st->codecpar->codec_id);
-+ else if (strcmp(codec_name, "vp8") == 0)
-+ return avcodec_find_decoder(st->codecpar->codec_id);
-+ else if (strcmp(codec_name, "vp9") == 0 && st->codecpar->format != AV_PIX_FMT_YUV420P10)
-+ return avcodec_find_decoder(st->codecpar->codec_id);
-+ }
-+#endif
-+
- if (codec_name) {
- const AVCodec *codec = find_codec_or_die(codec_name, st->codecpar->codec_type, 0);
- st->codecpar->codec_id = codec->id;
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
-index e14c800b8f..e1c7b741b9 100644
+index d6479aef5f..86f8425a15 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
-@@ -2601,6 +2601,31 @@ static int stream_component_open(VideoState *is, int stream_index)
+@@ -2590,6 +2590,31 @@ static int stream_component_open(VideoState *is, int stream_index)
case AVMEDIA_TYPE_SUBTITLE: is->last_subtitle_stream = stream_index; forced_codec_name = subtitle_codec_name; break;
case AVMEDIA_TYPE_VIDEO : is->last_video_stream = stream_index; forced_codec_name = video_codec_name; break;
}
@@ -77,11 +46,11 @@ index e14c800b8f..e1c7b741b9 100644
if (forced_codec_name)
codec = avcodec_find_decoder_by_name(forced_codec_name);
if (!codec) {
-diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 1384b56771..a960f8265d 100644
---- a/libavformat/utils.c
-+++ b/libavformat/utils.c
-@@ -211,6 +211,19 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
+diff --git a/libavformat/demux.c b/libavformat/demux.c
+index b19ab86d08..ae60a819d5 100644
+--- a/libavformat/demux.c
++++ b/libavformat/demux.c
+@@ -77,6 +77,19 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
if (codec_id == AV_CODEC_ID_H264)
return avcodec_find_decoder_by_name("h264");
#endif
@@ -94,12 +63,12 @@ index 1384b56771..a960f8265d 100644
+ else if (codec_id == AV_CODEC_ID_MPEG4)
+ return avcodec_find_decoder_by_name("mpeg4");
+ else if (codec_id == AV_CODEC_ID_VP8)
-+ return avcodec_find_decoder_by_name("vp8");
++ return avcodec_find_decoder_by_name("vp8");
+ else if (codec_id == AV_CODEC_ID_VP9)
+ return avcodec_find_decoder_by_name("vp9");
+#endif
- codec = find_decoder(s, st, codec_id);
+ codec = ff_find_decoder(s, st, codec_id);
if (!codec)
--
2.25.1
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0003-codecs-nvv4l2-avoid-probing.patch b/packages/multimedia/ffmpeg/patches/L4T/0003-codecs-nvv4l2-avoid-probing.patch
index f1c55345ff8..259afcef239 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0003-codecs-nvv4l2-avoid-probing.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0003-codecs-nvv4l2-avoid-probing.patch
@@ -1,7 +1,7 @@
-From 87622041abb1387bc8580721d23ec79a03e5249c Mon Sep 17 00:00:00 2001
+From c80256646ddae6d91a1ec9fe1a6cda53efaf923f Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Sun, 6 Mar 2022 04:26:06 +0000
-Subject: [PATCH 03/20] codecs: nvv4l2: avoid probing
+Subject: [PATCH 03/39] codecs: nvv4l2: avoid probing
NVV4L2 does not support probing for getting stream metadata.
So disallow that.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0004-libavformat-remove-nvv4l2-probing-mitigation.patch b/packages/multimedia/ffmpeg/patches/L4T/0004-libavformat-remove-nvv4l2-probing-mitigation.patch
index 40dee57726c..ba3a252ad7b 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0004-libavformat-remove-nvv4l2-probing-mitigation.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0004-libavformat-remove-nvv4l2-probing-mitigation.patch
@@ -1,18 +1,18 @@
-From ecdbd9b4904b71bea7d3c373690d0e6283896730 Mon Sep 17 00:00:00 2001
+From 81aa7501ce56cf7df7ee7be3bf6e7e37d1952dc8 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Sun, 6 Mar 2022 04:27:54 +0000
-Subject: [PATCH 04/20] libavformat: remove nvv4l2 probing mitigation
+Subject: [PATCH 04/39] libavformat: remove nvv4l2 probing mitigation
It was fixed properly with AV_CODEC_CAP_AVOID_PROBING flag.
---
- libavformat/utils.c | 13 -------------
+ libavformat/demux.c | 13 -------------
1 file changed, 13 deletions(-)
-diff --git a/libavformat/utils.c b/libavformat/utils.c
-index a960f8265d..1384b56771 100644
---- a/libavformat/utils.c
-+++ b/libavformat/utils.c
-@@ -211,19 +211,6 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
+diff --git a/libavformat/demux.c b/libavformat/demux.c
+index ae60a819d5..b19ab86d08 100644
+--- a/libavformat/demux.c
++++ b/libavformat/demux.c
+@@ -77,19 +77,6 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
if (codec_id == AV_CODEC_ID_H264)
return avcodec_find_decoder_by_name("h264");
#endif
@@ -25,12 +25,12 @@ index a960f8265d..1384b56771 100644
- else if (codec_id == AV_CODEC_ID_MPEG4)
- return avcodec_find_decoder_by_name("mpeg4");
- else if (codec_id == AV_CODEC_ID_VP8)
-- return avcodec_find_decoder_by_name("vp8");
+- return avcodec_find_decoder_by_name("vp8");
- else if (codec_id == AV_CODEC_ID_VP9)
- return avcodec_find_decoder_by_name("vp9");
-#endif
- codec = find_decoder(s, st, codec_id);
+ codec = ff_find_decoder(s, st, codec_id);
if (!codec)
--
2.25.1
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0005-codecs-nvv4l2-do-not-use-external-headers.patch b/packages/multimedia/ffmpeg/patches/L4T/0005-codecs-nvv4l2-do-not-use-external-headers.patch
index a5f0750bd7b..4dd4c0daba0 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0005-codecs-nvv4l2-do-not-use-external-headers.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0005-codecs-nvv4l2-do-not-use-external-headers.patch
@@ -1,7 +1,7 @@
-From 8e286f3ffc845709f6747d77982c60ad0ed0b37f Mon Sep 17 00:00:00 2001
+From 135ad87310784e7dfd49c95ba6f7ed45e9444cd8 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:16:35 +0000
-Subject: [PATCH 05/20] codecs: nvv4l2: do not use external headers
+Subject: [PATCH 05/39] codecs: nvv4l2: do not use external headers
Make needed headers builtin as this will help to bring compatibility from r32.3.1 till r32.7.1 and newer with a single build.
---
@@ -11,10 +11,10 @@ Make needed headers builtin as this will help to bring compatibility from r32.3.
create mode 100644 libavcodec/nvv4l2_ext_utils.h
diff --git a/configure b/configure
-index 29a6d96575..ea84db929c 100755
+index 889b547071..ba28526b44 100755
--- a/configure
+++ b/configure
-@@ -3053,7 +3053,7 @@ qsvenc_select="qsv"
+@@ -3131,7 +3131,7 @@ qsvenc_select="qsv"
qsvvpp_select="qsv"
vaapi_encode_deps="vaapi"
v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
@@ -22,8 +22,8 @@ index 29a6d96575..ea84db929c 100755
+nvv4l2_deps="libv4l2 pthreads linux_videodev2_h"
nvv4l2_extralibs="-lnvbuf_utils"
- hwupload_cuda_filter_deps="ffnvcodec"
-@@ -6798,11 +6798,8 @@ if enabled_any nvdec cuvid; then
+ bilateral_cuda_filter_deps="ffnvcodec"
+@@ -7070,11 +7070,8 @@ if enabled_any nvdec cuvid; then
check_type "ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h" "CUVIDAV1PICPARAMS"
fi
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0006-codecs-nvv4l2-use-atomics-for-pool.patch b/packages/multimedia/ffmpeg/patches/L4T/0006-codecs-nvv4l2-use-atomics-for-pool.patch
index 6b315773f53..99c1aade4a8 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0006-codecs-nvv4l2-use-atomics-for-pool.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0006-codecs-nvv4l2-use-atomics-for-pool.patch
@@ -1,7 +1,7 @@
-From fd622ef8d15cf208810f82a6a843b4db94fb28be Mon Sep 17 00:00:00 2001
+From 4896ff0afcdccbb5521dee948c233dccb6616d7a Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:20:48 +0000
-Subject: [PATCH 06/20] codecs: nvv4l2: use atomics for pool
+Subject: [PATCH 06/39] codecs: nvv4l2: use atomics for pool
Do not lock with mutexes until we need to do more in pools. Use atomics for now to lower latency.
---
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0007-codecs-nvv4l2-add-new-functions-and-update-context-a.patch b/packages/multimedia/ffmpeg/patches/L4T/0007-codecs-nvv4l2-add-new-functions-and-update-context-a.patch
index 9d844bb051e..fd5e059ba68 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0007-codecs-nvv4l2-add-new-functions-and-update-context-a.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0007-codecs-nvv4l2-add-new-functions-and-update-context-a.patch
@@ -1,7 +1,7 @@
-From 0fd5fb903861c42d40f84b0468496006966e1c5d Mon Sep 17 00:00:00 2001
+From 607f6a8e40b495ecb887fc046bf8cf6030036c3a Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:23:33 +0000
-Subject: [PATCH 07/20] codecs: nvv4l2: add new functions and update context as
+Subject: [PATCH 07/39] codecs: nvv4l2: add new functions and update context as
prep
---
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0008-codecs-nvv4l2-support-multiple-L4T-versions-with-sin.patch b/packages/multimedia/ffmpeg/patches/L4T/0008-codecs-nvv4l2-support-multiple-L4T-versions-with-sin.patch
index a9d376d46da..ef3d118c334 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0008-codecs-nvv4l2-support-multiple-L4T-versions-with-sin.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0008-codecs-nvv4l2-support-multiple-L4T-versions-with-sin.patch
@@ -1,7 +1,7 @@
-From 02d9583d32a9a8bd02dda9dd510519c04691d8d2 Mon Sep 17 00:00:00 2001
+From 72f992d69e5462c2da170f4259032b5f9ff6b250 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:31:31 +0000
-Subject: [PATCH 08/20] codecs: nvv4l2: support multiple L4T versions with
+Subject: [PATCH 08/39] codecs: nvv4l2: support multiple L4T versions with
single build
Nvidia has the tendency to break compatibility on documented apis for no reason.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0009-codecs-nvv4l2-align-line-width-to-64B.patch b/packages/multimedia/ffmpeg/patches/L4T/0009-codecs-nvv4l2-align-line-width-to-64B.patch
index 8eb5f57f791..ac491077739 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0009-codecs-nvv4l2-align-line-width-to-64B.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0009-codecs-nvv4l2-align-line-width-to-64B.patch
@@ -1,7 +1,7 @@
-From 280522f4f351a045ae7288ce7f5110ae099ea8b7 Mon Sep 17 00:00:00 2001
+From ade9d9b54d172437be84797300b25a85c4164cd4 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:39:48 +0000
-Subject: [PATCH 09/20] codecs: nvv4l2: align line width to 64B
+Subject: [PATCH 09/39] codecs: nvv4l2: align line width to 64B
Transformations of formats to formats of simply Block linear to Pitch are done in HW.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0010-codecs-nvv4l2-add-two-pass-cbr-mode-support.patch b/packages/multimedia/ffmpeg/patches/L4T/0010-codecs-nvv4l2-add-two-pass-cbr-mode-support.patch
index a5c0fe0d153..e3b9fb30631 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0010-codecs-nvv4l2-add-two-pass-cbr-mode-support.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0010-codecs-nvv4l2-add-two-pass-cbr-mode-support.patch
@@ -1,7 +1,7 @@
-From 9d3282af10055fbbb81bd53654dd342682e2d09d Mon Sep 17 00:00:00 2001
+From b7a72216ca1ed53f6428a3fca5949618d2059538 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:42:29 +0000
-Subject: [PATCH 10/20] codecs: nvv4l2: add two-pass cbr mode support
+Subject: [PATCH 10/39] codecs: nvv4l2: add two-pass cbr mode support
To enable, use `twopass=on` as encoder option.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0011-codecs-nvv4l2-various-bugfixes.patch b/packages/multimedia/ffmpeg/patches/L4T/0011-codecs-nvv4l2-various-bugfixes.patch
index af2ad5e68c8..0ff8f027839 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0011-codecs-nvv4l2-various-bugfixes.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0011-codecs-nvv4l2-various-bugfixes.patch
@@ -1,7 +1,7 @@
-From 73aba81a154a3f25efb2326a6e59949660d6a5f5 Mon Sep 17 00:00:00 2001
+From 124b4a1c85f24a11de5710b8515648dae91000cf Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:46:36 +0000
-Subject: [PATCH 11/20] codecs: nvv4l2: various bugfixes
+Subject: [PATCH 11/39] codecs: nvv4l2: various bugfixes
---
libavcodec/nvv4l2_dec.c | 105 ++++++++++++++++++++++------------------
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0012-codecs-nvv4l2-fix-hanging-on-event-wait-if-no-full-f.patch b/packages/multimedia/ffmpeg/patches/L4T/0012-codecs-nvv4l2-fix-hanging-on-event-wait-if-no-full-f.patch
index da7e5410e57..25648384645 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0012-codecs-nvv4l2-fix-hanging-on-event-wait-if-no-full-f.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0012-codecs-nvv4l2-fix-hanging-on-event-wait-if-no-full-f.patch
@@ -1,7 +1,7 @@
-From c0832ff40e14ff28c926e500525cdf839d58ff98 Mon Sep 17 00:00:00 2001
+From d78e4bc70ec1d97e22c5f0365c027574e740923f Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:50:20 +0000
-Subject: [PATCH 12/20] codecs: nvv4l2: fix hanging on event wait if no full
+Subject: [PATCH 12/39] codecs: nvv4l2: fix hanging on event wait if no full
frame info
Sometimes the decoder can be opened with no packet sent or not many for a frame to be decoded.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0013-codecs-nvv4l2-use-sessions-for-transformations.patch b/packages/multimedia/ffmpeg/patches/L4T/0013-codecs-nvv4l2-use-sessions-for-transformations.patch
index 772b5b9d9ca..3f7e4e78df9 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0013-codecs-nvv4l2-use-sessions-for-transformations.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0013-codecs-nvv4l2-use-sessions-for-transformations.patch
@@ -1,7 +1,7 @@
-From eceaecff30fc8a1ca622de7506470d486e34695a Mon Sep 17 00:00:00 2001
+From ac123e70b68b22a99b483ba5b9406e60b35f1519 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:53:34 +0000
-Subject: [PATCH 13/20] codecs: nvv4l2: use sessions for transformations
+Subject: [PATCH 13/39] codecs: nvv4l2: use sessions for transformations
Some apps use different processes for init and decoding.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0014-codecs-nvv4l2-support-all-different-timestamps.patch b/packages/multimedia/ffmpeg/patches/L4T/0014-codecs-nvv4l2-support-all-different-timestamps.patch
index 26c066ff052..079a253c327 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0014-codecs-nvv4l2-support-all-different-timestamps.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0014-codecs-nvv4l2-support-all-different-timestamps.patch
@@ -1,7 +1,7 @@
-From 1d0dbfb7243a12b2941a23584a2dbed7cfb7077f Mon Sep 17 00:00:00 2001
+From 95ed6f305a76c588f8264406e69123e3775e6c36 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Fri, 18 Mar 2022 21:57:58 +0000
-Subject: [PATCH 14/20] codecs: nvv4l2: support all different timestamps
+Subject: [PATCH 14/39] codecs: nvv4l2: support all different timestamps
Various packets and players have different timestamps defined.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0015-codecs-nvv4l2-BSP-34.1.x-remarks.patch b/packages/multimedia/ffmpeg/patches/L4T/0015-codecs-nvv4l2-BSP-34.1.x-remarks.patch
index 0bd386c2e7d..0a1419b0a49 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0015-codecs-nvv4l2-BSP-34.1.x-remarks.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0015-codecs-nvv4l2-BSP-34.1.x-remarks.patch
@@ -1,7 +1,7 @@
-From 04008befad133d97b7f956a21632592aaaede7ca Mon Sep 17 00:00:00 2001
+From 0cd74d94cdac5e3cd7ce3e014b3af2b276389074 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Sat, 11 Jun 2022 17:14:49 +0000
-Subject: [PATCH 15/20] codecs: nvv4l2: BSP 34.1.x remarks
+Subject: [PATCH 15/39] codecs: nvv4l2: BSP 34.1.x remarks
NVIDIA changed the enum again in r34 and broke compatibility for no reason.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0016-codecs-nvv4l2-support-BT709-BT2020-colorspaces.patch b/packages/multimedia/ffmpeg/patches/L4T/0016-codecs-nvv4l2-support-BT709-BT2020-colorspaces.patch
index 57b84e61ced..c8ec383d6a0 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0016-codecs-nvv4l2-support-BT709-BT2020-colorspaces.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0016-codecs-nvv4l2-support-BT709-BT2020-colorspaces.patch
@@ -1,7 +1,7 @@
-From 3674076e6287c62dd39c73585521504908f25fb9 Mon Sep 17 00:00:00 2001
+From 628d01310250a97fc874f3acb9405460b57e679d Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Tue, 14 Jun 2022 19:21:20 +0000
-Subject: [PATCH 16/20] codecs: nvv4l2: support BT709/BT2020 colorspaces
+Subject: [PATCH 16/39] codecs: nvv4l2: support BT709/BT2020 colorspaces
---
libavcodec/nvv4l2_dec.c | 62 ++++++++++++++++++++++++-----------
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0017-codecs-nvv4l2-reorder-capture-buffer-queueing.patch b/packages/multimedia/ffmpeg/patches/L4T/0017-codecs-nvv4l2-reorder-capture-buffer-queueing.patch
index 7caeb4683d9..0917b8756d0 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0017-codecs-nvv4l2-reorder-capture-buffer-queueing.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0017-codecs-nvv4l2-reorder-capture-buffer-queueing.patch
@@ -1,7 +1,7 @@
-From 636c040931dff3d5febae00697a8502af396e01f Mon Sep 17 00:00:00 2001
+From 9ad8d41a2aa4dcb6b552d77e04f9ce4dc26e999a Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Wed, 15 Jun 2022 13:33:10 +0000
-Subject: [PATCH 17/20] codecs: nvv4l2: reorder capture buffer queueing
+Subject: [PATCH 17/39] codecs: nvv4l2: reorder capture buffer queueing
Move capture buffer queueing after capture plane stream on.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0018-codecs-nvv4l2-align-encoder-plane-width-to-64B.patch b/packages/multimedia/ffmpeg/patches/L4T/0018-codecs-nvv4l2-align-encoder-plane-width-to-64B.patch
index 92a5a7ffe63..cd1074dbbec 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0018-codecs-nvv4l2-align-encoder-plane-width-to-64B.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0018-codecs-nvv4l2-align-encoder-plane-width-to-64B.patch
@@ -1,7 +1,7 @@
-From 7b67a0996bb80c38a923b215566c67ffc130d161 Mon Sep 17 00:00:00 2001
+From ef1bcd73fa1e37982dfc24f2319e83d5932848a8 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Tue, 28 Jun 2022 01:37:59 +0000
-Subject: [PATCH 18/20] codecs: nvv4l2: align encoder plane width to 64B
+Subject: [PATCH 18/39] codecs: nvv4l2: align encoder plane width to 64B
Transformations of Block linear formats to linear Pitch formats are done in HW.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0019-codecs-nvv4l2-align-enc-plane-width-per-format-plane.patch b/packages/multimedia/ffmpeg/patches/L4T/0019-codecs-nvv4l2-align-enc-plane-width-per-format-plane.patch
index 0c0b932f5de..46138b630a0 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0019-codecs-nvv4l2-align-enc-plane-width-per-format-plane.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0019-codecs-nvv4l2-align-enc-plane-width-per-format-plane.patch
@@ -1,7 +1,7 @@
-From b0aabaeebd73e4968654f384f44ce8a4d608ae8d Mon Sep 17 00:00:00 2001
+From c5751e2bb1faeb0fd8e4442461bbbcd9448c3960 Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Wed, 29 Jun 2022 06:38:26 +0000
-Subject: [PATCH 19/20] codecs: nvv4l2: align enc plane width per format/plane
+Subject: [PATCH 19/39] codecs: nvv4l2: align enc plane width per format/plane
Take two on creating a heuristic of the needed alignment.
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0020-codecs-nvv4l2-fix-memleak.patch b/packages/multimedia/ffmpeg/patches/L4T/0020-codecs-nvv4l2-fix-memleak.patch
index 6dc63e2f02b..3d1bc7b56b0 100644
--- a/packages/multimedia/ffmpeg/patches/L4T/0020-codecs-nvv4l2-fix-memleak.patch
+++ b/packages/multimedia/ffmpeg/patches/L4T/0020-codecs-nvv4l2-fix-memleak.patch
@@ -1,7 +1,7 @@
-From deac819ac20d2ccd1664c95e4d91c20a35d67cc5 Mon Sep 17 00:00:00 2001
+From 1fe17b61d4221fed766069a7742a7d09eaabedbf Mon Sep 17 00:00:00 2001
From: CTCaer
Date: Wed, 3 Aug 2022 22:04:22 +0000
-Subject: [PATCH 20/20] codecs: nvv4l2: fix memleak
+Subject: [PATCH 20/39] codecs: nvv4l2: fix memleak
Fixes #2
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0021-codecs-nvv4l2-fix-use-after-free.patch b/packages/multimedia/ffmpeg/patches/L4T/0021-codecs-nvv4l2-fix-use-after-free.patch
new file mode 100644
index 00000000000..9473de17416
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0021-codecs-nvv4l2-fix-use-after-free.patch
@@ -0,0 +1,39 @@
+From 24b397a75e4a737c845b91771274ad1104edd54f Mon Sep 17 00:00:00 2001
+From: CTCaer
+Date: Wed, 28 Dec 2022 14:22:13 +0000
+Subject: [PATCH 21/39] codecs: nvv4l2: fix use after free
+
+---
+ libavcodec/nvv4l2_enc.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_enc.c b/libavcodec/nvv4l2_enc.c
+index 3af728aade..dc09236e0a 100644
+--- a/libavcodec/nvv4l2_enc.c
++++ b/libavcodec/nvv4l2_enc.c
+@@ -795,6 +795,13 @@ int nvv4l2_encoder_close(AVCodecContext *avctx, nvv4l2_ctx_t *ctx)
+ nvv4l2_destroyBuffer(ctx, ctx->cp_buffers[i]);
+ }
+
++ for (uint32_t i = 0; i < ctx->op_num_buffers; i++) {
++ if (ctx->plane_dma_fd[i] != -1) {
++ nvv4l2_unmap_out(ctx, i, ctx->op_buf_type,
++ ctx->op_mem_type, ctx->plane_dma_fd[i]);
++ }
++ }
++
+ /* Request 0 buffers on both planes. */
+ op_num_old_buffers = ctx->op_num_buffers;
+ ret = nvv4l2_req_buffers_on_output_plane(ctx,
+@@ -808,8 +815,6 @@ int nvv4l2_encoder_close(AVCodecContext *avctx, nvv4l2_ctx_t *ctx)
+ /* Unmap and destroy all allocated DMA buffers. */
+ for (uint32_t i = 0; i < op_num_old_buffers; i++) {
+ if (ctx->plane_dma_fd[i] != -1) {
+- nvv4l2_unmap_out(ctx, i, ctx->op_buf_type,
+- ctx->op_mem_type, ctx->plane_dma_fd[i]);
+ ret = NvBufferDestroy(ctx->plane_dma_fd[i]);
+ ctx->plane_dma_fd[i] = -1;
+ if (ret) {
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0021-fix-libreelec-build-issue.patch b/packages/multimedia/ffmpeg/patches/L4T/0021-fix-libreelec-build-issue.patch
deleted file mode 100644
index fef3caf08c2..00000000000
--- a/packages/multimedia/ffmpeg/patches/L4T/0021-fix-libreelec-build-issue.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff -Naur ffmpeg-4.4.1-Nexus-Alpha1-2/configure ffmpeg-4.4.1-Nexus-Alpha1/configure
---- ffmpeg-4.4.1-Nexus-Alpha1-2/configure 2022-10-10 21:51:13.330387005 +0200
-+++ ffmpeg-4.4.1-Nexus-Alpha1/configure 2022-10-10 22:01:51.723150253 +0200
-@@ -3068,8 +3068,8 @@
- qsvvpp_select="qsv"
- vaapi_encode_deps="vaapi"
- v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
--nvv4l2_deps="libv4l2 pthreads linux_videodev2_h"
--nvv4l2_extralibs="-lnvbuf_utils"
-+nvv4l2_deps="pthreads"
-+nvv4l2_extralibs="-lnvbuf_utils -lv4l2"
-
- hwupload_cuda_filter_deps="ffnvcodec"
- scale_npp_filter_deps="ffnvcodec libnpp"
-@@ -6829,10 +6829,7 @@
- check_type "ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h" "CUVIDAV1PICPARAMS"
- fi
-
--enabled nvv4l2 && add_ldflags '-L/usr/lib/aarch64-linux-gnu/tegra' \
-- && check_headers linux/videodev2.h \
-- && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
--
-+enabled nvv4l2 && add_ldflags '-L/usr/lib/aarch64-linux-gnu/tegra'
- enabled amf &&
- check_cpp_condition amf "AMF/core/Version.h" \
- "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400090000"
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0022-codecs-nvv4l2-rename-AVCodec-to-fit-API-renames.patch b/packages/multimedia/ffmpeg/patches/L4T/0022-codecs-nvv4l2-rename-AVCodec-to-fit-API-renames.patch
new file mode 100644
index 00000000000..9b25a1ce790
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0022-codecs-nvv4l2-rename-AVCodec-to-fit-API-renames.patch
@@ -0,0 +1,101 @@
+From b2a7cfdcf77cfd5c3ca864670aa949ddef17cd9a Mon Sep 17 00:00:00 2001
+From: Azkali Manad
+Date: Wed, 25 Jan 2023 02:02:57 +0100
+Subject: [PATCH 22/39] codecs: nvv4l2: rename AVCodec to fit API renames
+
+---
+ libavcodec/nvv4l2_dec.c | 20 ++++++++++----------
+ libavcodec/nvv4l2_enc.c | 20 ++++++++++----------
+ 2 files changed, 20 insertions(+), 20 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index 35784e0704..b56d35cf82 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -29,7 +29,7 @@
+ #include
+ #include
+ #include
+-#include "internal.h"
++#include "codec_internal.h"
+ #include "libavutil/log.h"
+
+ #include "nvv4l2.h"
+@@ -1203,22 +1203,22 @@ nvv4l2dec_decode(AVCodecContext *avctx, void *data, int *got_frame,
+
+ #define NVV4L2_DEC(NAME, ID, BSFS) \
+ NVV4L2_DEC_CLASS(NAME) \
+- AVCodec ff_##NAME##_nvv4l2_decoder = { \
+- .name = #NAME "_nvv4l2", \
+- .long_name = NULL_IF_CONFIG_SMALL(#NAME " NVV4L2 HW decoder for Tegra"), \
+- .type = AVMEDIA_TYPE_VIDEO, \
+- .id = ID, \
++ const FFCodec ff_##NAME##_nvv4l2_decoder = { \
++ .p.name = #NAME "_nvv4l2", \
++ .p.long_name = NULL_IF_CONFIG_SMALL(#NAME " NVV4L2 HW decoder for Tegra"), \
++ .p.type = AVMEDIA_TYPE_VIDEO, \
++ .p.id = ID, \
+ .priv_data_size = sizeof(nvv4l2DecodeContext), \
+ .init = nvv4l2dec_init, \
+ .close = nvv4l2dec_close, \
+ .decode = nvv4l2dec_decode, \
+ .flush = nvv4l2dec_flush, \
+- .priv_class = &nvv4l2_##NAME##_dec_class, \
+- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | \
++ .p.priv_class = &nvv4l2_##NAME##_dec_class, \
++ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | \
+ AV_CODEC_CAP_AVOID_PROBING, \
+ .bsfs = BSFS, \
+- .wrapper_name = "nvv4l2", \
+- .pix_fmts =(const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, \
++ .p.wrapper_name = "nvv4l2", \
++ .p.pix_fmts =(const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, \
+ AV_PIX_FMT_NV12, \
+ AV_PIX_FMT_NONE }, \
+ };
+diff --git a/libavcodec/nvv4l2_enc.c b/libavcodec/nvv4l2_enc.c
+index dc09236e0a..fad54868e3 100644
+--- a/libavcodec/nvv4l2_enc.c
++++ b/libavcodec/nvv4l2_enc.c
+@@ -28,7 +28,7 @@
+ #include
+ #include
+ #include
+-#include "internal.h"
++#include "codec_internal.h"
+ #include "libavutil/imgutils.h"
+ #include "libavutil/log.h"
+ #include "libavutil/opt.h"
+@@ -1455,20 +1455,20 @@ static const AVOption options_hevc[] = {
+
+ #define NVV4L2_ENC(NAME, ID) \
+ NVV4L2_ENC_CLASS(NAME) \
+- AVCodec ff_##NAME##_nvv4l2_encoder = { \
+- .name = #NAME "_nvv4l2" , \
+- .long_name = NULL_IF_CONFIG_SMALL(#NAME " NVV4L2 HW encoder for Tegra"), \
+- .type = AVMEDIA_TYPE_VIDEO, \
+- .id = ID, \
++ const FFCodec ff_##NAME##_nvv4l2_encoder = { \
++ .p.name = #NAME "_nvv4l2" , \
++ .p.long_name = NULL_IF_CONFIG_SMALL(#NAME " NVV4L2 HW encoder for Tegra"), \
++ .p.type = AVMEDIA_TYPE_VIDEO, \
++ .p.id = ID, \
+ .priv_data_size = sizeof(nvv4l2EncodeContext), \
+ .init = nvv4l2enc_init, \
+ .close = nvv4l2enc_close, \
+ .encode2 = nvv4l2enc_encode, \
+- .priv_class = &nvv4l2_##NAME##_enc_class, \
+- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \
++ .p.priv_class = &nvv4l2_##NAME##_enc_class, \
++ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \
+ .defaults = defaults, \
+- .wrapper_name = "nvv4l2", \
+- .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, \
++ .p.wrapper_name = "nvv4l2", \
++ .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, \
+ AV_PIX_FMT_YUV444P, \
+ AV_PIX_FMT_NV12, \
+ AV_PIX_FMT_P010, \
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0023-codecs-nvv4l2-comment-structs-redefined-in-nvv4l2.h.patch b/packages/multimedia/ffmpeg/patches/L4T/0023-codecs-nvv4l2-comment-structs-redefined-in-nvv4l2.h.patch
new file mode 100644
index 00000000000..cd72a81f2d3
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0023-codecs-nvv4l2-comment-structs-redefined-in-nvv4l2.h.patch
@@ -0,0 +1,92 @@
+From 23ccbf1d6a5494c7d79e8df2c74f02358e8df7d4 Mon Sep 17 00:00:00 2001
+From: Azkali Manad
+Date: Wed, 25 Jan 2023 03:08:02 +0100
+Subject: [PATCH 23/39] codecs: nvv4l2: comment structs redefined in nvv4l2.h
+
+---
+ libavcodec/nvv4l2_ext_utils.h | 32 ++++++++++++++++----------------
+ 1 file changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_ext_utils.h b/libavcodec/nvv4l2_ext_utils.h
+index 007306ccc5..04a2ee1c79 100644
+--- a/libavcodec/nvv4l2_ext_utils.h
++++ b/libavcodec/nvv4l2_ext_utils.h
+@@ -178,7 +178,7 @@ enum v4l2_mpeg_video_h265_profile {
+ #define V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY 0x10
+ #define V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD 0x20
+ #define V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE 0x40
+-struct v4l2_ctrl_h264_sps {
++/* struct v4l2_ctrl_h264_sps {
+ __u8 profile_idc;
+ __u8 constraint_set_flags;
+ __u8 level_idc;
+@@ -197,7 +197,7 @@ struct v4l2_ctrl_h264_sps {
+ __u16 pic_width_in_mbs_minus1;
+ __u16 pic_height_in_map_units_minus1;
+ __u8 flags;
+-};
++}; */
+
+ #define V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE 0x0001
+ #define V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT 0x0002
+@@ -207,7 +207,7 @@ struct v4l2_ctrl_h264_sps {
+ #define V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT 0x0020
+ #define V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE 0x0040
+ #define V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT 0x0080
+-struct v4l2_ctrl_h264_pps {
++/* struct v4l2_ctrl_h264_pps {
+ __u8 pic_parameter_set_id;
+ __u8 seq_parameter_set_id;
+ __u8 num_slice_groups_minus1;
+@@ -219,19 +219,19 @@ struct v4l2_ctrl_h264_pps {
+ __s8 chroma_qp_index_offset;
+ __s8 second_chroma_qp_index_offset;
+ __u8 flags;
+-};
++}; */
+
+-struct v4l2_ctrl_h264_scaling_matrix {
++/* struct v4l2_ctrl_h264_scaling_matrix {
+ __u8 scaling_list_4x4[6][16];
+ __u8 scaling_list_8x8[6][64];
+-};
++}; */
+
+-struct v4l2_h264_weight_factors {
++/* struct v4l2_h264_weight_factors {
+ __s8 luma_weight[32];
+ __s8 luma_offset[32];
+ __s8 chroma_weight[32][2];
+ __s8 chroma_offset[32][2];
+-};
++}; */
+
+ struct v4l2_h264_pred_weight_table {
+ __u8 luma_log2_weight_denom;
+@@ -289,15 +289,15 @@ struct v4l2_ctrl_h264_slice_param {
+ If not set, this entry is unused for reference. */
+ #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x01
+ #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x02
+-struct v4l2_h264_dpb_entry {
+- __u32 buf_index; /**< v4l2_buffer index. */
+- __u16 frame_num;
+- __u16 pic_num;
++/* struct v4l2_h264_dpb_entry { */
++/* __u32 buf_index; /**< v4l2_buffer index. */
++/* __u16 frame_num;
++ __u16 pic_num; */
+ /** @note `v4l2_buffer.field` specifies this field. */
+- __s32 top_field_order_cnt;
+- __s32 bottom_field_order_cnt;
+- __u8 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */
+-};
++/* __s32 top_field_order_cnt;
++ __s32 bottom_field_order_cnt; */
++/* __u8 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */
++/* }; */
+
+ struct v4l2_ctrl_h264_decode_param {
+ __u32 num_slices;
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0024-codecs-nvv4l2-More-API-related-changes.patch b/packages/multimedia/ffmpeg/patches/L4T/0024-codecs-nvv4l2-More-API-related-changes.patch
new file mode 100644
index 00000000000..102f645a085
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0024-codecs-nvv4l2-More-API-related-changes.patch
@@ -0,0 +1,68 @@
+From b2f78477cf1cca514a91a4a5ecd6f93fee289f2a Mon Sep 17 00:00:00 2001
+From: Azkali Manad
+Date: Wed, 25 Jan 2023 03:32:12 +0100
+Subject: [PATCH 24/39] codecs: nvv4l2: More API related changes
+
+ decoder: add internal.h header needed for ff_get_buffer
+ encoder: Rename AVCodecDefault to FFCodecDefault
+ *: use callback defines for encode/decode struct members
+---
+ libavcodec/nvv4l2_dec.c | 3 ++-
+ libavcodec/nvv4l2_enc.c | 6 +++---
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index b56d35cf82..26e7363823 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -30,6 +30,7 @@
+ #include
+ #include
+ #include "codec_internal.h"
++#include "internal.h"
+ #include "libavutil/log.h"
+
+ #include "nvv4l2.h"
+@@ -1211,7 +1212,7 @@ nvv4l2dec_decode(AVCodecContext *avctx, void *data, int *got_frame,
+ .priv_data_size = sizeof(nvv4l2DecodeContext), \
+ .init = nvv4l2dec_init, \
+ .close = nvv4l2dec_close, \
+- .decode = nvv4l2dec_decode, \
++ FF_CODEC_DECODE_CB(nvv4l2dec_decode) \
+ .flush = nvv4l2dec_flush, \
+ .p.priv_class = &nvv4l2_##NAME##_dec_class, \
+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | \
+diff --git a/libavcodec/nvv4l2_enc.c b/libavcodec/nvv4l2_enc.c
+index fad54868e3..7f1aad1b32 100644
+--- a/libavcodec/nvv4l2_enc.c
++++ b/libavcodec/nvv4l2_enc.c
+@@ -1265,7 +1265,7 @@ nvv4l2enc_encode(AVCodecContext *avctx, AVPacket *pkt,
+ if (nvv4l2_encoder_get_packet(avctx, ctx, &packet))
+ return 0;
+
+- ff_alloc_packet2(avctx, pkt, packet.payload_size, packet.payload_size);
++ ff_alloc_packet(avctx, pkt, packet.payload_size, packet.payload_size);
+
+ memcpy(pkt->data, packet.payload, packet.payload_size);
+ pkt->dts = pkt->pts = packet.pts;
+@@ -1286,7 +1286,7 @@ static av_cold int nvv4l2enc_close(AVCodecContext *avctx)
+ return 0;
+ }
+
+-static const AVCodecDefault defaults[] = {
++static const FFCodecDefault defaults[] = {
+ { "b", "5M" },
+ { "qmin", "-1" },
+ { "qmax", "-1" },
+@@ -1463,7 +1463,7 @@ static const AVOption options_hevc[] = {
+ .priv_data_size = sizeof(nvv4l2EncodeContext), \
+ .init = nvv4l2enc_init, \
+ .close = nvv4l2enc_close, \
+- .encode2 = nvv4l2enc_encode, \
++ FF_CODEC_ENCODE_CB(nvv4l2enc_encode), \
+ .p.priv_class = &nvv4l2_##NAME##_enc_class, \
+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \
+ .defaults = defaults, \
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0025-codecs-nvv4l2-add-encode.h-header-needed-for-ff_allo.patch b/packages/multimedia/ffmpeg/patches/L4T/0025-codecs-nvv4l2-add-encode.h-header-needed-for-ff_allo.patch
new file mode 100644
index 00000000000..44645195816
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0025-codecs-nvv4l2-add-encode.h-header-needed-for-ff_allo.patch
@@ -0,0 +1,25 @@
+From 157e6cffa1464b66809d32b5d511f62882068dcd Mon Sep 17 00:00:00 2001
+From: Azkali Manad
+Date: Wed, 25 Jan 2023 03:42:59 +0100
+Subject: [PATCH 25/39] codecs: nvv4l2: add encode.h header needed for
+ ff_alloc_packet
+
+---
+ libavcodec/nvv4l2_enc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libavcodec/nvv4l2_enc.c b/libavcodec/nvv4l2_enc.c
+index 7f1aad1b32..6c3d276f31 100644
+--- a/libavcodec/nvv4l2_enc.c
++++ b/libavcodec/nvv4l2_enc.c
+@@ -29,6 +29,7 @@
+ #include
+ #include
+ #include "codec_internal.h"
++#include "encode.h"
+ #include "libavutil/imgutils.h"
+ #include "libavutil/log.h"
+ #include "libavutil/opt.h"
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0026-codecs-nvv4l2-fix-missing-comma-in-FFCodec-struct.patch b/packages/multimedia/ffmpeg/patches/L4T/0026-codecs-nvv4l2-fix-missing-comma-in-FFCodec-struct.patch
new file mode 100644
index 00000000000..bc431432296
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0026-codecs-nvv4l2-fix-missing-comma-in-FFCodec-struct.patch
@@ -0,0 +1,25 @@
+From c1447a426afa49ed23384f2b135ea9748c98d568 Mon Sep 17 00:00:00 2001
+From: Azkali Manad
+Date: Wed, 25 Jan 2023 03:45:50 +0100
+Subject: [PATCH 26/39] codecs: nvv4l2: fix missing comma in FFCodec struct
+
+---
+ libavcodec/nvv4l2_dec.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index 26e7363823..fe54883522 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -1212,7 +1212,7 @@ nvv4l2dec_decode(AVCodecContext *avctx, void *data, int *got_frame,
+ .priv_data_size = sizeof(nvv4l2DecodeContext), \
+ .init = nvv4l2dec_init, \
+ .close = nvv4l2dec_close, \
+- FF_CODEC_DECODE_CB(nvv4l2dec_decode) \
++ FF_CODEC_DECODE_CB(nvv4l2dec_decode), \
+ .flush = nvv4l2dec_flush, \
+ .p.priv_class = &nvv4l2_##NAME##_dec_class, \
+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | \
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0027-codecs-nvv4l2-remove-second-size-argument-as-it-is-u.patch b/packages/multimedia/ffmpeg/patches/L4T/0027-codecs-nvv4l2-remove-second-size-argument-as-it-is-u.patch
new file mode 100644
index 00000000000..270b5a6fa51
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0027-codecs-nvv4l2-remove-second-size-argument-as-it-is-u.patch
@@ -0,0 +1,26 @@
+From cd758dad831c7f7f115b0fcc8646e241d338c800 Mon Sep 17 00:00:00 2001
+From: Azkali Manad
+Date: Wed, 25 Jan 2023 03:52:47 +0100
+Subject: [PATCH 27/39] codecs: nvv4l2: remove second size argument as it is
+ unneeded
+
+---
+ libavcodec/nvv4l2_enc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavcodec/nvv4l2_enc.c b/libavcodec/nvv4l2_enc.c
+index 6c3d276f31..39a179b255 100644
+--- a/libavcodec/nvv4l2_enc.c
++++ b/libavcodec/nvv4l2_enc.c
+@@ -1266,7 +1266,7 @@ nvv4l2enc_encode(AVCodecContext *avctx, AVPacket *pkt,
+ if (nvv4l2_encoder_get_packet(avctx, ctx, &packet))
+ return 0;
+
+- ff_alloc_packet(avctx, pkt, packet.payload_size, packet.payload_size);
++ ff_alloc_packet(avctx, pkt, packet.payload_size);
+
+ memcpy(pkt->data, packet.payload, packet.payload_size);
+ pkt->dts = pkt->pts = packet.pts;
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0028-codecs-nvv4l2-undo-struct-commenting-due-to-OpenBuil.patch b/packages/multimedia/ffmpeg/patches/L4T/0028-codecs-nvv4l2-undo-struct-commenting-due-to-OpenBuil.patch
new file mode 100644
index 00000000000..f09f0a26395
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0028-codecs-nvv4l2-undo-struct-commenting-due-to-OpenBuil.patch
@@ -0,0 +1,56 @@
+From 1340217cbcc40418337225ca12d1d0f5dd82e682 Mon Sep 17 00:00:00 2001
+From: Azkali
+Date: Thu, 26 Jan 2023 03:44:07 +0100
+Subject: [PATCH 28/39] codecs: nvv4l2: undo struct commenting due to
+ OpenBuildServic weirdness
+
+---
+ libavcodec/nvv4l2_ext_utils.h | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_ext_utils.h b/libavcodec/nvv4l2_ext_utils.h
+index 04a2ee1c79..4fb66583de 100644
+--- a/libavcodec/nvv4l2_ext_utils.h
++++ b/libavcodec/nvv4l2_ext_utils.h
+@@ -226,12 +226,12 @@ enum v4l2_mpeg_video_h265_profile {
+ __u8 scaling_list_8x8[6][64];
+ }; */
+
+-/* struct v4l2_h264_weight_factors {
++struct v4l2_h264_weight_factors {
+ __s8 luma_weight[32];
+ __s8 luma_offset[32];
+ __s8 chroma_weight[32][2];
+ __s8 chroma_offset[32][2];
+-}; */
++};
+
+ struct v4l2_h264_pred_weight_table {
+ __u8 luma_log2_weight_denom;
+@@ -289,15 +289,15 @@ struct v4l2_ctrl_h264_slice_param {
+ If not set, this entry is unused for reference. */
+ #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x01
+ #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x02
+-/* struct v4l2_h264_dpb_entry { */
+-/* __u32 buf_index; /**< v4l2_buffer index. */
+-/* __u16 frame_num;
+- __u16 pic_num; */
++struct v4l2_h264_dpb_entry {
++ __u32 buf_index; /**< v4l2_buffer index. */
++ __u16 frame_num;
++ __u16 pic_num;
+ /** @note `v4l2_buffer.field` specifies this field. */
+-/* __s32 top_field_order_cnt;
+- __s32 bottom_field_order_cnt; */
+-/* __u8 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */
+-/* }; */
++ __s32 top_field_order_cnt;
++ __s32 bottom_field_order_cnt;
++ __u8 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */
++};
+
+ struct v4l2_ctrl_h264_decode_param {
+ __u32 num_slices;
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0029-fftools-improve-nvv4l2-enforcing-Now-non-supported-p.patch b/packages/multimedia/ffmpeg/patches/L4T/0029-fftools-improve-nvv4l2-enforcing-Now-non-supported-p.patch
new file mode 100644
index 00000000000..f1f17ba94ab
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0029-fftools-improve-nvv4l2-enforcing-Now-non-supported-p.patch
@@ -0,0 +1,222 @@
+From a3ee3863be6268abaf331af6a12892feeb8797c6 Mon Sep 17 00:00:00 2001
+From: CTCaer
+Date: Sun, 2 Jul 2023 03:18:28 +0000
+Subject: [PATCH 29/39] fftools: improve nvv4l2 enforcing Now non-supported
+ pixel formats are properly handled. Additionally, all edge cases are handled
+ even if the codec is forced by user.
+
+---
+ fftools/ffmpeg_demux.c | 92 ++++++++++++++++++++++++++++++------------
+ fftools/ffplay.c | 74 +++++++++++++++++++++++++--------
+ 2 files changed, 124 insertions(+), 42 deletions(-)
+
+diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
+index 938ec09e3d..3b58c18f3d 100644
+--- a/fftools/ffmpeg_demux.c
++++ b/fftools/ffmpeg_demux.c
+@@ -500,40 +500,80 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
+
+ {
+ char *codec_name = NULL;
++#if CONFIG_NVV4L2
++ int nvv4l2_pix_fmt_ok;
++#endif
+
+ MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
+- if (codec_name) {
+- const AVCodec *codec = find_codec_or_die(NULL, codec_name, st->codecpar->codec_type, 0);
+- st->codecpar->codec_id = codec->id;
+- if (recast_media && st->codecpar->codec_type != codec->type)
+- st->codecpar->codec_type = codec->type;
+- return codec;
+- } else {
+- if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+- hwaccel_id == HWACCEL_GENERIC &&
+- hwaccel_device_type != AV_HWDEVICE_TYPE_NONE) {
+- const AVCodec *c;
+- void *i = NULL;
+-
+- while ((c = av_codec_iterate(&i))) {
+- const AVCodecHWConfig *config;
+
+- if (c->id != st->codecpar->codec_id ||
+- !av_codec_is_decoder(c))
+- continue;
++#if CONFIG_NVV4L2
++ nvv4l2_pix_fmt_ok = st->codecpar->format == AV_PIX_FMT_NONE ||
++ st->codecpar->format == AV_PIX_FMT_NV12 ||
++ st->codecpar->format == AV_PIX_FMT_YUV420P;
+
+- for (int j = 0; config = avcodec_get_hw_config(c, j); j++) {
+- if (config->device_type == hwaccel_device_type) {
+- av_log(NULL, AV_LOG_VERBOSE, "Selecting decoder '%s' because of requested hwaccel method %s\n",
+- c->name, av_hwdevice_get_type_name(hwaccel_device_type));
+- return c;
+- }
+- }
+- }
++ /* Force software decoding if codec name not defined and pixel format not supported. */
++ if (!codec_name && !nvv4l2_pix_fmt_ok) {
++ switch (st->codecpar->codec_id) {
++ case AV_CODEC_ID_H264:
++ codec_name = (char *)"h264";
++ break;
++ case AV_CODEC_ID_HEVC:
++ codec_name = (char *)"hevc";
++ break;
++ case AV_CODEC_ID_MPEG2VIDEO:
++ codec_name = (char *)"mpeg2video";
++ break;
++ case AV_CODEC_ID_MPEG4:
++ codec_name = (char *)"mpeg4";
++ break;
++ case AV_CODEC_ID_VP8:
++ codec_name = (char *)"vp8";
++ break;
++ case AV_CODEC_ID_VP9:
++ codec_name = (char *)"vp9";
++ break;
+ }
++ }
++#endif
+
++ if (!codec_name)
+ return avcodec_find_decoder(st->codecpar->codec_id);
++
++#if CONFIG_NVV4L2
++ if (nvv4l2_pix_fmt_ok) {
++ /* Force hardware decoding if pixel format supported. */
++ if (strcmp(codec_name, "h264") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "hevc") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "mpeg2video") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "mpeg4") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "vp8") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "vp9") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ } else {
++ /* Force software decoding if pixel format not supported. */
++ if (strcmp(codec_name, "h264_nvv4l2") == 0)
++ codec_name = (char *)"h264";
++ else if (strcmp(codec_name, "hevc_nvv4l2") == 0)
++ codec_name = (char *)"hevc";
++ else if (strcmp(codec_name, "mpeg2video_nvv4l2") == 0)
++ codec_name = (char *)"mpeg2video";
++ else if (strcmp(codec_name, "mpeg4_nvv4l2") == 0)
++ codec_name = (char *)"mpeg4";
++ else if (strcmp(codec_name, "vp8_nvv4l2") == 0)
++ codec_name = (char *)"vp8";
++ else if (strcmp(codec_name, "vp9_nvv4l2") == 0)
++ codec_name = (char *)"vp9";
+ }
++#endif
++
++ const AVCodec *codec = find_codec_or_die(codec_name, st->codecpar->codec_type, 0);
++ st->codecpar->codec_id = codec->id;
++ return codec;
+ }
+
+ static int guess_input_channel_layout(InputStream *ist)
+diff --git a/fftools/ffplay.c b/fftools/ffplay.c
+index 86f8425a15..a02f2a06a7 100644
+--- a/fftools/ffplay.c
++++ b/fftools/ffplay.c
+@@ -2570,6 +2570,9 @@ static int stream_component_open(VideoState *is, int stream_index)
+ AVChannelLayout ch_layout = { 0 };
+ int ret = 0;
+ int stream_lowres = lowres;
++#if CONFIG_NVV4L2
++ int nvv4l2_pix_fmt_ok;
++#endif
+
+ if (stream_index < 0 || stream_index >= ic->nb_streams)
+ return -1;
+@@ -2593,26 +2596,65 @@ static int stream_component_open(VideoState *is, int stream_index)
+
+ #if CONFIG_NVV4L2
+ /* Reset requested decoder in order to enforce NVV4L2 if possible. */
++ nvv4l2_pix_fmt_ok = avctx->pix_fmt == AV_PIX_FMT_NONE ||
++ avctx->pix_fmt == AV_PIX_FMT_NV12 ||
++ avctx->pix_fmt == AV_PIX_FMT_YUV420P;
++
+ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && forced_codec_name) {
+- if (strcmp(forced_codec_name, "h264") == 0)
+- forced_codec_name = NULL;
+- else if (strcmp(forced_codec_name, "hevc") == 0)
+- forced_codec_name = NULL;
+- else if (strcmp(forced_codec_name, "mpeg2video") == 0)
+- forced_codec_name = NULL;
+- else if (strcmp(forced_codec_name, "mpeg4") == 0)
+- forced_codec_name = NULL;
+- else if (strcmp(forced_codec_name, "vp8") == 0)
+- forced_codec_name = NULL;
+- else if (strcmp(forced_codec_name, "vp9") == 0 &&
+- avctx->pix_fmt != AV_PIX_FMT_YUV420P10) {
+- forced_codec_name = NULL;
++ if (nvv4l2_pix_fmt_ok) {
++ /* Force hardware decoding if pixel format supported. */
++ if (strcmp(forced_codec_name, "h264") == 0)
++ forced_codec_name = NULL;
++ else if (strcmp(forced_codec_name, "hevc") == 0)
++ forced_codec_name = NULL;
++ else if (strcmp(forced_codec_name, "mpeg2video") == 0)
++ forced_codec_name = NULL;
++ else if (strcmp(forced_codec_name, "mpeg4") == 0)
++ forced_codec_name = NULL;
++ else if (strcmp(forced_codec_name, "vp8") == 0)
++ forced_codec_name = NULL;
++ else if (strcmp(forced_codec_name, "vp9") == 0)
++ forced_codec_name = NULL;
++ } else {
++ /* Force software decoding if pixel format not supported. */
++ if (strcmp(forced_codec_name, "h264_nvv4l2") == 0)
++ forced_codec_name = (char *)"h264";
++ else if (strcmp(forced_codec_name, "hevc_nvv4l2") == 0)
++ forced_codec_name = (char *)"hevc";
++ else if (strcmp(forced_codec_name, "mpeg2video_nvv4l2") == 0)
++ forced_codec_name = (char *)"mpeg2video";
++ else if (strcmp(forced_codec_name, "mpeg4_nvv4l2") == 0)
++ forced_codec_name = (char *)"mpeg4";
++ else if (strcmp(forced_codec_name, "vp8_nvv4l2") == 0)
++ forced_codec_name = (char *)"vp8";
++ else if (strcmp(forced_codec_name, "vp9_nvv4l2") == 0)
++ forced_codec_name = (char *)"vp9";
+ }
+ }
+
+- /* NVV4L2 does not support VP9 with YUV420P10. */
+- if (!forced_codec_name && avctx->pix_fmt == AV_PIX_FMT_YUV420P10)
+- forced_codec_name = "vp9";
++ /* Force software decoding if codec name not defined and pixel format not supported. */
++ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !forced_codec_name && !nvv4l2_pix_fmt_ok) {
++ switch (avctx->codec_id) {
++ case AV_CODEC_ID_H264:
++ forced_codec_name = (char *)"h264";
++ break;
++ case AV_CODEC_ID_HEVC:
++ forced_codec_name = (char *)"hevc";
++ break;
++ case AV_CODEC_ID_MPEG2VIDEO:
++ forced_codec_name = (char *)"mpeg2video";
++ break;
++ case AV_CODEC_ID_MPEG4:
++ forced_codec_name = (char *)"mpeg4";
++ break;
++ case AV_CODEC_ID_VP8:
++ forced_codec_name = (char *)"vp8";
++ break;
++ case AV_CODEC_ID_VP9:
++ forced_codec_name = (char *)"vp9";
++ break;
++ }
++ }
+ #endif
+
+ if (forced_codec_name)
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0030-nvv4l2-add-yuv420p10-support.patch b/packages/multimedia/ffmpeg/patches/L4T/0030-nvv4l2-add-yuv420p10-support.patch
new file mode 100644
index 00000000000..2e4ac7475fd
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0030-nvv4l2-add-yuv420p10-support.patch
@@ -0,0 +1,41 @@
+From 8014b28095f1b3d2559387b7b8aca93b034561cf Mon Sep 17 00:00:00 2001
+From: CTCaer
+Date: Sun, 2 Jul 2023 03:23:34 +0000
+Subject: [PATCH 30/39] nvv4l2: add yuv420p10 support NVENC supports yuv420p10
+ as p010.
+
+---
+ libavcodec/nvv4l2_enc.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/libavcodec/nvv4l2_enc.c b/libavcodec/nvv4l2_enc.c
+index 39a179b255..b979c93051 100644
+--- a/libavcodec/nvv4l2_enc.c
++++ b/libavcodec/nvv4l2_enc.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2021-2022, CTCaer
++ * Copyright (c) 2021-2023, CTCaer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -1130,6 +1130,8 @@ static int nvv4l2enc_init(AVCodecContext *avctx)
+ case AV_PIX_FMT_NV12:
+ pix_fmt = V4L2_PIX_FMT_NV12M;
+ break;
++ case AV_PIX_FMT_YUV420P10:
++ avctx->pix_fmt = AV_PIX_FMT_P010;
+ case AV_PIX_FMT_P010:
+ pix_fmt = V4L2_PIX_FMT_P010M;
+ break;
+@@ -1473,6 +1475,7 @@ static const AVOption options_hevc[] = {
+ AV_PIX_FMT_YUV444P, \
+ AV_PIX_FMT_NV12, \
+ AV_PIX_FMT_P010, \
++ AV_PIX_FMT_YUV420P10, \
+ AV_PIX_FMT_NONE }, \
+ };
+
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0031-nvv4l2-handle-unsupported-pixel-formats-NVDEC-only-s.patch b/packages/multimedia/ffmpeg/patches/L4T/0031-nvv4l2-handle-unsupported-pixel-formats-NVDEC-only-s.patch
new file mode 100644
index 00000000000..1bded6acb82
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0031-nvv4l2-handle-unsupported-pixel-formats-NVDEC-only-s.patch
@@ -0,0 +1,127 @@
+From ded4a192fa894768db5d1ab0e90256f28a87b834 Mon Sep 17 00:00:00 2001
+From: CTCaer
+Date: Sun, 2 Jul 2023 03:49:48 +0000
+Subject: [PATCH 31/39] nvv4l2: handle unsupported pixel formats NVDEC only
+ supports YUV420 and NV12 formats.
+
+If a consumer starting nvv4l2 decoder with unsupported pixel format force
+software decoding.
+
+If consumer does not probe info of the media, the pixel format will be empty.
+If the actual pixel format is not supported it will result in no image.
+Since the normal procedure of using libavcodec is to just open a codec via id,
+without passing extra info or data, except if on purpose, there's no way to
+mitigate that issue in a non-invasive way.
+---
+ libavcodec/avcodec.c | 2 --
+ libavcodec/nvv4l2_dec.c | 58 ++++++++++++++++++++++++++++++++++++++---
+ 2 files changed, 54 insertions(+), 6 deletions(-)
+
+diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
+index fb1362290f..773d0457b3 100644
+--- a/libavcodec/avcodec.c
++++ b/libavcodec/avcodec.c
+@@ -355,8 +355,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
+ goto free_and_end;
+ }
+ }
+- if (codec->priv_class)
+- av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
+
+ end:
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index fe54883522..0b91cf0eba 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2021-2022, CTCaer
++ * Copyright (c) 2021-2023, CTCaer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -31,10 +31,18 @@
+ #include
+ #include "codec_internal.h"
+ #include "internal.h"
++#include "decode.h"
++#include "thread.h"
+ #include "libavutil/log.h"
++#include "libavutil/pixdesc.h"
++#include "libavutil/opt.h"
+
+ #include "nvv4l2.h"
+
++extern AVCodec ff_h264_decoder;
++extern AVCodec ff_hevc_decoder;
++extern AVCodec ff_vp9_decoder;
++
+ /*
+ ** Output plane format support:
+ ** S264 (H264 Encoded Slice bitstream)
+@@ -978,6 +986,48 @@ static NvCodingType map_avcodec_id(enum AVCodecID id)
+ return NvVideoCodec_UNDEFINED;
+ }
+
++static int nvv4l2dec_codec_fallback(AVCodecContext *avctx)
++{
++ av_log(avctx, AV_LOG_WARNING, "Falling back to software decoding.\n");
++
++ switch (avctx->codec_id) {
++ case AV_CODEC_ID_H264:
++ avctx->codec = &ff_h264_decoder;
++ break;
++ case AV_CODEC_ID_HEVC:
++ avctx->codec = &ff_hevc_decoder;
++ break;
++ case AV_CODEC_ID_VP9:
++ avctx->codec = &ff_vp9_decoder;
++ break;
++ default:
++ av_log(avctx, AV_LOG_ERROR, "Unsupported codec fallback!\n");
++ return AVERROR_BUG;
++ }
++
++ av_opt_free(avctx->priv_data);
++
++ if (avctx->codec->priv_data_size > 0) {
++ avctx->priv_data = av_mallocz(avctx->codec->priv_data_size);
++ if (!avctx->priv_data)
++ return AVERROR(ENOMEM);
++ }
++
++ if (HAVE_THREADS
++ && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {
++ ff_thread_init(avctx);
++ }
++ if (!HAVE_THREADS && !(avctx->codec->caps_internal & FF_CODEC_CAP_AUTO_THREADS))
++ avctx->thread_count = 1;
++
++ if (avctx->codec->priv_class) {
++ *(const AVClass **)avctx->priv_data = avctx->codec->priv_class;
++ av_opt_set_defaults(avctx->priv_data);
++ }
++
++ return avctx->codec->init(avctx);
++}
++
+ static int nvv4l2dec_init(AVCodecContext *avctx)
+ {
+ nvv4l2DecodeContext *nvv4l2_ctx = avctx->priv_data;
+@@ -1000,9 +1050,9 @@ static int nvv4l2dec_init(AVCodecContext *avctx)
+ pix_fmt = V4L2_PIX_FMT_NV12M;
+ break;
+ default:
+- av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format %d!\n",
+- avctx->pix_fmt);
+- return AVERROR_BUG;
++ av_log(avctx, AV_LOG_WARNING, "Unsupported pixel format %s!\n",
++ av_get_pix_fmt_name(avctx->pix_fmt));
++ return nvv4l2dec_codec_fallback(avctx);
+ }
+
+ nvv4l2_ctx->ctx = nvv4l2_create_decoder(avctx, nv_codec_type, pix_fmt);
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0032-nvv4l2-allow-10-bit-HEVC-The-only-hw-support-for-10-.patch b/packages/multimedia/ffmpeg/patches/L4T/0032-nvv4l2-allow-10-bit-HEVC-The-only-hw-support-for-10-.patch
new file mode 100644
index 00000000000..a1950c1ee19
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0032-nvv4l2-allow-10-bit-HEVC-The-only-hw-support-for-10-.patch
@@ -0,0 +1,92 @@
+From 9e860a0aeab0b955e627de763e9494457942222d Mon Sep 17 00:00:00 2001
+From: CTCaer
+Date: Mon, 3 Jul 2023 14:19:46 +0000
+Subject: [PATCH 32/39] nvv4l2: allow 10-bit HEVC The only hw support for
+ 10-bit on NVDEC 2nd/3rd gen is on HEVC. H264 does not support it on main
+ spec, so as per previous changes it fallbacks to software decoding. VP8 codec
+ does not support it at all. The only out of spec non-support on hw decoding
+ is on VP9.
+
+---
+ fftools/ffmpeg_demux.c | 4 ++++
+ fftools/ffplay.c | 4 ++++
+ libavcodec/nvv4l2_dec.c | 9 ++++++++-
+ libavcodec/nvv4l2_ext_utils.h | 6 ++++++
+ 4 files changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
+index 3b58c18f3d..f791c3a898 100644
+--- a/fftools/ffmpeg_demux.c
++++ b/fftools/ffmpeg_demux.c
+@@ -510,6 +510,10 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
+ nvv4l2_pix_fmt_ok = st->codecpar->format == AV_PIX_FMT_NONE ||
+ st->codecpar->format == AV_PIX_FMT_NV12 ||
+ st->codecpar->format == AV_PIX_FMT_YUV420P;
++ if (st->codecpar->codec_id == AV_CODEC_ID_HEVC)
++ nvv4l2_pix_fmt_ok = st->codecpar->format == AV_PIX_FMT_YUV420P10LE ||
++ st->codecpar->format == AV_PIX_FMT_P010 ||
++ nvv4l2_pix_fmt_ok;
+
+ /* Force software decoding if codec name not defined and pixel format not supported. */
+ if (!codec_name && !nvv4l2_pix_fmt_ok) {
+diff --git a/fftools/ffplay.c b/fftools/ffplay.c
+index a02f2a06a7..bbd5761115 100644
+--- a/fftools/ffplay.c
++++ b/fftools/ffplay.c
+@@ -2599,6 +2599,10 @@ static int stream_component_open(VideoState *is, int stream_index)
+ nvv4l2_pix_fmt_ok = avctx->pix_fmt == AV_PIX_FMT_NONE ||
+ avctx->pix_fmt == AV_PIX_FMT_NV12 ||
+ avctx->pix_fmt == AV_PIX_FMT_YUV420P;
++ if (avctx->codec_id == AV_CODEC_ID_HEVC)
++ nvv4l2_pix_fmt_ok = avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE ||
++ avctx->pix_fmt == AV_PIX_FMT_P010 ||
++ nvv4l2_pix_fmt_ok;
+
+ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && forced_codec_name) {
+ if (nvv4l2_pix_fmt_ok) {
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index 0b91cf0eba..79116ec858 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -1042,13 +1042,20 @@ static int nvv4l2dec_init(AVCodecContext *avctx)
+
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_NONE:
+- avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ case AV_PIX_FMT_YUV420P:
++ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ pix_fmt = V4L2_PIX_FMT_YUV420M;
+ break;
+ case AV_PIX_FMT_NV12:
+ pix_fmt = V4L2_PIX_FMT_NV12M;
+ break;
++ case AV_PIX_FMT_YUV420P10LE:
++ case AV_PIX_FMT_P010:
++ if (avctx->codec_id == AV_CODEC_ID_HEVC) {
++ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
++ pix_fmt = V4L2_PIX_FMT_YUV420M;
++ break;
++ }
+ default:
+ av_log(avctx, AV_LOG_WARNING, "Unsupported pixel format %s!\n",
+ av_get_pix_fmt_name(avctx->pix_fmt));
+diff --git a/libavcodec/nvv4l2_ext_utils.h b/libavcodec/nvv4l2_ext_utils.h
+index 4fb66583de..142b429336 100644
+--- a/libavcodec/nvv4l2_ext_utils.h
++++ b/libavcodec/nvv4l2_ext_utils.h
+@@ -2144,6 +2144,12 @@ typedef enum
+ NvBufferColorFormat_ARGB32 = 18, /* BSP 32.5.0 and up: 19 */
+ /** BT.601 colorspace - Y/CbCr 4:2:0 10-bit multi-planar. */
+ NvBufferColorFormat_NV12_10LE = 19, /* BSP 32.5.0 and up: 20 */
++ /** BT.709 colorspace - Y/CbCr 4:2:0 10-bit multi-planar. */
++ NvBufferColorFormat_NV12_10LE_709 = 20, /* BSP 32.5.0 and up: 21 */
++ /** BT.709_ER colorspace - Y/CbCr 4:2:0 10-bit multi-planar. */
++ NvBufferColorFormat_NV12_10LE_709_ER = 21, /* BSP 32.5.0 and up: 22 */
++ /** BT.2020 colorspace - Y/CbCr 4:2:0 10-bit multi-planar. */
++ NvBufferColorFormat_NV12_10LE_2020 = 22, /* BSP 32.5.0 and up: 23 */
+ /** BT.709 colorspace - Y/CbCr 4:2:0 multi-planar. */
+ NvBufferColorFormat_NV12_709 = 29, /* BSP 32.5.0 and up: 30 */
+ /** BT.709 colorspace - Y/CbCr ER 4:2:0 multi-planar. */
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0033-codecs-nvv4l2-more-rename-AVCodec-to-fit-API-renames.patch b/packages/multimedia/ffmpeg/patches/L4T/0033-codecs-nvv4l2-more-rename-AVCodec-to-fit-API-renames.patch
new file mode 100644
index 00000000000..7bc820b7160
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0033-codecs-nvv4l2-more-rename-AVCodec-to-fit-API-renames.patch
@@ -0,0 +1,29 @@
+From b4c1473d7a0db6efb31e5d5f5c7b483736ac593a Mon Sep 17 00:00:00 2001
+From: theofficialgman <28281419+theofficialgman@users.noreply.github.com>
+Date: Thu, 18 Jan 2024 17:48:52 -0500
+Subject: [PATCH 33/39] codecs: nvv4l2: more rename AVCodec to fit API renames
+
+---
+ libavcodec/nvv4l2_dec.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index 79116ec858..a92b191b24 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -39,9 +39,9 @@
+
+ #include "nvv4l2.h"
+
+-extern AVCodec ff_h264_decoder;
+-extern AVCodec ff_hevc_decoder;
+-extern AVCodec ff_vp9_decoder;
++extern const FFCodec ff_h264_decoder;
++extern const FFCodec ff_hevc_decoder;
++extern const FFCodec ff_vp9_decoder;
+
+ /*
+ ** Output plane format support:
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0034-codecs-nvv4l2-more-API-renames.patch b/packages/multimedia/ffmpeg/patches/L4T/0034-codecs-nvv4l2-more-API-renames.patch
new file mode 100644
index 00000000000..5d9bac291b6
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0034-codecs-nvv4l2-more-API-renames.patch
@@ -0,0 +1,58 @@
+From 08ff68f2fb3175157a46a8dfb880f58870ac6b9e Mon Sep 17 00:00:00 2001
+From: theofficialgman <28281419+theofficialgman@users.noreply.github.com>
+Date: Wed, 17 Jan 2024 22:17:55 -0500
+Subject: [PATCH 34/39] codecs: nvv4l2: more API renames
+
+---
+ libavcodec/nvv4l2_dec.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index a92b191b24..5ccea0830b 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -988,6 +988,8 @@ static NvCodingType map_avcodec_id(enum AVCodecID id)
+
+ static int nvv4l2dec_codec_fallback(AVCodecContext *avctx)
+ {
++ const FFCodec *codec2;
++
+ av_log(avctx, AV_LOG_WARNING, "Falling back to software decoding.\n");
+
+ switch (avctx->codec_id) {
+@@ -1005,10 +1007,12 @@ static int nvv4l2dec_codec_fallback(AVCodecContext *avctx)
+ return AVERROR_BUG;
+ }
+
++ codec2 = ffcodec(avctx->codec);
++
+ av_opt_free(avctx->priv_data);
+
+- if (avctx->codec->priv_data_size > 0) {
+- avctx->priv_data = av_mallocz(avctx->codec->priv_data_size);
++ if (codec2->priv_data_size > 0) {
++ avctx->priv_data = av_mallocz(codec2->priv_data_size);
+ if (!avctx->priv_data)
+ return AVERROR(ENOMEM);
+ }
+@@ -1017,7 +1021,7 @@ static int nvv4l2dec_codec_fallback(AVCodecContext *avctx)
+ && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {
+ ff_thread_init(avctx);
+ }
+- if (!HAVE_THREADS && !(avctx->codec->caps_internal & FF_CODEC_CAP_AUTO_THREADS))
++ if (!HAVE_THREADS && !(codec2->caps_internal & FF_CODEC_CAP_AUTO_THREADS))
+ avctx->thread_count = 1;
+
+ if (avctx->codec->priv_class) {
+@@ -1025,7 +1029,7 @@ static int nvv4l2dec_codec_fallback(AVCodecContext *avctx)
+ av_opt_set_defaults(avctx->priv_data);
+ }
+
+- return avctx->codec->init(avctx);
++ return codec2->init(avctx);
+ }
+
+ static int nvv4l2dec_init(AVCodecContext *avctx)
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0035-codecs-nvv4l2-find_codec_or_die-to-find_codec-API-re.patch b/packages/multimedia/ffmpeg/patches/L4T/0035-codecs-nvv4l2-find_codec_or_die-to-find_codec-API-re.patch
new file mode 100644
index 00000000000..1b72655618f
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0035-codecs-nvv4l2-find_codec_or_die-to-find_codec-API-re.patch
@@ -0,0 +1,82 @@
+From e508318655d72876d29df374c19c7edcf3134997 Mon Sep 17 00:00:00 2001
+From: theofficialgman <28281419+theofficialgman@users.noreply.github.com>
+Date: Wed, 17 Jan 2024 23:45:11 -0500
+Subject: [PATCH 35/39] codecs: nvv4l2: find_codec_or_die to find_codec API
+ rename and rework
+
+---
+ fftools/ffmpeg_demux.c | 47 +++++++++++++++++++++++++++---------------
+ 1 file changed, 30 insertions(+), 17 deletions(-)
+
+diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
+index f791c3a898..17b5d63bf8 100644
+--- a/fftools/ffmpeg_demux.c
++++ b/fftools/ffmpeg_demux.c
+@@ -540,24 +540,33 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
+ }
+ #endif
+
+- if (!codec_name)
+- return avcodec_find_decoder(st->codecpar->codec_id);
++ if (!codec_name) {
++ *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
++ return 0;
++ }
+
+ #if CONFIG_NVV4L2
+ if (nvv4l2_pix_fmt_ok) {
+ /* Force hardware decoding if pixel format supported. */
+- if (strcmp(codec_name, "h264") == 0)
+- return avcodec_find_decoder(st->codecpar->codec_id);
+- else if (strcmp(codec_name, "hevc") == 0)
+- return avcodec_find_decoder(st->codecpar->codec_id);
+- else if (strcmp(codec_name, "mpeg2video") == 0)
+- return avcodec_find_decoder(st->codecpar->codec_id);
+- else if (strcmp(codec_name, "mpeg4") == 0)
+- return avcodec_find_decoder(st->codecpar->codec_id);
+- else if (strcmp(codec_name, "vp8") == 0)
+- return avcodec_find_decoder(st->codecpar->codec_id);
+- else if (strcmp(codec_name, "vp9") == 0)
+- return avcodec_find_decoder(st->codecpar->codec_id);
++ if (strcmp(codec_name, "h264") == 0) {
++ *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
++ return 0;
++ } else if (strcmp(codec_name, "hevc") == 0) {
++ *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
++ return 0;
++ } else if (strcmp(codec_name, "mpeg2video") == 0) {
++ *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
++ return 0;
++ } else if (strcmp(codec_name, "mpeg4") == 0) {
++ *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
++ return 0;
++ } else if (strcmp(codec_name, "vp8") == 0) {
++ *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
++ return 0;
++ } else if (strcmp(codec_name, "vp9") == 0) {
++ *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
++ return 0;
++ }
+ } else {
+ /* Force software decoding if pixel format not supported. */
+ if (strcmp(codec_name, "h264_nvv4l2") == 0)
+@@ -575,9 +584,13 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
+ }
+ #endif
+
+- const AVCodec *codec = find_codec_or_die(codec_name, st->codecpar->codec_type, 0);
+- st->codecpar->codec_id = codec->id;
+- return codec;
++ int ret = find_codec(NULL, codec_name, st->codecpar->codec_type, 0, pcodec);
++ if (ret < 0)
++ return ret;
++ st->codecpar->codec_id = (*pcodec)->id;
++ if (recast_media && st->codecpar->codec_type != (*pcodec)->type)
++ st->codecpar->codec_type = (*pcodec)->type;
++ return 0;
+ }
+
+ static int guess_input_channel_layout(InputStream *ist)
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0036-codecs-nvv4l2-update-for-ABI-rework.patch b/packages/multimedia/ffmpeg/patches/L4T/0036-codecs-nvv4l2-update-for-ABI-rework.patch
new file mode 100644
index 00000000000..083da07a9d1
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0036-codecs-nvv4l2-update-for-ABI-rework.patch
@@ -0,0 +1,30 @@
+From 8d78a510e496ea473ea7392b828e17165bb6b6ac Mon Sep 17 00:00:00 2001
+From: theofficialgman <28281419+theofficialgman@users.noreply.github.com>
+Date: Sun, 21 Jan 2024 02:01:10 -0500
+Subject: [PATCH 36/39] codecs: nvv4l2: update for ABI rework
+
+---
+ libavcodec/nvv4l2_dec.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index 5ccea0830b..27e06da1b5 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -1175,12 +1175,11 @@ static int nvv4l2dec_close(AVCodecContext *avctx)
+ }
+
+ static int
+-nvv4l2dec_decode(AVCodecContext *avctx, void *data, int *got_frame,
++nvv4l2dec_decode(AVCodecContext *avctx, AVFrame *avframe, int *got_frame,
+ AVPacket *avpkt)
+ {
+ nvv4l2DecodeContext *nvv4l2_ctx = avctx->priv_data;
+ nvv4l2_ctx_t *ctx = nvv4l2_ctx->ctx;
+- AVFrame *avframe = (AVFrame *)data;
+ NvFrame _nvframe = { 0 };
+ int processed_size = 0;
+ int buf_index = -1;
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0037-Revert-codecs-nvv4l2-update-for-ABI-rework.patch b/packages/multimedia/ffmpeg/patches/L4T/0037-Revert-codecs-nvv4l2-update-for-ABI-rework.patch
new file mode 100644
index 00000000000..5cc9084449d
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0037-Revert-codecs-nvv4l2-update-for-ABI-rework.patch
@@ -0,0 +1,31 @@
+From a18c43b29c220fa020f9cac2522608b2b4cba954 Mon Sep 17 00:00:00 2001
+From: azkali
+Date: Tue, 23 Jan 2024 18:28:29 +0100
+Subject: [PATCH 37/39] Revert "codecs: nvv4l2: update for ABI rework"
+
+This reverts commit 8d78a510e496ea473ea7392b828e17165bb6b6ac.
+---
+ libavcodec/nvv4l2_dec.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index 27e06da1b5..5ccea0830b 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -1175,11 +1175,12 @@ static int nvv4l2dec_close(AVCodecContext *avctx)
+ }
+
+ static int
+-nvv4l2dec_decode(AVCodecContext *avctx, AVFrame *avframe, int *got_frame,
++nvv4l2dec_decode(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+ {
+ nvv4l2DecodeContext *nvv4l2_ctx = avctx->priv_data;
+ nvv4l2_ctx_t *ctx = nvv4l2_ctx->ctx;
++ AVFrame *avframe = (AVFrame *)data;
+ NvFrame _nvframe = { 0 };
+ int processed_size = 0;
+ int buf_index = -1;
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0038-Revert-codecs-nvv4l2-find_codec_or_die-to-find_codec.patch b/packages/multimedia/ffmpeg/patches/L4T/0038-Revert-codecs-nvv4l2-find_codec_or_die-to-find_codec.patch
new file mode 100644
index 00000000000..9ff76c1bfe0
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0038-Revert-codecs-nvv4l2-find_codec_or_die-to-find_codec.patch
@@ -0,0 +1,83 @@
+From 4279fc32ea8b6da4a36aaf0b616408ad1fe4dcea Mon Sep 17 00:00:00 2001
+From: azkali
+Date: Tue, 23 Jan 2024 18:35:39 +0100
+Subject: [PATCH 38/39] Revert "codecs: nvv4l2: find_codec_or_die to find_codec
+ API rename and rework"
+
+This reverts commit e508318655d72876d29df374c19c7edcf3134997.
+---
+ fftools/ffmpeg_demux.c | 47 +++++++++++++++---------------------------
+ 1 file changed, 17 insertions(+), 30 deletions(-)
+
+diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
+index 17b5d63bf8..f791c3a898 100644
+--- a/fftools/ffmpeg_demux.c
++++ b/fftools/ffmpeg_demux.c
+@@ -540,33 +540,24 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
+ }
+ #endif
+
+- if (!codec_name) {
+- *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
+- return 0;
+- }
++ if (!codec_name)
++ return avcodec_find_decoder(st->codecpar->codec_id);
+
+ #if CONFIG_NVV4L2
+ if (nvv4l2_pix_fmt_ok) {
+ /* Force hardware decoding if pixel format supported. */
+- if (strcmp(codec_name, "h264") == 0) {
+- *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
+- return 0;
+- } else if (strcmp(codec_name, "hevc") == 0) {
+- *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
+- return 0;
+- } else if (strcmp(codec_name, "mpeg2video") == 0) {
+- *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
+- return 0;
+- } else if (strcmp(codec_name, "mpeg4") == 0) {
+- *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
+- return 0;
+- } else if (strcmp(codec_name, "vp8") == 0) {
+- *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
+- return 0;
+- } else if (strcmp(codec_name, "vp9") == 0) {
+- *pcodec = avcodec_find_decoder(st->codecpar->codec_id);
+- return 0;
+- }
++ if (strcmp(codec_name, "h264") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "hevc") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "mpeg2video") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "mpeg4") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "vp8") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
++ else if (strcmp(codec_name, "vp9") == 0)
++ return avcodec_find_decoder(st->codecpar->codec_id);
+ } else {
+ /* Force software decoding if pixel format not supported. */
+ if (strcmp(codec_name, "h264_nvv4l2") == 0)
+@@ -584,13 +575,9 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
+ }
+ #endif
+
+- int ret = find_codec(NULL, codec_name, st->codecpar->codec_type, 0, pcodec);
+- if (ret < 0)
+- return ret;
+- st->codecpar->codec_id = (*pcodec)->id;
+- if (recast_media && st->codecpar->codec_type != (*pcodec)->type)
+- st->codecpar->codec_type = (*pcodec)->type;
+- return 0;
++ const AVCodec *codec = find_codec_or_die(codec_name, st->codecpar->codec_type, 0);
++ st->codecpar->codec_id = codec->id;
++ return codec;
+ }
+
+ static int guess_input_channel_layout(InputStream *ist)
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0039-fftools-ffmpeg-set-find_codec_or_die-logctx-to-NULL.patch b/packages/multimedia/ffmpeg/patches/L4T/0039-fftools-ffmpeg-set-find_codec_or_die-logctx-to-NULL.patch
new file mode 100644
index 00000000000..8b09e81a425
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0039-fftools-ffmpeg-set-find_codec_or_die-logctx-to-NULL.patch
@@ -0,0 +1,25 @@
+From a8e8a2151948790f9702802aa87b65bbf5049ac1 Mon Sep 17 00:00:00 2001
+From: azkali
+Date: Tue, 23 Jan 2024 18:50:41 +0100
+Subject: [PATCH 39/39] fftools/ffmpeg: set find_codec_or_die logctx to NULL
+
+---
+ fftools/ffmpeg_demux.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
+index f791c3a898..975a9f5f17 100644
+--- a/fftools/ffmpeg_demux.c
++++ b/fftools/ffmpeg_demux.c
+@@ -575,7 +575,7 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
+ }
+ #endif
+
+- const AVCodec *codec = find_codec_or_die(codec_name, st->codecpar->codec_type, 0);
++ const AVCodec *codec = find_codec_or_die(NULL, codec_name, st->codecpar->codec_type, 0);
+ st->codecpar->codec_id = codec->id;
+ return codec;
+ }
+--
+2.25.1
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0040-nvv4l2-do-not-override-key_frame.patch b/packages/multimedia/ffmpeg/patches/L4T/0040-nvv4l2-do-not-override-key_frame.patch
new file mode 100644
index 00000000000..92d4351fe17
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0040-nvv4l2-do-not-override-key_frame.patch
@@ -0,0 +1,43 @@
+From 91e53cd8349f6a6a74ef7bc9498052467345cff4 Mon Sep 17 00:00:00 2001
+From: CTCaer
+Date: Sat, 27 Jan 2024 00:34:28 +0000
+Subject: [PATCH] nvv4l2: do not override key_frame Some apps are managing this
+ by replacing the ffmpeg get buffer function. Additionally, some badly coded
+ apps use that for actually starting outputting to screen or framebuffer, even
+ though the expected frames from the decoder are always full frames.
+
+---
+ libavcodec/nvv4l2_dec.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
+index b2ac349201a..751f4379e89 100644
+--- a/libavcodec/nvv4l2_dec.c
++++ b/libavcodec/nvv4l2_dec.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2021-2023, CTCaer
++ * Copyright (c) 2021-2024, CTCaer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -1236,12 +1236,13 @@ nvv4l2dec_decode(AVCodecContext *avctx, void *data, int *got_frame,
+ if (_nvframe.pts != AV_NOPTS_VALUE) {
+ avframe->pts = _nvframe.pts;
+ } else {
+- avframe->pts = _nvframe.pts;
++ /*! NOTE: Investigate if setting reordered_opaque to pts instead
++ * is better for no-pts streams compatibility.
++ */
++ avframe->pts = AV_NOPTS_VALUE;
+ avframe->reordered_opaque = _nvframe.user_pts;
+ }
+
+- avframe->key_frame = 0;
+-
+ avctx->coded_width = _nvframe.width;
+ avctx->coded_height = _nvframe.height;
+ avctx->width = _nvframe.width;
+--
+GitLab
+
diff --git a/packages/multimedia/ffmpeg/patches/L4T/0041-fix-libreelec-configure.patch b/packages/multimedia/ffmpeg/patches/L4T/0041-fix-libreelec-configure.patch
new file mode 100644
index 00000000000..a5403731842
--- /dev/null
+++ b/packages/multimedia/ffmpeg/patches/L4T/0041-fix-libreelec-configure.patch
@@ -0,0 +1,25 @@
+diff -Naur ffmpeg-6.0/configure ffmpeg-6.0-2/configure
+--- ffmpeg-6.0/configure 2023-06-04 21:55:16.653155167 +0200
++++ ffmpeg-6.0-2/configure 2023-06-04 22:01:08.003471635 +0200
+@@ -3131,8 +3131,8 @@
+ qsvvpp_select="qsv"
+ vaapi_encode_deps="vaapi"
+ v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
+-nvv4l2_deps="libv4l2 pthreads linux_videodev2_h"
+-nvv4l2_extralibs="-lnvbuf_utils"
++nvv4l2_deps="pthreads linux_videodev2_h"
++nvv4l2_extralibs="-lnvbuf_utils -lv4l2"
+
+ bilateral_cuda_filter_deps="ffnvcodec"
+ bilateral_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
+@@ -7069,9 +7069,7 @@
+ check_type "ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h" "CUVIDAV1PICPARAMS"
+ fi
+
+-enabled nvv4l2 && add_ldflags '-L/usr/lib/aarch64-linux-gnu/tegra' \
+- && check_headers linux/videodev2.h \
+- && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
++enabled nvv4l2 && add_ldflags "-L/usr/lib/aarch64-linux-gnu/tegra"
+
+ enabled amf &&
+ check_cpp_condition amf "AMF/core/Version.h" \
diff --git a/packages/multimedia/libva/package.mk b/packages/multimedia/libva/package.mk
index 27a1ea45daa..cdc4435c6ec 100644
--- a/packages/multimedia/libva/package.mk
+++ b/packages/multimedia/libva/package.mk
@@ -6,12 +6,15 @@ PKG_NAME="libva"
PKG_VERSION="2.21.0"
PKG_SHA256="f7c3fffef3f04eb146e036dad2587d852bfb70e4926d014bf437244915ef7425"
PKG_ARCH="x86_64"
-[ "${DISTRO}" = "Lakka" ] && PKG_ARCH+=" i386" || true
PKG_LICENSE="GPL"
PKG_SITE="https://01.org/linuxmedia"
PKG_URL="https://github.com/intel/libva/archive/${PKG_VERSION}.tar.gz"
PKG_LONGDESC="Libva is an implementation for VA-API (VIdeo Acceleration API)."
+if [ "${DISTRO}" = "Lakka" ]; then
+ PKG_ARCH+=" i386"
+fi
+
if [ "${DISPLAYSERVER}" = "x11" ]; then
PKG_DEPENDS_TARGET="toolchain libX11 libXext libXfixes libdrm"
DISPLAYSERVER_LIBVA="-Dwith_x11=yes -Dwith_glx=no -Dwith_wayland=no"
diff --git a/packages/multimedia/media-driver/patches/1648.patch b/packages/multimedia/media-driver/patches/1648.patch
new file mode 100644
index 00000000000..90679675fb1
--- /dev/null
+++ b/packages/multimedia/media-driver/patches/1648.patch
@@ -0,0 +1,288 @@
+From fd67cc3fbd3a362297afc7cc8d75560df62708de Mon Sep 17 00:00:00 2001
+From: Jay Yang
+Date: Fri, 21 Apr 2023 13:10:52 +0800
+Subject: [PATCH] Fix GCC13 build errors
+
+Fix #1639
+Fix #1640
+Fix #1641
+Signed-off-by: Jay Yang
+---
+ .../Xe_M/Xe_XPM/hw/mhw_vebox_xe_xpm.h | 21 +++++++++++--------
+ .../hal/codechal_encode_csc_ds_mdf_g12.h | 1 +
+ .../agnostic/gen12/hw/mhw_vebox_g12_X.h | 1 +
+ .../gen12/hw/vdbox/mhw_vdbox_avp_generic.h | 19 -----------------
+ .../gen9/codec/hal/codechal_encode_avc_g9.h | 1 +
+ .../codec/hal/codechal_fei_hevc_g9_skl.cpp | 3 ---
+ .../shared/mediacopy/media_copy_xe_hpm.h | 1 +
+ .../shared/mediacopy/media_copy_xe_xpm_base.h | 1 +
+ .../shared/mediacopy/media_copy_xe_xpm_plus.h | 1 +
+ .../hucitf/decode_huc_packet_creator_g12.h | 4 ++++
+ .../m12_0/shared/mediacopy/media_copy_m12_0.h | 1 +
+ .../mediacopy/media_copy_xe_lpm_plus_base.h | 1 +
+ .../bufferMgr/encode_tracked_buffer_queue.cpp | 5 +++++
+ .../bufferMgr/encode_tracked_buffer_queue.h | 2 +-
+ .../common/shared/media_debug_serializer.h | 1 +
+ .../media_scalability_multipipe.cpp | 2 +-
+ .../scalability/media_scalability_multipipe.h | 2 +-
+ 17 files changed, 33 insertions(+), 34 deletions(-)
+
+diff --git a/media_driver/agnostic/Xe_M/Xe_XPM/hw/mhw_vebox_xe_xpm.h b/media_driver/agnostic/Xe_M/Xe_XPM/hw/mhw_vebox_xe_xpm.h
+index b6b86a54ed..ae9a4be096 100644
+--- a/media_driver/agnostic/Xe_M/Xe_XPM/hw/mhw_vebox_xe_xpm.h
++++ b/media_driver/agnostic/Xe_M/Xe_XPM/hw/mhw_vebox_xe_xpm.h
+@@ -110,15 +110,6 @@ class MhwVeboxInterfaceXe_Xpm: public MhwVeboxInterfaceG12
+ PMOS_COMMAND_BUFFER pCmdBuffer,
+ PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS pVeboxSurfaceStateCmdParams) override;
+
+- void SetVeboxSurfaces(
+- PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
+- PMHW_VEBOX_SURFACE_PARAMS pDerivedSurfaceParam,
+- PMHW_VEBOX_SURFACE_PARAMS pSkinScoreSurfaceParam,
+- mhw_vebox_xe_xpm::VEBOX_SURFACE_STATE_CMD *pVeboxSurfaceState,
+- bool bIsOutputSurface,
+- bool bDIEnable,
+- bool b3DlutEnable);
+-
+ MOS_STATUS FindVeboxGpuNodeToUse(
+ PMHW_VEBOX_GPUNODE_LIMIT pGpuNodeLimit) override;
+
+@@ -144,6 +135,18 @@ class MhwVeboxInterfaceXe_Xpm: public MhwVeboxInterfaceG12
+ uint32_t m_indexofVebox = 0;
+ uint32_t m_numofVebox = 1;
+ uint32_t m_usingSfc = 0;
++
++ using MhwVeboxInterfaceG12::SetVeboxSurfaces;
++
++ void SetVeboxSurfaces(
++ PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
++ PMHW_VEBOX_SURFACE_PARAMS pDerivedSurfaceParam,
++ PMHW_VEBOX_SURFACE_PARAMS pSkinScoreSurfaceParam,
++ mhw_vebox_xe_xpm::VEBOX_SURFACE_STATE_CMD *pVeboxSurfaceState,
++ bool bIsOutputSurface,
++ bool bDIEnable,
++ bool b3DlutEnable);
++
+ };
+
+ #endif // __MHW_VEBOX_XE_XPM_H__
+diff --git a/media_driver/agnostic/gen12/codec/hal/codechal_encode_csc_ds_mdf_g12.h b/media_driver/agnostic/gen12/codec/hal/codechal_encode_csc_ds_mdf_g12.h
+index 3dd276a748..ce21993da7 100644
+--- a/media_driver/agnostic/gen12/codec/hal/codechal_encode_csc_ds_mdf_g12.h
++++ b/media_driver/agnostic/gen12/codec/hal/codechal_encode_csc_ds_mdf_g12.h
+@@ -202,6 +202,7 @@ class CodechalEncodeCscDsMdfG12 : public CodechalEncodeCscDsG12
+
+ MOS_STATUS CscKernel(
+ KernelParams* pParams) override;
++ using CodechalEncodeCscDsG12::InitKernelStateCsc;
+ MOS_STATUS InitKernelStateCsc(KernelParams* pParams);
+ MOS_STATUS SetupKernelArgsCSC(CmKernel *cmKrnCSCDS, SurfaceParamsCscMdf* surfaceparams);
+ MOS_STATUS SetCurbeCscforMDF(CMRT_UMD::vector & curbeData);
+diff --git a/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.h b/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.h
+index 64e2ffe462..d0c2d6ca5e 100644
+--- a/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.h
++++ b/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.h
+@@ -336,6 +336,7 @@ class MhwVeboxInterfaceG12 : public MhwVeboxInterfaceGeneric
+ MOS_STATUS ValidateVeboxScalabilityConfig();
+ #endif
+
++protected:
+ void SetVeboxSurfaces(
+ PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
+ PMHW_VEBOX_SURFACE_PARAMS pDerivedSurfaceParam,
+diff --git a/media_driver/agnostic/gen12/hw/vdbox/mhw_vdbox_avp_generic.h b/media_driver/agnostic/gen12/hw/vdbox/mhw_vdbox_avp_generic.h
+index ae1bd88cb2..fb2fc0fe86 100644
+--- a/media_driver/agnostic/gen12/hw/vdbox/mhw_vdbox_avp_generic.h
++++ b/media_driver/agnostic/gen12/hw/vdbox/mhw_vdbox_avp_generic.h
+@@ -95,24 +95,5 @@ class MhwVdboxAvpInterfaceGeneric : public MhwVdboxAvpInterface
+
+ return eStatus;
+ }
+-
+- MOS_STATUS AddAvpBsdObjectCmd(
+- PMOS_COMMAND_BUFFER cmdBuffer,
+- MhwVdboxAvpBsdParams *params)
+- {
+- MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
+-
+- MHW_FUNCTION_ENTER;
+- MHW_MI_CHK_NULL(m_osInterface);
+-
+- typename TAvpCmds::AVP_BSD_OBJECT_CMD cmd;
+-
+- cmd.DW1.IndirectBsdDataLength = params->m_bsdDataLength;
+- cmd.DW2.IndirectDataStartAddress = params->m_bsdDataStartOffset;
+-
+- MHW_MI_CHK_STATUS(m_osInterface->pfnAddCommand(cmdBuffer, &cmd, sizeof(cmd)));
+-
+- return eStatus;
+- }
+ };
+ #endif
+diff --git a/media_driver/agnostic/gen9/codec/hal/codechal_encode_avc_g9.h b/media_driver/agnostic/gen9/codec/hal/codechal_encode_avc_g9.h
+index f981860946..a735bb46cf 100644
+--- a/media_driver/agnostic/gen9/codec/hal/codechal_encode_avc_g9.h
++++ b/media_driver/agnostic/gen9/codec/hal/codechal_encode_avc_g9.h
+@@ -5668,6 +5668,7 @@ class CodechalEncodeAvcEncG9 : public CodechalEncodeAvcEnc
+ MOS_STATUS GetStatusReport(
+ void *status,
+ uint16_t numStatus) override;
++ using CodechalEncodeAvcEnc::GetStatusReport;
+
+ #if USE_CODECHAL_DEBUG_TOOL
+ protected:
+diff --git a/media_driver/agnostic/gen9_skl/codec/hal/codechal_fei_hevc_g9_skl.cpp b/media_driver/agnostic/gen9_skl/codec/hal/codechal_fei_hevc_g9_skl.cpp
+index 8da01da3f0..59c0480653 100644
+--- a/media_driver/agnostic/gen9_skl/codec/hal/codechal_fei_hevc_g9_skl.cpp
++++ b/media_driver/agnostic/gen9_skl/codec/hal/codechal_fei_hevc_g9_skl.cpp
+@@ -6410,9 +6410,6 @@ MOS_STATUS CodechalFeiHevcStateG9Skl::FreeEncResources()
+
+ m_cmKernelMap.clear();
+
+- CmKernelMapType deallocator;
+- m_cmKernelMap.swap(deallocator);
+-
+ #endif
+
+ return eStatus;
+diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_copy_xe_hpm.h b/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_copy_xe_hpm.h
+index b43087e93c..23bf56075c 100644
+--- a/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_copy_xe_hpm.h
++++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_copy_xe_hpm.h
+@@ -50,6 +50,7 @@ class MediaCopyState_Xe_Hpm: public MediaCopyBaseState
+ //!
+ //! \brief init function.
+ virtual MOS_STATUS Initialize( PMOS_INTERFACE osInterface, MhwInterfaces *mhwInterfaces);
++ using MediaCopyBaseState::Initialize;
+
+ //!
+ //! \brief render format support.
+diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_copy_xe_xpm_base.h b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_copy_xe_xpm_base.h
+index 8075553c0d..14c291a4a1 100644
+--- a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_copy_xe_xpm_base.h
++++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_copy_xe_xpm_base.h
+@@ -49,6 +49,7 @@ class MediaCopyStateXe_Xpm_Base: public MediaCopyBaseState
+ //!
+ //! \brief init function.
+ virtual MOS_STATUS Initialize( PMOS_INTERFACE osInterface, MhwInterfaces *mhwInterfaces);
++ using MediaCopyBaseState::Initialize;
+
+ //!
+ //! \brief surface copy pre process.
+diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_copy_xe_xpm_plus.h b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_copy_xe_xpm_plus.h
+index 99f7bfe525..e24f42963f 100644
+--- a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_copy_xe_xpm_plus.h
++++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_copy_xe_xpm_plus.h
+@@ -50,6 +50,7 @@ class MediaCopyStateXe_Xpm_Plus: public MediaCopyBaseState
+ //!
+ //! \brief init function.
+ virtual MOS_STATUS Initialize(PMOS_INTERFACE osInterface, MhwInterfaces *mhwInterfaces);
++ using MediaCopyBaseState::Initialize;
+
+ //!
+ //! \brief render format support.
+diff --git a/media_driver/media_softlet/agnostic/gen12_base/codec/hal/dec/shared/hucitf/decode_huc_packet_creator_g12.h b/media_driver/media_softlet/agnostic/gen12_base/codec/hal/dec/shared/hucitf/decode_huc_packet_creator_g12.h
+index 682c9352bd..1774ff6dcf 100644
+--- a/media_driver/media_softlet/agnostic/gen12_base/codec/hal/dec/shared/hucitf/decode_huc_packet_creator_g12.h
++++ b/media_driver/media_softlet/agnostic/gen12_base/codec/hal/dec/shared/hucitf/decode_huc_packet_creator_g12.h
+@@ -48,6 +48,10 @@ class HucPacketCreatorG12 : public HucPacketCreatorBase
+ MediaPipeline *pipeline,
+ MediaTask *task,
+ CodechalHwInterface *hwInterface);
++
++ using HucPacketCreatorBase::CreateHucCopyPkt;
++ using HucPacketCreatorBase::CreateProbUpdatePkt;
++ using HucPacketCreatorBase::CreateStreamOutInterface;
+ MEDIA_CLASS_DEFINE_END(decode__HucPacketCreatorG12)
+ };
+
+diff --git a/media_driver/media_softlet/agnostic/m12/m12_0/shared/mediacopy/media_copy_m12_0.h b/media_driver/media_softlet/agnostic/m12/m12_0/shared/mediacopy/media_copy_m12_0.h
+index 25e5972b7d..7e267011ad 100644
+--- a/media_driver/media_softlet/agnostic/m12/m12_0/shared/mediacopy/media_copy_m12_0.h
++++ b/media_driver/media_softlet/agnostic/m12/m12_0/shared/mediacopy/media_copy_m12_0.h
+@@ -51,6 +51,7 @@ class MediaCopyStateM12_0: public MediaCopyBaseState
+ //!
+ //! \brief init function.
+ virtual MOS_STATUS Initialize( PMOS_INTERFACE osInterface, MhwInterfaces *mhwInterfaces);
++ using MediaCopyBaseState::Initialize;
+
+ //!
+ //! \brief render format support.
+diff --git a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/shared/mediacopy/media_copy_xe_lpm_plus_base.h b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/shared/mediacopy/media_copy_xe_lpm_plus_base.h
+index 1f3c14ff44..5775a81732 100644
+--- a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/shared/mediacopy/media_copy_xe_lpm_plus_base.h
++++ b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/shared/mediacopy/media_copy_xe_lpm_plus_base.h
+@@ -48,6 +48,7 @@ class MediaCopyStateXe_Lpm_Plus_Base: public MediaCopyBaseState
+ //!
+ //! \brief init function.
+ virtual MOS_STATUS Initialize(PMOS_INTERFACE osInterface, MhwInterfacesNext *mhwInterfaces);
++ using MediaCopyBaseState::Initialize;
+
+ //!
+ //! \brief render format support.
+diff --git a/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.cpp b/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.cpp
+index ccd75e3d97..5c53583b02 100644
+--- a/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.cpp
++++ b/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.cpp
+@@ -154,4 +154,9 @@ MOS_STATUS BufferQueue::DestoryResource(void* resource)
+ return MOS_STATUS_SUCCESS;
+ }
+
++void BufferQueue::SetResourceType(ResourceType resType)
++{
++ m_resourceType = resType;
++}
++
+ }
+\ No newline at end of file
+diff --git a/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.h b/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.h
+index 6ef9424e8c..4aa0898c4d 100644
+--- a/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.h
++++ b/media_softlet/agnostic/common/codec/hal/enc/shared/bufferMgr/encode_tracked_buffer_queue.h
+@@ -87,7 +87,7 @@ class BufferQueue
+ //!
+ bool SafeToDestory();
+
+- void SetResourceType(ResourceType resType) { m_resourceType = resType; }
++ void SetResourceType(ResourceType resType);
+
+ protected:
+ //!
+diff --git a/media_softlet/agnostic/common/shared/media_debug_serializer.h b/media_softlet/agnostic/common/shared/media_debug_serializer.h
+index 77e5fced2d..90d64ad24f 100644
+--- a/media_softlet/agnostic/common/shared/media_debug_serializer.h
++++ b/media_softlet/agnostic/common/shared/media_debug_serializer.h
+@@ -34,6 +34,7 @@
+ #include
+ #include
+ #include
++#include
+ #include "media_class_trace.h"
+
+ template
+diff --git a/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.cpp b/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.cpp
+index 06b107b6bb..fe08b67aeb 100644
+--- a/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.cpp
++++ b/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.cpp
+@@ -29,7 +29,7 @@
+
+ #include "media_scalability_multipipe.h"
+
+-MOS_STATUS MediaScalabilityMultiPipe::UpdateState()
++MOS_STATUS MediaScalabilityMultiPipe::UpdateState(void *statePars)
+ {
+ return MOS_STATUS_SUCCESS;
+ }
+diff --git a/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.h b/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.h
+index 9f848dcde5..81d3f334b3 100644
+--- a/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.h
++++ b/media_softlet/agnostic/common/shared/scalability/media_scalability_multipipe.h
+@@ -50,7 +50,7 @@ class MediaScalabilityMultiPipe: public MediaScalability
+ //! \return MOS_STATUS
+ //! MOS_STATUS_SUCCESS if success, else fail reason
+ //!
+- virtual MOS_STATUS UpdateState();
++ virtual MOS_STATUS UpdateState(void *statePars);
+
+ protected:
+ inline bool IsFirstPipe() { return (m_currentPipe == 0) ? true : false; }
diff --git a/packages/network/bluez/package.mk b/packages/network/bluez/package.mk
index 51a0628479a..baa2f7a0645 100644
--- a/packages/network/bluez/package.mk
+++ b/packages/network/bluez/package.mk
@@ -49,7 +49,7 @@ pre_configure_target() {
# bluez fails to build in subdirs
cd ${PKG_BUILD}
rm -rf .${TARGET_NAME}
-
+ sed -i -e "s|||" src/bluetooth.conf
export LIBS="-lncurses"
}
@@ -71,7 +71,7 @@ post_makeinstall_target() {
echo "[General]" > ${INSTALL}/etc/bluetooth/input.conf
echo "ClassicBondedOnly=false" >> ${INSTALL}/etc/bluetooth/input.conf
- if [ "${DISTRO}" = "Lakka" ]; then
+ if [ "${DISTRO}" = "Lakka" ] || [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
sed -i $INSTALL/etc/bluetooth/main.conf \
-e "s|^#FastConnectable.*|FastConnectable=true|g" \
-e "s|^# Privacy =.*|Privacy = device|g"
diff --git a/packages/network/bluez/patches/bluez-22-libreeelc-add-dbus-policy-for-user.patch b/packages/network/bluez/patches/bluez-22-libreeelc-add-dbus-policy-for-user.patch
new file mode 100644
index 00000000000..383f47a81c5
--- /dev/null
+++ b/packages/network/bluez/patches/bluez-22-libreeelc-add-dbus-policy-for-user.patch
@@ -0,0 +1,38 @@
+diff -Naur bluez-5.66/src/bluetooth.conf bluez-5.66-2/src/bluetooth.conf
+--- bluez-5.66/src/bluetooth.conf 2024-02-02 04:33:35.200222390 +0100
++++ bluez-5.66-2/src/bluetooth.conf 2024-02-02 04:35:47.442699056 +0100
+@@ -6,6 +6,34 @@
+
+
+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
+
+
diff --git a/packages/network/connman/package.mk b/packages/network/connman/package.mk
index c5ced46a235..d96852389dd 100644
--- a/packages/network/connman/package.mk
+++ b/packages/network/connman/package.mk
@@ -56,6 +56,10 @@ PKG_MAKE_OPTS_TARGET="storagedir=/storage/.cache/connman \
vpn_storagedir=/storage/.config/wireguard \
statedir=/run/connman"
+pre_configure_target() {
+ sed -i -e "s|||" ${PKG_BUILD}/src/connman-dbus.conf
+}
+
post_configure_target() {
libtool_remove_rpath libtool
}
@@ -89,10 +93,14 @@ post_makeinstall_target() {
post_install() {
add_user system x 430 430 "service" "/var/run/connman" "/bin/sh"
- add_group system 430
+ add_group system 430 ${DISTRO}
enable_service connman.service
if [ "${WIREGUARD_SUPPORT}" = "yes" ]; then
enable_service connman-vpn.service
fi
+
+ if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ echo chmod u+s ${BUILD}/image/system/usr/bin/connmanctl >> ${FAKEROOT_SCRIPT}
+ fi
}
diff --git a/packages/network/connman/patches/connman-06-fix-libreelec-user-dbus-permissions.patch b/packages/network/connman/patches/connman-06-fix-libreelec-user-dbus-permissions.patch
new file mode 100644
index 00000000000..4ec628649f8
--- /dev/null
+++ b/packages/network/connman/patches/connman-06-fix-libreelec-user-dbus-permissions.patch
@@ -0,0 +1,18 @@
+diff -Naur connman-24180d1243bf005c721be6f9d8d6da67bb669c55/src/connman-dbus.conf connman-24180d1243bf005c721be6f9d8d6da67bb669c55-2/src/connman-dbus.conf
+--- connman-24180d1243bf005c721be6f9d8d6da67bb669c55/src/connman-dbus.conf 2024-02-02 04:49:53.238565581 +0100
++++ connman-24180d1243bf005c721be6f9d8d6da67bb669c55-2/src/connman-dbus.conf 2024-02-02 04:52:06.209049700 +0100
+@@ -1,6 +1,14 @@
+
+
++
++
++
++
++
++
++
++
+
+
+
diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk
index 539f6b4e219..223ff81263a 100644
--- a/packages/sysutils/busybox/package.mk
+++ b/packages/sysutils/busybox/package.mk
@@ -166,6 +166,10 @@ post_install() {
add_user root "${ROOT_PASSWORD}" 0 0 "Root User" "/storage" "/bin/sh"
add_group root 0
add_group users 100
+ if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ add_user "${DISTRO}" "${DISTRO}" 1000 1000 "${DISTRO} User" "/storage" "/sbin/nologin"
+ add_group "${DISTRO}" 1000 ${DISTRO}
+ fi
add_user nobody x 65534 65534 "Nobody" "/" "/bin/sh"
add_group nogroup 65534
diff --git a/packages/sysutils/busybox/scripts/init b/packages/sysutils/busybox/scripts/init
index 107f51b7658..f25fd1010fe 100755
--- a/packages/sysutils/busybox/scripts/init
+++ b/packages/sysutils/busybox/scripts/init
@@ -557,9 +557,9 @@ mount_flash() {
if [ ! "$FAT32_BOOT" = "yes" ]; then
mount_part "$boot" "/flash" "ro,noatime"
else
- mount_part "$boot" "/flash" "rw,noatime"
+ mount_part "$boot" "/flash" "rw,noatime,umask=0000"
fi
-
+
if [ -f /flash/post-flash.sh ]; then
. /flash/post-flash.sh
fi
@@ -987,7 +987,7 @@ prepare_sysroot() {
# Do init tasks to bring up system
-if [ ! "$(cat /proc/cmdline | grep -s odin-workaround)" ]; then
+if [ ! "$(cat /proc/cmdline | grep -s show_kernel_messages)" ]; then
# hide kernel log messages on console
echo '1 4 1 7' > /proc/sys/kernel/printk
fi
diff --git a/packages/sysutils/dbus/package.mk b/packages/sysutils/dbus/package.mk
index aede094817f..9bcc1b2e673 100644
--- a/packages/sysutils/dbus/package.mk
+++ b/packages/sysutils/dbus/package.mk
@@ -40,8 +40,8 @@ post_makeinstall_target() {
post_install() {
add_user dbus x 81 81 "System message bus" "/" "/bin/sh"
- add_group dbus 81
- add_group netdev 497
+ add_group dbus 81 ${DISTRO}
+ add_group netdev 497 ${DISTRO}
echo "chmod 4750 ${INSTALL}/usr/lib/dbus/dbus-daemon-launch-helper" >> ${FAKEROOT_SCRIPT}
echo "chown 0:81 ${INSTALL}/usr/lib/dbus/dbus-daemon-launch-helper" >> ${FAKEROOT_SCRIPT}
diff --git a/packages/sysutils/libgudev/package.mk b/packages/sysutils/libgudev/package.mk
new file mode 100644
index 00000000000..e6d11e18d63
--- /dev/null
+++ b/packages/sysutils/libgudev/package.mk
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv)
+
+PKG_NAME="libgudev"
+PKG_VERSION="235"
+PKG_SHA256="36360e7629b762b0cc85ef302b88a7cea96b0156fd426274815b155c83732c59"
+PKG_LICENSE="GPL"
+PKG_SITE="http://www.linux-usb.org/"
+PKG_URL="https://github.com/GNOME/libgudev/archive/refs/tags/${PKG_VERSION}.zip"
+PKG_DEPENDS_TARGET="toolchain systemd"
+
+
+post_makeinstall_target() {
+ rm -rf ${INSTALL}/usr/lib/pkgconfig
+ rm -rf ${INSTALL}/usr/include
+}
diff --git a/packages/sysutils/mergerfs/patches/mergerfs-02_Fix_Makefile_issue.patch b/packages/sysutils/mergerfs/patches/mergerfs-02_Fix_Makefile_issue.patch
new file mode 100644
index 00000000000..fbe6eb9adf2
--- /dev/null
+++ b/packages/sysutils/mergerfs/patches/mergerfs-02_Fix_Makefile_issue.patch
@@ -0,0 +1,12 @@
+diff -Naur mergerfs-2.24.0/Makefile mergerfs-2.24.0-2/Makefile
+--- mergerfs-2.24.0/Makefile 2023-11-02 23:58:29.373436471 +0100
++++ mergerfs-2.24.0-2/Makefile 2023-11-02 23:59:14.686439139 +0100
+@@ -12,7 +12,7 @@
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+-PKGCONFIG = $(shell which pkg-config)
++PKGCONFIG := $(shell which pkg-config)
+ GIT = $(shell which git)
+ TAR = $(shell which tar)
+ MKDIR = $(shell which mkdir)
diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk
index 6fa9d2c1e66..42585f663fd 100644
--- a/packages/sysutils/systemd/package.mk
+++ b/packages/sysutils/systemd/package.mk
@@ -246,6 +246,8 @@ post_makeinstall_target() {
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/shutdown
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/telinit
+ chmod u+s ${INSTALL}/usr/bin/systemctl
+
# strip
debug_strip ${INSTALL}/usr
@@ -280,26 +282,20 @@ post_install() {
add_group systemd-network 193
add_user systemd-network x 193 193 "systemd-network" "/" "/bin/sh"
- add_group systemd-oom 194
- add_user systemd-oom x 194 194 "systemd Userspace OOM Killer" "/" "/bin/false"
-
- add_group adm 4
- add_group tty 5
- add_group disk 6
- add_group lp 7
+ add_group audio 63 pipewire,${DISTRO}
+ add_group cdrom 11 ${DISTRO}
+ add_group dialout 18 ${DISTRO}
+ add_group disk 6 ${DISTRO}
+ add_group floppy 19 ${DISTRO}
add_group kmem 9
- add_group wheel 10
- add_group cdrom 11
- add_group dialout 18
- add_group floppy 19
- add_group utmp 22
+ add_group kvm 10
+ add_group lp 7
+ add_group render 12
add_group tape 33
- add_group kvm 36
- add_group video 39 pipewire
- add_group audio 63 pipewire
- add_group input 104
- add_group render 105
- add_group sgx 106
+ add_group tty 5
+ add_group video 39 pipewire,${DISTRO}
+ add_group utmp 22
+ add_group input 199 ${DISTRO}
enable_service machine-id.service
enable_service debugconfig.service
@@ -310,4 +306,11 @@ post_install() {
enable_service network-base.service
enable_service systemd-timesyncd.service
enable_service systemd-timesyncd-setup.service
+ #Add service to properly remount flash partition when using fat32-boot kernel command line option.
+ enable_service remount_flash_ro.service
+
+ if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ echo chmod u+s ${BUILD}/image/system/usr/bin/systemctl >> ${FAKEROOT_SCRIPT}
+ fi
}
+
diff --git a/packages/sysutils/systemd/system.d/remount_flash_ro.service b/packages/sysutils/systemd/system.d/remount_flash_ro.service
new file mode 100644
index 00000000000..d3fa4d5e865
--- /dev/null
+++ b/packages/sysutils/systemd/system.d/remount_flash_ro.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Remount /flash as RO
+ConditionKernelCommandLine=fat32-boot
+DefaultDependencies=no
+After=final.target
+
+[Service]
+Type=oneshot
+ExecStart=mount -o remount,ro /flash
+
+[Install]
+WantedBy=final.target
diff --git a/packages/sysutils/upower/package.mk b/packages/sysutils/upower/package.mk
new file mode 100644
index 00000000000..31ec66ceb0c
--- /dev/null
+++ b/packages/sysutils/upower/package.mk
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv)
+
+PKG_NAME="upower"
+PKG_VERSION="v1.90.0"
+PKG_SHA256="cb6028f095824422c59d98b3c9903e2eda2a96fc613f11824f0b6379de7efa2e"
+PKG_LICENSE="GPL"
+PKG_SITE="http://www.linux-usb.org/"
+PKG_URL="https://gitlab.freedesktop.org/upower/upower/-/archive/${PKG_VERSION}/upower-${PKG_VERSION}.tar.gz"
+PKG_DEPENDS_TARGET="toolchain systemd glib dbus libusb libgudev"
+PKG_LONGDESC="Upower is a modular hardware abstraction layer designed for use in Linux systems that is designed to simplify device management and replace the current monolithic Linux HAL. Upower includes the ability to enumerate system devices and send notifications when hardware is added or removed from the computer system."
+
+PKG_MESON_OPTS_TARGET="-Dgtk-doc=false -Dman=false"
+
+post_makeinstall_target() {
+ rm -rf ${INSTALL}/usr/lib/pkgconfig
+ rm -rf ${INSTALL}/usr/include
+}
+
+post_install() {
+ enable_service upower.service
+}
diff --git a/packages/x11/util/xdotool/package.mk b/packages/x11/util/xdotool/package.mk
index ac2d675e6aa..39ea64c86b6 100644
--- a/packages/x11/util/xdotool/package.mk
+++ b/packages/x11/util/xdotool/package.mk
@@ -22,5 +22,5 @@ makeinstall_target() {
mkdir -p ${INSTALL}/usr/{lib,bin}
cp -v xdotool ${INSTALL}/usr/bin
cp -v libxdo* ${INSTALL}/usr/lib
- cp -v libxdo* ${TOOLCHAIN}/aarch64-libreelec-linux-gnueabi/sysroot/usr/lib/
+ cp -v libxdo* ${TOOLCHAIN}/aarch64-libreelec-linux-gnu/sysroot/usr/lib/
}
diff --git a/projects/Ayn/devices/Odin/packages/odin-bootloader/files/boot/EFI/debian/grub.cfg b/projects/Ayn/devices/Odin/packages/odin-bootloader/files/boot/EFI/debian/grub.cfg
index 2255d4ced72..6350c2b82b6 100644
--- a/projects/Ayn/devices/Odin/packages/odin-bootloader/files/boot/EFI/debian/grub.cfg
+++ b/projects/Ayn/devices/Odin/packages/odin-bootloader/files/boot/EFI/debian/grub.cfg
@@ -3,7 +3,7 @@ set timeout="5"
menuentry "Lakka" {
set gfxpayload=keep
- linux /lakka/KERNEL boot=/dev/mmcblk0p1 BOOT_IMAGE=/lakka/KERNEL SYSTEM_IMAGE=/lakka/SYSTEM console=ttyMSM0,115200n8 clk_ignore_unused pd_ignore_unused nofsck fat32-boot firmware.class_path="/usr/lib/firmware" net.ifnames=1 odin-workaround
+ linux /lakka/KERNEL boot=/dev/mmcblk0p1 BOOT_IMAGE=/lakka/KERNEL SYSTEM_IMAGE=/lakka/SYSTEM console=ttyMSM0,115200n8 clk_ignore_unused pd_ignore_unused nofsck fat32-boot firmware.class_path="/usr/lib/firmware" net.ifnames=1 show_kernel_messages
devicetree /lakka/sdm845-ayn-odin.dtb
}
diff --git a/projects/L4T/devices/Switch/initramfs/platform_init b/projects/L4T/devices/Switch/initramfs/platform_init
index 572d7d35220..8e85f2f8b0e 100644
--- a/projects/L4T/devices/Switch/initramfs/platform_init
+++ b/projects/L4T/devices/Switch/initramfs/platform_init
@@ -42,9 +42,7 @@ if [ $CPU_SCHEDUTIL_GOV -eq 1 ]; then
fi
fi
-if [ ! "$(cat /proc/cmdline | grep performance_mode=1)" = "" ]; then
- for scaling_governor in \
- /sys/devices/system/cpu/cpu[0-7]/cpufreq/scaling_governor; do
- echo performance > $scaling_governor
- done
+# Fix permissions for OLED panel
+if [ -e "/sys/devices/50000000.host1x/tegradc.0/panel_color_mode" ]; then
+ chmod 0666 /sys/devices/50000000.host1x/tegradc.0/panel_color_mode
fi
diff --git a/projects/L4T/devices/Switch/linux/linux.aarch64.conf b/projects/L4T/devices/Switch/linux/linux.aarch64.conf
index 52cb164334a..80a4a519dff 100644
--- a/projects/L4T/devices/Switch/linux/linux.aarch64.conf
+++ b/projects/L4T/devices/Switch/linux/linux.aarch64.conf
@@ -215,7 +215,7 @@ CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_EVENTS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_SLUB_DEBUG=y
+# CONFIG_SLUB_DEBUG is not set
CONFIG_COMPAT_BRK=y
# CONFIG_SLAB is not set
CONFIG_SLUB=y
@@ -306,13 +306,11 @@ CONFIG_BLOCK=y
CONFIG_BLK_DEV_BSG=y
# CONFIG_BLK_DEV_BSGLIB is not set
CONFIG_BLK_DEV_INTEGRITY=y
-CONFIG_BLK_DEV_THROTTLING=y
# CONFIG_BLK_CMDLINE_PARSER is not set
#
# Partition Types
#
-CONFIG_PARTITION_ADVANCED=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_AIX_PARTITION is not set
# CONFIG_OSF_PARTITION is not set
@@ -392,7 +390,7 @@ CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_DOMAINS_GENERIC=y
CONFIG_PCI_SYSCALL=y
-CONFIG_PCIEPORTBUS=y
+# CONFIG_PCIEPORTBUS is not set
CONFIG_PCIEAER=y
CONFIG_PCIE_ECRC=y
CONFIG_PCIEASPM=y
@@ -545,12 +543,11 @@ CONFIG_ZPOOL=y
CONFIG_ZBUD=y
# CONFIG_Z3FOLD is not set
CONFIG_ZSMALLOC=y
-# CONFIG_PGTABLE_MAPPING is not set
+CONFIG_PGTABLE_MAPPING=y
# CONFIG_ZSMALLOC_STAT is not set
CONFIG_GENERIC_EARLY_IOREMAP=y
# CONFIG_IDLE_PAGE_TRACKING is not set
CONFIG_ZONE_DEVICE=y
-CONFIG_DEVICE_PRIVATE=y
# CONFIG_DEVICE_PUBLIC is not set
CONFIG_FRAME_VECTOR=y
CONFIG_ARCH_MEMORY_PROBE=y
@@ -560,9 +557,9 @@ CONFIG_SECCOMP=y
CONFIG_KEXEC=y
# CONFIG_XEN is not set
CONFIG_FORCE_MAX_ZONEORDER=11
-CONFIG_HARDEN_BRANCH_PREDICTOR=y
+# CONFIG_HARDEN_BRANCH_PREDICTOR is not set
# CONFIG_UNMAP_KERNEL_AT_EL0 is not set
-CONFIG_ARM64_SSBD=y
+# CONFIG_ARM64_SSBD is not set
CONFIG_ARMV8_DEPRECATED=y
CONFIG_SWP_EMULATION=y
CONFIG_CP15_BARRIER_EMULATION=y
@@ -574,7 +571,6 @@ CONFIG_SETEND_EMULATION=y
#
# CONFIG_ARM64_HW_AFDBM is not set
# CONFIG_ARM64_PAN is not set
-CONFIG_ARM64_LSE_ATOMICS=y
# CONFIG_ARM64_VHE is not set
#
@@ -646,6 +642,8 @@ CONFIG_SERROR_HANDLER=y
# CPU Idle
#
CONFIG_CPU_IDLE=y
+# CONFIG_CPU_IDLE_TEGRA18X is not set
+# CONFIG_CPU_IDLE_TEGRA19X is not set
CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
# CONFIG_CPU_IDLE_GOV_LADDER is not set
CONFIG_CPU_IDLE_GOV_MENU=y
@@ -655,8 +653,6 @@ CONFIG_DT_IDLE_STATES=y
# ARM CPU Idle Drivers
#
CONFIG_ARM_CPUIDLE=y
-CONFIG_CPU_IDLE_TEGRA18X=y
-CONFIG_CPU_IDLE_TEGRA19X=y
# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set
#
@@ -710,6 +706,7 @@ CONFIG_XFRM_USER=y
CONFIG_NET_KEY=y
# CONFIG_NET_KEY_MIGRATE is not set
CONFIG_INET=y
+CONFIG_WIREGUARD=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
# CONFIG_IP_FIB_TRIE_STATS is not set
@@ -778,15 +775,40 @@ CONFIG_NETFILTER_ADVANCED=y
#
# Core Netfilter Configuration
#
-CONFIG_NETFILTER_INGRESS=y
-CONFIG_NETFILTER_NETLINK=m
-# CONFIG_NETFILTER_NETLINK_ACCT is not set
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-# CONFIG_NF_CONNTRACK is not set
-CONFIG_NF_LOG_COMMON=m
-# CONFIG_NF_TABLES is not set
-CONFIG_NETFILTER_XTABLES=m
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_H323=y
+CONFIG_NF_CONNTRACK_IRC=y
+CONFIG_NF_CONNTRACK_NETBIOS_NS=y
+CONFIG_NF_CONNTRACK_SNMP=y
+CONFIG_NF_CONNTRACK_PPTP=y
+CONFIG_NF_CONNTRACK_SANE=y
+CONFIG_NF_CONNTRACK_SIP=y
+CONFIG_NF_CONNTRACK_TFTP=y
+CONFIG_NF_CT_NETLINK=y
+CONFIG_NETFILTER_NETLINK_GLUE_CT=y
+CONFIG_NF_TABLES=y
+CONFIG_NF_TABLES_INET=y
+CONFIG_NF_TABLES_NETDEV=y
+CONFIG_NFT_EXTHDR=y
+CONFIG_NFT_META=y
+CONFIG_NFT_NUMGEN=y
+CONFIG_NFT_CT=y
+CONFIG_NFT_SET_RBTREE=y
+CONFIG_NFT_SET_HASH=y
+CONFIG_NFT_COUNTER=y
+CONFIG_NFT_LOG=y
+CONFIG_NFT_LIMIT=y
+CONFIG_NFT_MASQ=y
+CONFIG_NFT_REDIR=y
+CONFIG_NFT_NAT=y
+CONFIG_NFT_OBJREF=y
+CONFIG_NFT_QUOTA=y
+CONFIG_NFT_REJECT=y
+CONFIG_NFT_COMPAT=y
+CONFIG_NFT_HASH=y
+CONFIG_NFT_DUP_NETDEV=y
+CONFIG_NFT_FWD_NETDEV=y
#
# Xtables combined modules
@@ -1086,7 +1108,6 @@ CONFIG_TEGRA_AHB=y
# Generic Driver Options
#
CONFIG_UEVENT_HELPER=y
-CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_STANDALONE=y
@@ -1245,7 +1266,7 @@ CONFIG_BLK_DEV_NBD=m
# CONFIG_BLK_DEV_SKD is not set
# CONFIG_BLK_DEV_SX8 is not set
CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_COUNT=4
CONFIG_BLK_DEV_RAM_SIZE=8192
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
@@ -1357,7 +1378,6 @@ CONFIG_SENSORS_NCT1008=y
CONFIG_TSKIN_FAN_THERM_EST=y
# CONFIG_EQOS_APE_HWDEP is not set
# CONFIG_TEGRA_SKIN is not set
-CONFIG_TEGRA_PCIE_EP_MEM=y
# CONFIG_NVS is not set
# CONFIG_NVS_LIGHT is not set
# CONFIG_NVS_PROXIMITY is not set
@@ -1576,22 +1596,10 @@ CONFIG_WLAN=y
# CONFIG_WLAN_VENDOR_ATH is not set
# CONFIG_WLAN_VENDOR_ATMEL is not set
CONFIG_WLAN_VENDOR_BROADCOM=y
-CONFIG_B43=y
-CONFIG_B43_BCMA=y
-CONFIG_B43_SSB=y
-CONFIG_B43_BUSES_BCMA_AND_SSB=y
# CONFIG_B43_BUSES_BCMA is not set
# CONFIG_B43_BUSES_SSB is not set
-CONFIG_B43_PCI_AUTOSELECT=y
-CONFIG_B43_PCICORE_AUTOSELECT=y
+# CONFIG_B43_PCI_AUTOSELECT is not set
# CONFIG_B43_SDIO is not set
-CONFIG_B43_BCMA_PIO=y
-CONFIG_B43_PIO=y
-CONFIG_B43_PHY_G=y
-CONFIG_B43_PHY_N=y
-CONFIG_B43_PHY_LP=y
-CONFIG_B43_PHY_HT=y
-CONFIG_B43_LEDS=y
# CONFIG_B43_DEBUG is not set
# CONFIG_B43LEGACY is not set
CONFIG_BRCMUTIL=y
@@ -1599,7 +1607,7 @@ CONFIG_BRCMUTIL=y
CONFIG_BRCMFMAC=m
CONFIG_BRCMFMAC_PROTO_BCDC=y
CONFIG_BRCMFMAC_PROTO_MSGBUF=y
-CONFIG_BRCMFMAC_SDIO=y
+# CONFIG_BRCMFMAC_SDIO is not set
# CONFIG_BRCMFMAC_USB is not set
CONFIG_BRCMFMAC_PCIE=y
# CONFIG_BRCM_TRACING is not set
@@ -1721,8 +1729,6 @@ CONFIG_JOYCON_SERDEV_FF=y
# CONFIG_JOYSTICK_AS5011 is not set
# CONFIG_JOYSTICK_JOYDUMP is not set
CONFIG_JOYSTICK_XPAD=m
-CONFIG_JOYSTICK_XPAD_FF=y
-CONFIG_JOYSTICK_XPAD_LEDS=y
CONFIG_INPUT_TABLET=y
# CONFIG_TABLET_USB_ACECAD is not set
# CONFIG_TABLET_USB_AIPTEK is not set
@@ -1917,7 +1923,9 @@ CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
# CONFIG_TTY_PRINTK is not set
# CONFIG_HVC_DCC is not set
# CONFIG_IPMI_HANDLER is not set
-# CONFIG_HW_RANDOM is not set
+CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_TEGRA=n
+CONFIG_HW_RANDOM_TEGRA_TRNG=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
@@ -1990,7 +1998,7 @@ CONFIG_I2C_ALGOBIT=y
# CONFIG_I2C_RK3X is not set
# CONFIG_I2C_SIMTEC is not set
CONFIG_I2C_TEGRA=y
-CONFIG_I2C_TEGRA_SLAVE=y
+CONFIG_I2C_TEGRA_SLAVE=m
# CONFIG_I2C_THUNDERX is not set
# CONFIG_I2C_XILINX is not set
@@ -2098,10 +2106,10 @@ CONFIG_PINCTRL_MAX77620=y
CONFIG_PINCTRL_TEGRA=y
CONFIG_PINCTRL_TEGRA210=y
CONFIG_PINCTRL_TEGRA_XUSB=y
-CONFIG_PINCTRL_TEGRA186=y
+# CONFIG_PINCTRL_TEGRA186 is not set
# CONFIG_PINCTRL_TEGRA186_PADCTL is not set
# CONFIG_PINCTRL_TEGRA186_DPAUX is not set
-CONFIG_PINCTRL_TEGRA194=y
+# CONFIG_PINCTRL_TEGRA194 is not set
# CONFIG_PINCTRL_TEGRA194_PEXCLK_PADCTL is not set
CONFIG_GPIOLIB=y
CONFIG_OF_GPIO=y
@@ -2170,7 +2178,7 @@ CONFIG_GPIO_MAX77620=y
#
# USB GPIO expanders
#
-CONFIG_GPIO_TEGRA186=y
+# CONFIG_GPIO_TEGRA186 is not set
# CONFIG_GPIO_TMPM32X_I2C is not set
CONFIG_PADCTRL=y
CONFIG_PADCTRL_GENERIC_TEGRA_IO_PAD=y
@@ -2576,7 +2584,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_REGULATOR_ANATOP is not set
# CONFIG_REGULATOR_DA9210 is not set
# CONFIG_REGULATOR_DA9211 is not set
-# CONFIG_REGULATOR_FAN53555 is not set
+CONFIG_REGULATOR_FAN53555=y
CONFIG_REGULATOR_GPIO=y
# CONFIG_REGULATOR_ISL9305 is not set
# CONFIG_REGULATOR_ISL6271A is not set
@@ -2611,7 +2619,7 @@ CONFIG_REGULATOR_PWM=y
# CONFIG_REGULATOR_PMIC_OTP is not set
CONFIG_MEDIA_SUPPORT=y
CONFIG_STAGING_MEDIA=y
-CONFIG_MEDIA_CEC=y
+CONFIG_MEDIA_CEC_SUPPORT=y
#
# Multimedia core support
@@ -2945,11 +2953,11 @@ CONFIG_TEGRA_GRHOST_NVDEC=y
CONFIG_TEGRA_GRHOST_NVENC=y
CONFIG_TEGRA_GRHOST_NVJPG=y
CONFIG_TEGRA_GRHOST_TSEC=y
-CONFIG_TEGRA_GRHOST_NVCSI=y
+# CONFIG_TEGRA_GRHOST_NVCSI is not set
CONFIG_TEGRA_GRHOST_SCALE=y
CONFIG_TEGRA_GRHOST_DEFAULT_TIMEOUT=10000
CONFIG_TEGRA_GRHOST_SYNC=y
-CONFIG_TEGRA_GRHOST_VHOST=y
+# CONFIG_TEGRA_GRHOST_VHOST is not set
# CONFIG_NVDEC_BOOTLOADER is not set
CONFIG_TSEC_USE_WPR=y
CONFIG_TEGRA_CAMERA_PLATFORM=y
@@ -3324,6 +3332,7 @@ CONFIG_THRUSTMASTER_FF=y
CONFIG_HID_WACOM=y
CONFIG_HID_WIIMOTE=y
CONFIG_HID_XINMO=y
+CONFIG_HID_XPADNEO=m
CONFIG_HID_ZEROPLUS=y
# CONFIG_ZEROPLUS_FF is not set
CONFIG_HID_ZYDACRON=y
@@ -3480,6 +3489,8 @@ CONFIG_USB_ULPI=y
CONFIG_USB_ULPI_VIEWPORT=y
CONFIG_DUAL_ROLE_USB_INTF=y
CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VBUS_DRAW=500
+
# CONFIG_USB_GADGET_DEBUG is not set
# CONFIG_USB_GADGET_DEBUG_FILES is not set
# CONFIG_USB_GADGET_DEBUG_FS is not set
@@ -3506,13 +3517,12 @@ CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_TEGRA_XUDC=y
# CONFIG_USB_DUMMY_HCD is not set
CONFIG_USB_TEGRA_CD=y
-CONFIG_USB_TEGRA_CD_NO_USERSPACE=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_F_ACM=y
CONFIG_USB_U_SERIAL=y
CONFIG_USB_F_FS=y
CONFIG_USB_CONFIGFS=y
-# CONFIG_USB_CONFIGFS_SERIAL is not set
+CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
# CONFIG_USB_CONFIGFS_OBEX is not set
# CONFIG_USB_CONFIGFS_NCM is not set
@@ -3572,7 +3582,7 @@ CONFIG_MMC_BLOCK=y
CONFIG_MMC_BLOCK_MINORS=32
CONFIG_MMC_BLOCK_BOUNCE=y
# CONFIG_SDIO_UART is not set
-CONFIG_MMC_TEST=y
+CONFIG_MMC_TEST=m
# CONFIG_MMC_SIMULATE_MAX_SPEED is not set
# CONFIG_MMC_FFU is not set
# CONFIG_MMCQD_CPU_AFFINITY is not set
@@ -3599,7 +3609,6 @@ CONFIG_MMC_SDHCI_TEGRA=y
# CONFIG_MMC_USDHI6ROL0 is not set
# CONFIG_MMC_TOSHIBA_PCI is not set
# CONFIG_MMC_MTK is not set
-CONFIG_MMC_CQ_HCI=y
# CONFIG_MEMSTICK is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
@@ -3926,8 +3935,6 @@ CONFIG_STAGING=y
# CONFIG_SPEAKUP is not set
# CONFIG_MFD_NVEC is not set
-#
-# Android
#
# CONFIG_FIQ_DEBUGGER is not set
# CONFIG_FIQ_WATCHDOG is not set
@@ -3945,12 +3952,7 @@ CONFIG_SYNC=y
# CONFIG_MOST is not set
# CONFIG_KS7010 is not set
# CONFIG_GREYBUS is not set
-CONFIG_STEPPER=y
-CONFIG_STEPPER_PCA=y
-#
-# STEPPER drivers
-#
# CONFIG_USB_WPAN_HCD is not set
# CONFIG_GOLDFISH is not set
# CONFIG_CHROME_PLATFORMS is not set
@@ -4442,7 +4444,6 @@ CONFIG_PWM_TEGRA=y
CONFIG_PWM_TEGRA_TACHOMETER=y
CONFIG_PWM_TEGRA_PMC_BLINK=y
CONFIG_PWM_TEGRA_PMC_SOFT_LED_BLINK=y
-CONFIG_PWM_TEGRA_DFLL=y
CONFIG_IRQCHIP=y
CONFIG_ARM_GIC=y
CONFIG_FIQ=y
@@ -4549,7 +4550,7 @@ CONFIG_HAVE_ARM_SMCCC=y
# Tegra BPMP Driver
#
CONFIG_NV_TEGRA_BPMP=y
-CONFIG_BPMP_DEBUGFS_MOUNT_ON_BOOT=y
+# CONFIG_BPMP_DEBUGFS_MOUNT_ON_BOOT is not set
# CONFIG_ACPI is not set
#
@@ -4821,7 +4822,7 @@ CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_BOOT_PRINTK_DELAY is not set
-CONFIG_DYNAMIC_DEBUG=y
+# CONFIG_DYNAMIC_DEBUG is not set
#
# Compile-time checks and compiler options
@@ -4863,7 +4864,7 @@ CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
# CONFIG_DEBUG_KMEMLEAK_TEST is not set
CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
-CONFIG_DEBUG_KMEMLEAK_SCAN_ON=y
+# CONFIG_DEBUG_KMEMLEAK_SCAN_ON is not set
# CONFIG_DEBUG_STACK_USAGE is not set
CONFIG_DEBUG_VM=y
# CONFIG_DEBUG_VM_VMACACHE is not set
@@ -5179,7 +5180,7 @@ CONFIG_TEGRA_CRYPTO_DEV=y
CONFIG_CRYPTO_DEV_TEGRA_SE=y
CONFIG_CRYPTO_DEV_TEGRA_ELLIPTIC_SE=y
CONFIG_CRYPTO_DEV_TEGRA_SE_USE_HOST1X_INTERFACE=y
-# CONFIG_CRYPTO_DEV_TEGRA_VIRTUAL_SE_INTERFACE is not set
+CONFIG_CRYPTO_DEV_TEGRA_VIRTUAL_SE_INTERFACE=y
# CONFIG_ASYMMETRIC_KEY_TYPE is not set
#
diff --git a/projects/L4T/devices/Switch/options b/projects/L4T/devices/Switch/options
index 0aa6467c225..787d01733a8 100644
--- a/projects/L4T/devices/Switch/options
+++ b/projects/L4T/devices/Switch/options
@@ -11,15 +11,31 @@ case ${TARGET_ARCH} in
;;
esac
-# remove xpadneo
-ADDITIONAL_PACKAGES="${ADDITIONAL_PACKAGES//xpadneo/}"
-
-ADDITIONAL_PACKAGES+=" switch-joycon-bluetooth-dock-configs switch-alsa-ucm-configs libcec v4l-utils usb-gadget-scripts switch-cpu-profile switch-gpu-profile"
+# CEC Support
+ CEC_FRAMEWORK_SUPPORT="yes"
if [ "${DISTRO}" = "Lakka" ]; then
- ADDITIONAL_PACKAGES+=" mergerfs"
+ DISTRO_PATH="lakka"
+ DISTRO_ICON="icon_lakka_hue.bmp"
+ HEKATE_SPLASH="splash_lakka.bmp"
+ ID="SWR-LAK"
+ ADDITIONAL_PACKAGES+=" wii-u-gc-adapter"
+# LAKKA_CANARY_PATH="http://nightly.builds.lakka.tv/members/gavin/lakka-v5.x-new"
+elif [ "${DISTRO}" = "LibreELEC" ]; then
+ DISTRO_PATH="libreelec"
+ DISTRO_ICON="icon_libreelec_hue.bmp"
+ HEKATE_SPLASH="splash_libreelec.bmp"
+ ID="SWR-LIB"
+else
+ echo "Unknown distro, expect issues"
fi
+ADDITIONAL_PACKAGES+=" switch-bsp"
+
+#Remove since we include driver in kernel now. Module Config/udev rules
+#Included in switch-bsp package, to match version in kernel(0.9.5).
+ADDITIONAL_PACKAGES="${ADDITIONAL_PACKAGES//xpadneo/}"
+
if [ ${PULSEAUDIO_SUPPORT} = "yes" ]; then
ADDITIONAL_PACKAGES+=" pulseaudio-configs"
fi
@@ -27,25 +43,26 @@ fi
BOOTLOADER="switch-bootloader" # this is a fake bootloader since coreboot and u-boot are sideloaded
ADDITIONAL_DRIVERS+=" xf86-input-libinput"
-
+#Add proper version for kernel based upon switchroot version Only used for switch
+SWITCHROOT_VERSION=5.1.2
GENERIC_L4T_VERSION=32.3.1
L4T_DEVICE_TYPE="t210"
-#L4T_COMBINED_KERNEL_SHA256="346baf95b5e13f416eb07f7e354b6b2aec1138b72c745ef222b55247c5150211"
+#L4T_COMBINED_KERNEL_SHA256="c3a8df6836cb4581162da6f4d380c2a730f69b3bac8bbaf4c2ec6c73ab5461cd"
L4T_DEVICE_CUSTOM_BOARD_NAME="nx"
# serial number of the kernel
# bump this in case any of the below change to build new kernel archive
# set it to year-month-date of the update
-L4T_KERNEL_VERSION="2022-12-24"
+L4T_KERNEL_VERSION="2023-06-10"
-L4T_KERNEL_4_9_REPO="https://gitlab.com/switchroot/kernel/l4t-kernel-4.9.git"
-L4T_KERNEL_4_9_REPO_BRANCH="linux-5.0.0-dev"
-L4T_KERNEL_4_9_REPO_SHA256="68e1648524c7deacc9e7346113aa2f60edadc7f2"
+L4T_KERNEL_4_9_REPO="https://github.com/CTCaer/switch-l4t-kernel-4.9.git"
+L4T_KERNEL_4_9_REPO_BRANCH="linux-5.1.2"
+L4T_KERNEL_4_9_REPO_SHA256="2d0059fd3167a8df756de2aa0489d4aa70a9fc15"
-L4T_KERNEL_NVIDIA_REPO="https://gitlab.com/switchroot/kernel/l4t-kernel-nvidia.git"
-L4T_KERNEL_NVIDIA_REPO_BRANCH="linux-5.0.0-dev"
-L4T_KERNEL_NVIDIA_REPO_SHA256="2a7d8df2de59dc388f2ced76ac2f1180d324d985"
+L4T_KERNEL_NVIDIA_REPO="https://github.com/CTCaer/switch-l4t-kernel-nvidia.git"
+L4T_KERNEL_NVIDIA_REPO_BRANCH="linux-5.1.2"
+L4T_KERNEL_NVIDIA_REPO_SHA256="a4cc21186653434c0362323b12354e6e713ad5af"
L4T_KERNEL_NVGPU_REPO="https://gitlab.com/switchroot/kernel/l4t-kernel-nvgpu.git"
L4T_KERNEL_NVGPU_REPO_BRANCH="linux-3.4.0-r32.5"
@@ -53,7 +70,7 @@ L4T_KERNEL_NVGPU_REPO_SHA256="1ae0167d360287ca78f5a2572f0de42594140312"
L4T_DEVICE_TEGRA_REPO="https://gitlab.com/switchroot/kernel/l4t-soc-tegra.git"
L4T_DEVICE_TEGRA_REPO_BRANCH="l4t/l4t-r32.3.1"
-L4T_DEVICE_TEGRA_REPO_SHA256="b26b71bbc77d8815f6b88a282b383f523fb053dd"
+#L4T_DEVICE_TEGRA_REPO_SHA256="d2692b96d3a89e26d3bad94eb7e6bc4caccbdbdb"
L4T_DEVICE_COMMON_TEGRA_REPO="https://gitlab.com/switchroot/kernel/l4t-platform-tegra-common.git"
L4T_DEVICE_COMMON_TEGRA_REPO_BRANCH="l4t/l4t-r32.3.1"
@@ -68,6 +85,6 @@ L4T_DEVICE_T210_REPO_BRANCH="l4t/l4t-r32.3.1"
#L4T_DEVICE_T210_REPO_SHA256="0d7816046cb06b637a3b70381a5e4994fd897c35"
#Apply Custom Device DTS tree.
-L4T_DEVICE_CUSTOM_REPO="https://gitlab.com/switchroot/kernel/l4t-platform-t210-switch.git"
-L4T_DEVICE_CUSTOM_REPO_BRANCH="linux-5.0.0-dev"
-L4T_DEVICE_CUSTOM_REPO_SHA256="8abfc0ac0241a501284ecc2cd11737f5967f7f58"
+L4T_DEVICE_CUSTOM_REPO="https://github.com/CTCaer/switch-l4t-platform-t210-nx.git"
+L4T_DEVICE_CUSTOM_REPO_BRANCH="linux-dev"
+L4T_DEVICE_CUSTOM_REPO_SHA256="cf785c4c176499b301170d79fe57b77f365b73cd"
diff --git a/projects/L4T/devices/Switch/packages/kodi/system.d/kodi.service b/projects/L4T/devices/Switch/packages/kodi/system.d/kodi.service
new file mode 100644
index 00000000000..0ad29a8bdf2
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/kodi/system.d/kodi.service
@@ -0,0 +1,25 @@
+[Unit]
+Description=Kodi Media Center
+After=network-online.target graphical.target
+Requires=graphical.target
+Wants=network-online.target
+
+[Service]
+User=LibreELEC
+Group=LibreELEC
+Environment=HOME=/storage DISPLAY=:0 PULSE_SERVER=127.0.0.1
+EnvironmentFile=/usr/lib/kodi/kodi.conf
+EnvironmentFile=-/run/libreelec/kodi.conf
+EnvironmentFile=-/run/libreelec/debug/kodi.conf
+ExecStartPre=-/usr/lib/kodi/kodi-config
+ExecStart=/usr/lib/kodi/kodi.sh --standalone -fs $KODI_ARGS $KODI_DEBUG
+ExecStop=/bin/kill -TERM $MAINPID
+ExecStopPost=-/usr/lib/kodi/kodi-safe-mode
+TimeoutStopSec=30
+Restart=always
+RestartSec=2
+StartLimitInterval=0
+LimitNOFILE=16384
+
+[Install]
+WantedBy=kodi.target
diff --git a/projects/L4T/devices/Switch/packages/retroarch/system.d/retroarch.service b/projects/L4T/devices/Switch/packages/retroarch/system.d/retroarch.service
index a3f160c667f..f12bf421a4f 100644
--- a/projects/L4T/devices/Switch/packages/retroarch/system.d/retroarch.service
+++ b/projects/L4T/devices/Switch/packages/retroarch/system.d/retroarch.service
@@ -5,7 +5,9 @@ ConditionKernelCommandLine=!retroarch=0
Requires=graphical.target
[Service]
-Environment=HOME=/storage DISPLAY=:0
+Environment=HOME=/storage DISPLAY=:0 PULSE_SERVER=127.0.0.1
+User=Lakka
+Group=Lakka
EnvironmentFile=-/run/libreelec/retroarch.conf
EnvironmentFile=-/storage/.cache/services/retroarch.conf
ExecStartPre=-/usr/lib/retroarch/retroarch-config
diff --git a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/package.mk b/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/package.mk
deleted file mode 100644
index 4f88cb053c4..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/package.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-PKG_NAME="switch-alsa-ucm-configs"
-PKG_DEPENDS_TARGET="alsa-lib alsa-ucm-conf"
-PKG_SECTION="virtual"
-PKG_LONGDESC="Nintendo Switch Alsa UCM Configs"
-
-post_install() {
- mkdir -p ${INSTALL}/usr/share/alsa/ucm2
- cp -Prv ${PKG_DIR}/ucm_data/* ${INSTALL}/usr/share/alsa/ucm2/
- #Audio Fix Service
- enable_service alsa-init.service
-}
diff --git a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/00-tegra.conf b/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/00-tegra.conf
deleted file mode 100644
index 43f40fed4d8..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/00-tegra.conf
+++ /dev/null
@@ -1,131 +0,0 @@
-#
-# ALSA library configuration file
-#
-# Copyright (c) 2018-2019 NVIDIA Corporation. All Rights Reserved.
-#
-# NVIDIA Corporation and its licensors retain all intellectual property and
-# proprietary rights in and to this software and related documentation. Any
-# use, reproduction, disclosure or distribution of this software and related
-# documentation without an express license agreement from NVIDIA Corporation
-# is strictly prohibited.
-#
-# Configuration for Tegra soundcards
-CARDINFO{driver}=="tegra-snd-t210r", GOTO="Tegra210 Init"
-CARDINFO{driver}=="tegra-snd-t186r", GOTO="Tegra186 Init"
-CARDINFO{driver}=="tegra-snd-t19x-", GOTO="Tegra186 Init"
-RESULT="false", EXIT="return"
-
-LABEL="Tegra210 Init"
-CTL{reset}="mixer"
-#CTL{name}="OPE2 Mux", CTL{value}="None"
-GOTO="Tegra Common Init"
-
-LABEL="Tegra186 Init"
-CTL{reset}="mixer"
-CTL{name}="ADMAIF11 Mux", CTL{value}="None"
-CTL{name}="ADMAIF12 Mux", CTL{value}="None"
-CTL{name}="ADMAIF13 Mux", CTL{value}="None"
-CTL{name}="ADMAIF14 Mux", CTL{value}="None"
-CTL{name}="ADMAIF15 Mux", CTL{value}="None"
-CTL{name}="ADMAIF16 Mux", CTL{value}="None"
-CTL{name}="ADMAIF17 Mux", CTL{value}="None"
-CTL{name}="ADMAIF18 Mux", CTL{value}="None"
-CTL{name}="ADMAIF19 Mux", CTL{value}="None"
-CTL{name}="ADMAIF20 Mux", CTL{value}="None"
-CTL{name}="ADX3 Mux", CTL{value}="None"
-CTL{name}="ADX4 Mux", CTL{value}="None"
-CTL{name}="AMX3-1 Mux", CTL{value}="None"
-CTL{name}="AMX3-2 Mux", CTL{value}="None"
-CTL{name}="AMX3-3 Mux", CTL{value}="None"
-CTL{name}="AMX3-4 Mux", CTL{value}="None"
-CTL{name}="AMX4-1 Mux", CTL{value}="None"
-CTL{name}="AMX4-2 Mux", CTL{value}="None"
-CTL{name}="AMX4-3 Mux", CTL{value}="None"
-CTL{name}="AMX4-4 Mux", CTL{value}="None"
-CTL{name}="ASRC1-1 Mux", CTL{value}="None"
-CTL{name}="ASRC1-2 Mux", CTL{value}="None"
-CTL{name}="ASRC1-3 Mux", CTL{value}="None"
-CTL{name}="ASRC1-4 Mux", CTL{value}="None"
-CTL{name}="ASRC1-5 Mux", CTL{value}="None"
-CTL{name}="ASRC1-6 Mux", CTL{value}="None"
-CTL{name}="Denominator1 Mux", CTL{value}="None"
-CTL{name}="Denominator2 Mux", CTL{value}="None"
-CTL{name}="Denominator3 Mux", CTL{value}="None"
-CTL{name}="Denominator4 Mux", CTL{value}="None"
-CTL{name}="Denominator5 Mux", CTL{value}="None"
-CTL{name}="Denominator6 Mux", CTL{value}="None"
-CTL{name}="DSPK1 Mux", CTL{value}="None"
-CTL{name}="DSPK2 Mux", CTL{value}="None"
-CTL{name}="I2S6 Mux", CTL{value}="None"
-CTL{name}="Numerator1 Mux", CTL{value}="None"
-CTL{name}="Numerator2 Mux", CTL{value}="None"
-CTL{name}="Numerator3 Mux", CTL{value}="None"
-CTL{name}="Numerator4 Mux", CTL{value}="None"
-CTL{name}="Numerator5 Mux", CTL{value}="None"
-CTL{name}="Numerator6 Mux", CTL{value}="None"
-
-LABEL="Tegra Common Init"
-CTL{reset}="mixer"
-CTL{name}="ADMAIF1 Mux", CTL{value}="None"
-CTL{name}="ADMAIF2 Mux", CTL{value}="None"
-CTL{name}="ADMAIF3 Mux", CTL{value}="None"
-CTL{name}="ADMAIF4 Mux", CTL{value}="None"
-CTL{name}="ADMAIF5 Mux", CTL{value}="None"
-CTL{name}="ADMAIF6 Mux", CTL{value}="None"
-CTL{name}="ADMAIF7 Mux", CTL{value}="None"
-CTL{name}="ADMAIF8 Mux", CTL{value}="None"
-CTL{name}="ADMAIF9 Mux", CTL{value}="None"
-CTL{name}="ADMAIF10 Mux", CTL{value}="None"
-CTL{name}="ADX1 Mux", CTL{value}="None"
-CTL{name}="ADX2 Mux", CTL{value}="None"
-CTL{name}="AFC1 Mux", CTL{value}="None"
-CTL{name}="AFC2 Mux", CTL{value}="None"
-CTL{name}="AFC3 Mux", CTL{value}="None"
-CTL{name}="AFC4 Mux", CTL{value}="None"
-CTL{name}="AFC5 Mux", CTL{value}="None"
-CTL{name}="AFC6 Mux", CTL{value}="None"
-CTL{name}="AMX1-1 Mux", CTL{value}="None"
-CTL{name}="AMX1-2 Mux", CTL{value}="None"
-CTL{name}="AMX1-3 Mux", CTL{value}="None"
-CTL{name}="AMX1-4 Mux", CTL{value}="None"
-CTL{name}="AMX2-1 Mux", CTL{value}="None"
-CTL{name}="AMX2-2 Mux", CTL{value}="None"
-CTL{name}="AMX2-3 Mux", CTL{value}="None"
-CTL{name}="AMX2-4 Mux", CTL{value}="None"
-CTL{name}="I2S1 Mux", CTL{value}="None"
-CTL{name}="I2S2 Mux", CTL{value}="None"
-CTL{name}="I2S3 Mux", CTL{value}="None"
-CTL{name}="I2S4 Mux", CTL{value}="None"
-CTL{name}="I2S5 Mux", CTL{value}="None"
-CTL{name}="MIXER1-1 Mux", CTL{value}="None"
-CTL{name}="MIXER1-2 Mux", CTL{value}="None"
-CTL{name}="MIXER1-3 Mux", CTL{value}="None"
-CTL{name}="MIXER1-4 Mux", CTL{value}="None"
-CTL{name}="MIXER1-5 Mux", CTL{value}="None"
-CTL{name}="MIXER1-6 Mux", CTL{value}="None"
-CTL{name}="MIXER1-7 Mux", CTL{value}="None"
-CTL{name}="MIXER1-8 Mux", CTL{value}="None"
-CTL{name}="MIXER1-9 Mux", CTL{value}="None"
-CTL{name}="MIXER1-10 Mux", CTL{value}="None"
-CTL{name}="MVC1 Mux", CTL{value}="None"
-CTL{name}="MVC2 Mux", CTL{value}="None"
-CTL{name}="OPE1 Mux", CTL{value}="None"
-CTL{name}="SFC1 Mux", CTL{value}="None"
-CTL{name}="SFC2 Mux", CTL{value}="None"
-CTL{name}="SFC3 Mux", CTL{value}="None"
-CTL{name}="SFC4 Mux", CTL{value}="None"
-CTL{name}="SPKPROT1 Mux", CTL{value}="None"
-CARDINFO{driver}=="tegra-snd-t210r", \
- CTL{name}="I2S1 Loopback", CTL{do_search}=="0", \
- CTL{name}="ADMAIF1 Mux", CTL{value}="I2S1" \
- CTL{name}="I2S1 Mux", CTL{value}="ADMAIF1"
-CARDINFO{driver}=="tegra-snd-t186r", \
- CTL{name}="ADMAIF1 Mux", CTL{value}="I2S1" \
- CTL{name}="I2S1 Mux", CTL{value}="ADMAIF1"
-CARDINFO{driver}=="tegra-snd-t19x-", \
- CTL{name}="ADMAIF1 Mux", CTL{value}="I2S1" \
- CTL{name}="I2S1 Mux", CTL{value}="ADMAIF1" \
- CTL{name}="ADMAIF2 Mux", CTL{value}="I2S2" \
- CTL{name}="I2S2 Mux", CTL{value}="ADMAIF2"
-PRINT="Reset Tegra APE sound-card controls\n"
-RESULT="true", EXIT="return"
diff --git a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/01-tegra-rt565x.conf b/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/01-tegra-rt565x.conf
deleted file mode 100644
index 2632cd5a9ef..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/postinit/01-tegra-rt565x.conf
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# ALSA library configuration file
-#
-# Copyright (c) 2018-2019 NVIDIA Corporation. All Rights Reserved.
-#
-# NVIDIA Corporation and its licensors retain all intellectual property and
-# proprietary rights in and to this software and related documentation. Any
-# use, reproduction, disclosure or distribution of this software and related
-# documentation without an express license agreement from NVIDIA Corporation
-# is strictly prohibited.
-#
-# Configuration for Tegra soundcards using the RT565x codec
-
-CARDINFO{driver}=="tegra-snd-t210r", GOTO="Tegra RT565x Init"
-CARDINFO{driver}=="tegra-snd-t186r", GOTO="Tegra RT565x Init"
-CARDINFO{driver}=="tegra-snd-t19x-", GOTO="Tegra RT565x Init"
-RESULT="false", EXIT="return"
-
-LABEL="Tegra RT565x Init"
-CTL{reset}="mixer"
-CTL{name}="x TDM Data Mux",PROGRAM!="__ctl_search",GOTO="Tegra RT565x Next"
-
-# RT565x playback setup
-CTL{name}="x Headphone Playback Volume", CTL{value}="31,31"
-CTL{name}="x Stereo DAC MIXR DAC R1 Switch", CTL{value}="on"
-CTL{name}="x Stereo DAC MIXL DAC L1 Switch", CTL{value}="on"
-CTL{name}="x HPO R Playback Switch", CTL{value}="on"
-CTL{name}="x HPO L Playback Switch", CTL{value}="on"
-CTL{name}="x DAC1 Playback Volume", CTL{value}="175,175"
-CTL{name}="x DAC1 Playback Switch", CTL{value}="on"
-CTL{name}="x DAC1 MIXR DAC1 Switch", CTL{value}="on"
-CTL{name}="x DAC1 MIXL DAC1 Switch", CTL{value}="on"
-
-# RT565x capture setup
-CTL{name}="x RECMIX1L BST1 Switch", CTL{value}="on"
-CTL{name}="x RECMIX1R BST1 Switch", CTL{value}="on"
-CTL{name}="x Stereo1 ADC Source", CTL{value}="ADC1"
-CTL{name}="x Stereo1 ADC1 Source", CTL{value}="ADC"
-CTL{name}="x Stereo1 ADC MIXL ADC1 Switch", CTL{value}="on"
-CTL{name}="x Stereo1 ADC MIXR ADC1 Switch", CTL{value}="on"
-CTL{name}="x TDM Data Mux", CTL{value}="AD1:AD2:DAC:NUL"
-CTL{name}="x IN1 Boost Volume", CTL{value}="43"
-PRINT="Initialised RT565x codec with prefix 'x'\n"
-
-LABEL="Tegra RT565x Next"
-CTL{name}="y TDM Data Mux",PROGRAM!="__ctl_search",RESULT="true", EXIT="return"
-
-# RT565x playback setup
-CTL{name}="y Headphone Playback Volume", CTL{value}="31,31"
-CTL{name}="y Stereo DAC MIXR DAC R1 Switch", CTL{value}="on"
-CTL{name}="y Stereo DAC MIXL DAC L1 Switch", CTL{value}="on"
-CTL{name}="y HPO R Playback Switch", CTL{value}="on"
-CTL{name}="y HPO L Playback Switch", CTL{value}="on"
-CTL{name}="y DAC1 Playback Volume", CTL{value}="175,175"
-CTL{name}="y DAC1 Playback Switch", CTL{value}="on"
-CTL{name}="y DAC1 MIXR DAC1 Switch", CTL{value}="on"
-CTL{name}="y DAC1 MIXL DAC1 Switch", CTL{value}="on"
-
-# RT565x capture setup
-CTL{name}="y RECMIX1L BST1 Switch", CTL{value}="on"
-CTL{name}="y RECMIX1R BST1 Switch", CTL{value}="on"
-CTL{name}="y Stereo1 ADC Source", CTL{value}="ADC1"
-CTL{name}="y Stereo1 ADC1 Source", CTL{value}="ADC"
-CTL{name}="y Stereo1 ADC MIXL ADC1 Switch", CTL{value}="on"
-CTL{name}="y Stereo1 ADC MIXR ADC1 Switch", CTL{value}="on"
-CTL{name}="y TDM Data Mux", CTL{value}="AD1:AD2:DAC:NUL"
-CTL{name}="y IN1 Boost Volume", CTL{value}="43"
-PRINT="Initialised RT565x codec with prefix 'y'\n"
-
-RESULT="true", EXIT="return"
diff --git a/projects/L4T/devices/Switch/packages/switch-bootloader/assets/README_CONFIG.txt b/projects/L4T/devices/Switch/packages/switch-bootloader/assets/README_CONFIG.txt
index c8563841ac5..327671eb6f6 100644
--- a/projects/L4T/devices/Switch/packages/switch-bootloader/assets/README_CONFIG.txt
+++ b/projects/L4T/devices/Switch/packages/switch-bootloader/assets/README_CONFIG.txt
@@ -16,7 +16,7 @@ Below you can find all supported keys and their defaults.
Mandatory!
[id=@DISTRO_ID@]
- Set FS Label name. SWR-UBU by default.
+ Set FS Label name. @DISTRO_ID@ by default.
Used to automatically find the correct linux partition.
================================================================================
@@ -24,7 +24,8 @@ Below you can find all supported keys and their defaults.
[r2p_action=self]
self: Reboots to self. [Default]
bootloader: Reboots to bootloader menu.
-
+ normal: Reboots with no config. Allows default auto boot to be used.
+
[usb3_enable=0]
1: Enable USB3 support.
Enabling it can dramatically decrease WiFi 2.4GHz and Bluetooth signal quality.
@@ -49,9 +50,17 @@ Below you can find all supported keys and their defaults.
[als_enable=1]
1: Enable Ambient Light Sensor.
+[jc_rail_disable=0]
+ 1: Disable railed Joycon support.
+
+[touch_skip_tuning=0]
+ 1: Disables touch panel tuning on boot.
+ Some panels with broken flex cable might need it.
-[cec_enable=0]
- 1: Enable auto DP/HDMI CEC negotiation.
+[wifi_disable_vht80=0]
+ 1: Disable Wi-Fi VHT80 and VHT160 bonding (5GHz band).
+ In case wifi card firmware hangs when fully used at such speeds and kernel
+ panics, that might help to mitigate that issue.
[bootargs_extra=]
Set extra kernel command line arguments.
@@ -62,34 +71,146 @@ Below you can find all supported keys and their defaults.
Can also allow higher CPU/GPU clocks. If OC is used, the reduced power draw
is negated.
+[gpu_dvfsc=0]
+1: Enable DVFS C-Side for GPU. T210B01 only.
+ Reduces power draw drastically on GPU frequencies of 768/844 MHz and up.
+ Allows up to 1228 MHz clocks on select speedo binnings.
+
+[limit_gpu_clk=0]
+ 1: Set GPU clock hard limit to 1075 MHz. T210B01 only.
+ Helps when `gpu_dvfsc` is enabled and GPU can't handle the higher frequencies
+ in such low voltages.
+================================================================================
+
+
+============================== RAM Overclocking ================================
+
[ram_oc=0]
Set RAM Overclock frequency in KHz.
- If you hang or get corruption or artifacts, try to reduce it.
-
- On T210 (Erista max 1996 MHz):
- Only frequencies in the following list are supported:
- 1728000, 1795200, 1862400, 1894400, 1932800, 1996800
- Suggested:
- - 1862400
- On T210B01 (Mariko max 2133 MHz):
- Any multiple of 38400 KHz can be used.
- Suggested:
+ If you hang or get corruption or artifacts, try to reduce it.
+ `mem-bench` command can use almost all of the available bandwidth so it can be
+ used for a quick testing.
+ Actual stability can only be confirmed by `memtester` command on as high as
+ possible temperature for several hours and with a big test size.
+ Running a secondary GPU benchmark can help raise temperature.
+
+ Any clock increase will also increase RAM power consumption like a CPU/GPU OC.
+ For example on T210B01, with 1z-nm ram, going from 1866 to 2133 causes a
+ 146 mW increase on active reads/writes which is 19.8%.
+ Any other state is affected only with a voltage change.
+
+ Warning: On T210B01, GPU minimum voltage might be raised if very high RAM
+ frequency is used and GPU binning is low.
+
+ T210 (Erista max 2133 MHz):
+ List of supported frequencies:
+ 1733000, 1800000, 1866000, 1900000, 1933000, 1966000, 2000000, 2033000,
+ 2066000, 2100000, 2133000, 2166000, 2200000, 2233000, 2266000, 2300000,
+ 2333000, 2366000.
+
+ Input frequency is generally normalized to one of the above.
+ Actual frequency will differ a bit.
+
+ Suggested Jedec Frequencies:
- 1866000
- 2133000
+ Suggested Custom:
+ - Any, if it works.
-[performance_mode=0]
- 0: Use default schedutil cpu governor
- 1: Use Performance CPU governor
-[dock_freq_switch_enabled=0]
- 0: Do not autoswitch clocks when docking/undocking
- 1: Autoswitch clocks when docking/undocking.
+ T210B01 (Mariko max 3000 MHz):
+ List of supported frequencies:
+ 1866000, 2133000, 2166000, 2200000, 2233000, 2266000, 2300000, 2333000,
+ 2366000, 2400000, 2433000, 2466000, 2500000, 2533000, 2566000, 2600000,
+ 2633000, 2666000, 2700000, 2733000, 2766000, 2800000, 2833000, 2866000,
+ 2900000, 2933000, 2966000, 3000000, 3033000, 3066000, 3100000, 3133000,
+ 3166000, 3200000.
- This feature only auto changes speeds to the HOS defaults for both tablet/docked mode.
- It also doesnt switch even if set if you change clocks manually. This is intentional,
- as I give you a menu to set clocks, and dont want to override your settings. If
- you set clock back to stock clock speed, it will start auto swapping again.
+ Input frequency is generally normalized to one of the above.
+ Actual frequency will be exactly one of these.
+
+ Suggested Jedec Frequencies:
+ - 1866000
+ - 2133000
+ - 2400000
+ - 2666000
+
+ Suggested Custom Frequencies:
+ - Any, if it works.
+ Very high ram frequencies might raise GPU power draw on some GPU frequencies
+ if GPU binning is low.
+
+ Timing based overclocking:
+ To enable that, edit the last [2 (T210) or 3 (T210B01) digits] of the frequency.
+
+ It's generally better to find a good base frequency before touching these.
+
+ Do not touch them at all for guaranteed stability on max possible frequency,
+ since without these, the whole configuration is exactly per Nvidia's and
+ RAM vendor's specifications.
+
+ Syntax:
+ T210: Freq MHz + BA. FFFFF[BA]. (18624[00] -> 18624[52])
+ T210B01: Freq MHz + CBA. FFFF[CBA]. (2133[000] -> 2133[252])
+
+ Description of F, A, B and C timing overclocking options:
+ [F]: Actual clock frequency. Exceeding chip's real max is actual OC.
+
+ [A]: Base Latency reduction.
+ Base latency decreases based on selected frequency bracket.
+ Brackets: 1333/1600/1866/2133.
+ - Range: 0 - 3. 0 to -3 bracket change.
+ Example 1: 1866 with 2 is 1333 base latency. Originally 1866 bracket.
+ Example 1: 1866 with 3 is 1333 base latency. Originally 1866 bracket.
+ Example 2: 1996 with 3 is 1333 base latency. Originally 2133 bracket.
+ Example 3: 2133 with 2 is 1600 base latency. Originally 2133 bracket.
+ Example 4: 2400 with 0 is 2133 base latency. Originally 2133 bracket.
+
+ [B]: Core Timings reduction.
+ Timings that massively get affected by temperatures are not touched.
+ - Range: 0 - 9. 0% to 45% reduction.
+
+ [C]: BW Increase. T210B01/LPDDR4x only. RAM Temperature limited timings.
+ Can cause significant ram data corruption if ram temperature exceeds max.
+ Reason is not allowed on T210 and LPDDR4.
+ - 0/1/2/3/4: for max 85/75/65/55/45 oC
+
+ RAM Temperature is only related to MEM/PLL sensors and not to Tdiode or Tboard.
+ 45oC is 50/51 oC MEM/PLL (around 43 oC Tdiode, depends on temp equilibrium).
+ 65oC is 68/69 oC MEM/PLL (around 60 oC Tdiode, depends on temp equilibrium).
+
+ Full Examples:
+ Old (no timing adjustments) OC equivalents:
+ - 1862 Old OC: 15% -> [A1,B3,C0] - 1866031
+ - 1996 Old OC: 25% -> [A2,B5,C0] - 2000052
+
+ T210 Examples:
+ - 19968[00] -> 1996800: 1996 MHz with read/write base latency of 2133 MHz
+ and proper 1996 MHz core timings.
+ - 19968[00] -> 1996852: 1996 MHz with read/write base latency of 1600 MHz
+ and reduced core timings by 25%.
+ T210B01 Examples:
+ - 2666[000] -> 2666000: 2666 MHz with read/write base latency of 2133 MHz
+ and proper 2666 MHz core timings.
+ - 2666[000] -> 2666252: 2666 MHz with read/write base latency of 1600 MHz,
+ reduced core timings by 25% and up to 65C operation.
+
+Again, do not use them if you want the ram running like Nvidia and RAM vendor
+made the tables, and write the frequency `as is` in that case.
+
+
+[ram_oc_vdd2=0]
+ Changes VDDIO/VDDQ voltage for T210. VDDIO only for T210B01.
+ Can stabilize timing reduction or if at frequency limit.
+ Do not use for zero reason. Limits are fully safe (official Jedec).
+ Range: 1100 - 1175. (Unit in mV).
+
+[ram_oc_vddq=0]
+ Changes VDDQ voltage for T210B01.
+ Can stabilize timing reduction or if at frequency limit.
+ Do not use for zero reason. Limits are fully safe (official Jedec).
+ Range: 600 - 650. (Unit in mV).
================================================================================
diff --git a/projects/L4T/devices/Switch/packages/switch-bootloader/assets/boot.txt b/projects/L4T/devices/Switch/packages/switch-bootloader/assets/boot.txt
index 86c47499346..87d2cf69a49 100644
--- a/projects/L4T/devices/Switch/packages/switch-bootloader/assets/boot.txt
+++ b/projects/L4T/devices/Switch/packages/switch-bootloader/assets/boot.txt
@@ -1,8 +1,9 @@
# Set defaults env variables if they do not exist.
setenv boot_dir @DISTRO_PATH@
test -n ${id} || setenv id @DISTRO_ID@
-test -n ${fbconsole} || setenv fbconsole 1
+test -n ${fbconsole} || setenv fbconsole 9
test -n ${uart_port} || setenv uart_port 0
+test -n ${earlycon} || setenv earlycon 0
test -n ${r2p_action} || setenv r2p_action self
test -n ${autoboot} || setenv autoboot 0
test -n ${autoboot_list} || setenv autoboot_list 0
@@ -10,15 +11,57 @@ test -n ${als_enable} || setenv als_enable 1
test -n ${usb3_enable} || setenv usb3_enable 0
test -n ${4k60_disable} || setenv 4k60_disable 0
test -n ${dvfsb} || setenv dvfsb 0
+test -n ${gpu_dvfsc} || setenv gpu_dvfsc 0
+test -n ${limit_gpu_clk} || setenv limit_gpu_clk 0
+test -n ${jc_rail_disable} || setenv jc_rail_disable 0
test -n ${cec_enable} || setenv cec_enable 0
test -n ${performance_mode} || setenv performance_mode 0
test -n ${dock_freq_switch_enabled} || setenv dock_freq_switch_enabled 0
+test -n ${touch_skip_tuning} || setenv touch_skip_tuning 0
+test -n ${wifi_disable_vht80} || setenv wifi_disable_vht80 0
+
+# Built-in IMU.
+test -n ${acc_cal_off_x} || setenv acc_cal_off_x 0x0
+test -n ${acc_cal_off_y} || setenv acc_cal_off_y 0x0
+test -n ${acc_cal_off_z} || setenv acc_cal_off_z 0x0
+test -n ${acc_cal_scl_x} || setenv acc_cal_scl_x 0x0
+test -n ${acc_cal_scl_y} || setenv acc_cal_scl_y 0x0
+test -n ${acc_cal_scl_z} || setenv acc_cal_scl_z 0x0
+test -n ${gyr_cal_off_x} || setenv gyr_cal_off_x 0x0
+test -n ${gyr_cal_off_y} || setenv gyr_cal_off_y 0x0
+test -n ${gyr_cal_off_z} || setenv gyr_cal_off_z 0x0
+test -n ${gyr_cal_scl_x} || setenv gyr_cal_scl_x 0x0
+test -n ${gyr_cal_scl_y} || setenv gyr_cal_scl_y 0x0
+test -n ${gyr_cal_scl_z} || setenv gyr_cal_scl_z 0x0
+
+# Lite Gamepad analog sticks calibration.
+test -n ${lite_cal_lx_lof} || setenv lite_cal_lx_lof 0x0
+test -n ${lite_cal_lx_cnt} || setenv lite_cal_lx_cnt 0x0
+test -n ${lite_cal_lx_rof} || setenv lite_cal_lx_rof 0x0
+test -n ${lite_cal_ly_dof} || setenv lite_cal_ly_dof 0x0
+test -n ${lite_cal_ly_cnt} || setenv lite_cal_ly_cnt 0x0
+test -n ${lite_cal_ly_uof} || setenv lite_cal_ly_uof 0x0
+
+test -n ${lite_cal_rx_lof} || setenv lite_cal_rx_lof 0x0
+test -n ${lite_cal_rx_cnt} || setenv lite_cal_rx_cnt 0x0
+test -n ${lite_cal_rx_rof} || setenv lite_cal_rx_rof 0x0
+test -n ${lite_cal_ry_dof} || setenv lite_cal_ry_dof 0x0
+test -n ${lite_cal_ry_cnt} || setenv lite_cal_ry_cnt 0x0
+test -n ${lite_cal_ry_uof} || setenv lite_cal_ry_uof 0x0
+
+test -n ${lite_cal_lx_coff} || setenv lite_cal_lx_coff 0x0
+test -n ${lite_cal_ly_coff} || setenv lite_cal_ly_coff 0xFFFFFF00
+test -n ${lite_cal_rx_coff} || setenv lite_cal_rx_coff 0xFFFFFF00
+test -n ${lite_cal_ry_coff} || setenv lite_cal_ry_coff 0x0
# Set logging params for each serial type.
setenv uarta "no_console_suspend console=ttyS0,115200,8n1 loglevel=8"
setenv uartb "no_console_suspend console=ttyS1,115200,8n1 loglevel=8"
setenv uartc "no_console_suspend console=ttyS2,115200,8n1 loglevel=8"
-setenv usblg "console=ttyGS0,115200,8n1 loglevel=8"
+setenv usblg "usb_logging loglevel=8"
+setenv uarta_early "earlycon=uart,mmio32,0x70006000"
+setenv uartb_early "earlycon=uart,mmio32,0x70006040"
+setenv uartc_early "earlycon=uart,mmio32,0x70006200"
# Default read addresses.
# fdt_addr_r 0x8d000000
@@ -32,13 +75,14 @@ setenv fdtrload 0xA8000000
setenv fdtraddr 0x8d000000
# Set temp addresses.
+setenv enviraddr 0x8d100000
setenv fdtovaddr 0x8d200000
# Set SoC info.
if test ${t210b01} = 1; then setenv plat_info T210B01; else setenv plat_info T210; fi
-# Set SKU info.
+# Set SKU info. Frig is used instead of Fric for compatibility reasons.
if test ${sku} = 0; then setenv sku_info ODIN; setenv sku_rev 0
elif test ${sku} = 1; then setenv sku_info ODIN; setenv sku_rev b01
elif test ${sku} = 2; then setenv sku_info VALI; setenv sku_rev 0
@@ -72,34 +116,100 @@ fdt resize 16384
# Sanity checks for dtb info.
if test ${sku_info} != ${fdt_id_text} -o ${sku_rev} != ${fdt_rev}; then
- echoe Device Tree loaded (SKU: ${fdt_id_text}, Rev: ${fdt_rev}) not correct!
+ echoe Device Tree loaded not correct! (SKU: ${fdt_id_text}, Rev: ${fdt_rev})
echoe Expected SKU: ${sku_info}, Rev: ${sku_rev}
echoe Rebooting in 10s..; sleep 10; reset
fi
# Add additional bootargs for UART Logging.
if test ${uart_port} = 1; then
- setenv bootargs_extra ${bootargs_extra} ${uarta}; echoe UART-A logging enabled
+ echoe UART-A logging enabled
+ setenv bootargs_extra ${bootargs_extra} ${uarta}
fdt set /serial@70006000 compatible nvidia,tegra20-uart
fdt set /serial@70006000 status okay
+
+ if test ${earlycon} = 1; then
+ echoe Early logging enabled
+ setenv bootargs_extra ${bootargs_extra} ${uarta_early}
+ fdt set /serial@70006000 reset-names noreset
+ fi
elif test ${uart_port} = 2; then
- setenv bootargs_extra ${bootargs_extra} ${uartb}; echoe UART-B logging enabled
+ echoe UART-B logging enabled
+ setenv bootargs_extra ${bootargs_extra} ${uartb}
fdt set /serial@70006040 compatible nvidia,tegra20-uart
fdt set /serial@70006040/joyconr status disabled
+
+ if test ${earlycon} = 1; then
+ echoe Early logging enabled
+ setenv bootargs_extra ${bootargs_extra} ${uartb_early}
+ fdt set /serial@70006040 reset-names noreset
+ fi
elif test ${uart_port} = 3; then
- setenv bootargs_extra ${bootargs_extra} ${uartc}; echoe UART-C logging enabled
+ echoe UART-C logging enabled
+ setenv bootargs_extra ${bootargs_extra} ${uartc}
fdt set /serial@70006200 compatible nvidia,tegra20-uart
fdt set /serial@70006200/joyconl status disabled
-elif test ${uart_port} = 4; then
+
+ if test ${earlycon} = 1; then
+ echoe Early logging enabled
+ setenv bootargs_extra ${bootargs_extra} ${uartc_early}
+ fdt set /serial@70006200 reset-names noreset
+ fi
+fi
+
# Add additional bootargs for Serial USB.
+if test ${uart_port} = 4; then
setenv bootargs_extra ${usblg} ${bootargs_extra}; echoe USB Serial logging enabled
fi
+# Disable Joycon Rails.
+if test ${jc_rail_disable} = 1; then
+ echoe Joycon Rails disabled
+ fdt set /serial@70006040 status disabled
+ fdt set /serial@70006040/joyconr status disabled
+ fdt set /serial@70006200 status disabled
+ fdt set /serial@70006200/joyconl status disabled
+fi
+
+# Disable Touch panel tuning.
+if test ${touch_skip_tuning} = 1; then
+ setenv bootargs_extra ${bootargs_extra} "ftm4.skip_tuning=1"
+fi
+
+# Check if SD is initialized in 1-bit mode.
+if test "${sd_1bit}" = 1; then
+ echoe SD Card is initialized in 1-bit mode!
+ fdt set /sdhci@700b0000 bus-width <0x1>
+ fdt set /sdhci@700b0000 uhs-mask <0x7F>
+fi
+
# Enable ALS sensor.
if test ${als_enable} = 1; then
+ echo ALS sensor enabled
fdt set /i2c@7000c400/bh1730fvc@29 status okay
fi
+# Disable WiFi VHT80 bonding.
+if test ${wifi_disable_vht80} = 1; then
+ echo WiFi VHT80 bonding disabled
+ setenv bootargs_extra ${bootargs_extra} "brcmfmac.vht_mask=12"
+fi
+
+# Set Sio calibration data.
+if test ${sku} = 2; then
+ if load mmc ${devnum}:${distro_bootpart} ${enviraddr} /switchroot/switch.cal; then
+ env import -t -r ${enviraddr} ${filesize}
+ echo Sio Calibration set
+ fdt set /serial@70006200/sio sio-stick-cal-l <$lite_cal_lx_lof $lite_cal_lx_cnt $lite_cal_lx_rof $lite_cal_ly_dof $lite_cal_ly_cnt $lite_cal_ly_uof>
+ fdt set /serial@70006200/sio sio-stick-cal-r <$lite_cal_rx_lof $lite_cal_rx_cnt $lite_cal_rx_rof $lite_cal_ry_dof $lite_cal_ry_cnt $lite_cal_ry_uof>
+ fdt set /serial@70006200/sio sio-acc-cal <$acc_cal_off_x $acc_cal_off_y $acc_cal_off_z $acc_cal_scl_x $acc_cal_scl_y $acc_cal_scl_z>
+ fdt set /serial@70006200/sio sio-gyr-cal <$gyr_cal_off_x $gyr_cal_off_y $gyr_cal_off_z $gyr_cal_scl_x $gyr_cal_scl_y $gyr_cal_scl_z>
+
+ fdt set /serial@70006200/sio sio-stick-cnt-off-l <$lite_cal_lx_coff $lite_cal_ly_coff>
+ fdt set /serial@70006200/sio sio-stick-cnt-off-r <$lite_cal_rx_coff $lite_cal_ry_coff>
+ fi
+fi
+
# Get display panel handle.
if test ${display_id} = f20; then echo Display is INN 6.2; fdt get value DHANDLE /host1x/dsi/panel-i-720p-6-2 phandle
elif test ${display_id} = f30; then echo Display is AUO 6.2; fdt get value DHANDLE /host1x/dsi/panel-a-720p-6-2 phandle
@@ -111,7 +221,7 @@ elif test ${display_id} = 2050; then echo Display is SAM 7.0
else echoe Unknown Display ID: ${display_id}!; fi
# Set new active display panel handle.
-if test -n ${DHANDLE} -a ${sku} != 3; then echo Setting Display panel; fdt set /host1x/dsi nvidia,active-panel <$DHANDLE>; fi
+if test -n "${DHANDLE}" -a ${sku} != 3; then echo Setting Display panel; fdt set /host1x/dsi nvidia,active-panel <$DHANDLE>; fi
# Disable USB3.
if test ${usb3_enable} = 0; then
@@ -128,38 +238,88 @@ else
echoe USB3 enabled
fi
-# Disable 4 DP lanes on Frig.
+# Disable 4 DP lanes (4K@60) on Fric.
if test ${sku} = 3 -a ${4k60_disable} = 1 -a ${usb3_enable} != 0; then
echoe 4K60 disabled
fdt set /i2c@7000c000/bm92t@18 rohm,dp-lanes <2>
fi
-# Check if SD is initialized in 1-bit mode.
-if test "${sd_1bit}" = 1; then
- echoe SD Card is initialized in 1-bit mode!
- fdt set /sdhci@700b0000 bus-width <0x1>
- fdt set /sdhci@700b0000 uhs-mask <0x7F>
-fi
-
# Set battery voltage limit via cell age for Vali.
if test ${sku} = 2 -a -n "${VLIM}"; then
echo VALI: voltage limits [${VLIM}, ${SOCLIM}]
- fdt set /i2c@7000c000/battery-charger@6b/charger ti,charge-voltage-limit-millivolt <0x$VLIM>
- fdt set /i2c@7000c000/battery-charger@6b/charger ti,charge-thermal-voltage-limit <0x$VLIM 0x$VLIM 0x$VLIM 0xFF0>
- fdt set /i2c@7000c000/battery-gauge@36 maxim,kernel-maximum-soc <0x$SOCLIM>
+ if test "${VLIM}" != 1070; then
+ # Newer Vali. 4320 mV / 1664 mA.
+ fdt set /i2c@7000c000/battery-charger@6b/charger ti,charge-voltage-limit-millivolt <0x$VLIM>
+ fdt set /i2c@7000c000/battery-charger@6b/charger ti,charge-thermal-voltage-limit <0x$VLIM 0x$VLIM 0x$VLIM 0xFF0>
+ fdt set /i2c@7000c000/battery-gauge@36 maxim,kernel-maximum-soc <0x$SOCLIM>
+ else
+ # Old Vali. 4208 mV / 1536 mA. (Unreleased?)
+ fdt set /i2c@7000c000/battery-charger@6b/charger ti,charge-voltage-limit-millivolt <0x1070>
+ fdt set /i2c@7000c000/battery-charger@6b/charger ti,charge-thermal-voltage-limit <0x1070 0x1070 0x1070 0xF70>
+ fdt set /i2c@7000c000/battery-charger@6b/charger ti,fast-charge-current-limit-milliamp <0x600>
+ fdt set /i2c@7000c000/battery-charger@6b/charger ti,charge-current-limit <0x200 0x240 0x600 0x600>
+ fi
+fi
+
+# Enable DVFS B-Side.
+if test ${t210b01} = 1 -a ${dvfsb} = 1; then
+ echoe DVFS B-Side enabled
+ setenv bootargs_extra ${bootargs_extra} "speedo_tegra210.sku_id=0x83 speedo_tegra210.cspd_id=2 speedo_tegra210.sspd_id=2"
+ fdt set /cpufreq/cpu-scaling-data max-frequency <0x249348>
+
+ if test ${gpu_dvfsc} != 1; then
+ setenv bootargs_extra ${bootargs_extra} "speedo_tegra210.gspd_id=2"
+ fi
+
+ if test ${sku} = 2; then
+ # 2091 MHz CPU and 844 MHz GPU hard limit. Vali.
+ fdt set /cpufreq/cpu-scaling-data max-frequency <0x1FE7F8>
+ fdt set /dvfs nvidia,gpu-max-freq-khz <0xCE400>
+ fi
fi
-# Enable SLT DVFS.
-if test ${dvfsb} = 1; then
- echoe SLT DVFS B enabled
- setenv bootargs_extra ${bootargs_extra} "speedo_tegra210.cspd_id=2 speedo_tegra210.cspd_id=2 speedo_tegra210.gspd_id=2"
+# Enable GPU DVFS C-Side.
+if test ${t210b01} = 1 -a ${gpu_dvfsc} = 1; then
+ echoe DVFS C-Side GPU enabled
+
+ if test ${dvfsb} != 1; then
+ setenv bootargs_extra ${bootargs_extra} "speedo_tegra210.sku_id=0x83 speedo_tegra210.gspd_id=3"
+ else
+ setenv bootargs_extra ${bootargs_extra} "speedo_tegra210.gspd_id=3"
+ fi
fi
+# Limit GPU clock.
+if test ${t210b01} = 1 -a ${limit_gpu_clk} = 1; then
+
+ if test ${sku} != 2; then
+ # If not Vali set GPU hard limit to 1075 MHz.
+ echoe GPU clock limit enabled
+ fdt set /dvfs nvidia,gpu-max-freq-khz <0x106800>
+ fi
+fi
+
+# Set pmic type if special (devboard).
+if test ${t210b01} = 1 -a -n "${pmic_type}" -a ${pmic_type} = 1; then
+ echoe GPU 15A Regulator enabled
+ fdt set /i2c@7000d000/max77812@33 reg <0x31>
+ fdt set /i2c@7000d000/max77812@33/m3vout status disabled
+ fdt set /i2c@7000d000/fan53528@52 status okay
+ fdt set /dvfs nvidia,gpu-max-volt-mv <0x3B6>
+fi
+
+# Check if ptsa rework is done.
+if test ${t210b01} = 1 -a "${loader_rev}" > 1; then
+ echo PTSA rework done
+ setenv bootargs_extra ${bootargs_extra} "latency_allowance.ptsa_rework"
+fi
# Set serial number.
if test -n ${device_serial}; then fdt set / serial-number ${device_serial}; fi
+host_mac_addr=0xff
+
# load mac address info file
if fatload mmc 1:1 0x90000000 switchroot/joycon_mac.bin; then
if itest.b *0x90000000 == 0x01; then
@@ -173,53 +333,40 @@ if fatload mmc 1:1 0x90000000 switchroot/joycon_mac.bin; then
fi
fi
-if itest $host_mac_addr == 0xff; then
- # no joy con is available
-
- # write to a known good location
- mw.q 0x90000000 ${serial#} 1
-
- # write crc32 of value at offset 0x3
- crc32 0x90000000 8 0x90000003
-
- # write nintendo prefix
- mw.b 0x90000000 0x98 1
- mw.b 0x90000001 0xE8 1
- mw.b 0x90000002 0xFA 1
-
- # use this to generate mac
- host_mac_addr=0x90000000
+if itest $host_mac_addr != 0xff; then
+ bt_mac=""
+ sep=""
+ for i in 0 1 2 3 4 5 ; do
+ setexpr x $host_mac_addr + $i
+ setexpr.b b *$x
+ if itest $b <= f; then
+ # There is no way to have leading zeros, so do this hack
+ bt_mac="$bt_mac${sep}0$b"
+ else
+ bt_mac="$bt_mac$sep$b"
+ fi
+ sep=":"
+ done
+
+ # Set host bt mac.
+ if test -n ${bt_mac}; then fdt set /chosen nvidia,bluetooth-mac ${bt_mac}; fi
+else
+ # Set host bt mac.
+ if test -n ${device_bt_mac}; then fdt set /chosen nvidia,bluetooth-mac ${device_bt_mac}; fi
fi
-bt_mac=""
-sep=""
-for i in 0 1 2 3 4 5 ; do
- setexpr x $host_mac_addr + $i
- setexpr.b b *$x
- if itest $b <= f; then
- # There is no way to have leading zeros, so do this hack
- bt_mac="$bt_mac${sep}0$b"
- else
- bt_mac="$bt_mac$sep$b"
- fi
- sep=":"
-done
-
-# Set default bt mac. initramfs will/can change it.
-if test -n ${bt_mac}; then fdt set /chosen nvidia,bluetooth-mac ${bt_mac}; fi
-
# Set default wifi mac. initramfs will/can change it.
if test -n ${device_wifi_mac}; then fdt set /chosen nvidia,wifi-mac ${device_wifi_mac}; fi
-# Set kernel cdmline.
-setenv bootargs ${bootargs_extra} "boot=/dev/mmcblk0p1 BOOT_IMAGE=@DISTRO_PATH@/KERNEL SYSTEM_IMAGE=@DISTRO_PATH@/SYSTEM nofsck fat32-boot cec_enabled=${cec_enable} \
+# Set kernel cmdline.
+setenv bootargs ${bootargs_extra} "boot=/dev/mmcblk0p1 BOOT_IMAGE=@DISTRO_PATH@/KERNEL SYSTEM_IMAGE=@DISTRO_PATH@/SYSTEM nofsck fat32-boot \
dock_freq_switch_enabled=${dock_freq_switch_enabled} performance_mode=${performance_mode} \
- firmware_class.path=/usr/lib/firmware \
+ firmware_class.path=/usr/lib/firmware access=m2 \
pmc_r2p.enabled=1 pmc_r2p.action=${r2p_action} \
pmc_r2p.param1=${autoboot} pmc_r2p.param2=${autoboot_list} \
- nvdec_enabled=0 tegra_fbmem=0x400000@0xf5a00000 access=m2 \
- consoleblank=0 fbcon=map:${fbconsole} "
+ fbcon=map:${fbconsole} consoleblank=0 \
+ nvdec_enabled=0 tegra_fbmem=0x400000@0xf5a00000 "
# Boot kernel.
echo Launching Kernel!
diff --git a/projects/L4T/devices/Switch/packages/switch-bootloader/package.mk b/projects/L4T/devices/Switch/packages/switch-bootloader/package.mk
index fabfe8d43ce..93f0526f306 100644
--- a/projects/L4T/devices/Switch/packages/switch-bootloader/package.mk
+++ b/projects/L4T/devices/Switch/packages/switch-bootloader/package.mk
@@ -1,25 +1,9 @@
PKG_NAME="switch-bootloader"
-PKG_VERSION="2.1"
+PKG_VERSION="2.8"
PKG_ARCH="any"
PKG_DEPENDS_TARGET="switch-u-boot:host switch-u-boot:target switch-atf:target"
PKG_TOOLCHAIN="manual"
-
-if [ "${DISTRO}" = "Lakka" ]; then
- DISTRO_PATH="lakka"
- DISTRO_ICON="icon_lakka_hue.bmp"
- HEKATE_SPLASH="splash_lakka.bmp"
- ID="SWR-LAK"
-elif [ "${DISTRO}" = "LibreELEC" ]; then
- DISTRO_PATH="libreelec"
- DISTRO_ICON="icon_libreelec_hue.bmp"
- HEKATE_SPLASH="splash_libreelec.bmp"
- ID="SWR-LIB"
-else
- echo "Unknown distro, expect issues"
-fi
-
-
make_target() {
cat << EOF > ${PKG_BUILD}/${DISTRO}.ini
[${DISTRO}]
@@ -60,7 +44,7 @@ makeinstall_target() {
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/uenv.txt" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/uenv.txt
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/tegra210-icosa.dtb" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/tegra210-icosa.dtb
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/uartb_logging.dtbo" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/uartb_logging.dtbo
-[ -f "\${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini" ] && rm \${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini
+[ -f "\${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini" ] && grep "l4t=1" "\${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini" && [ $? = "1" ] && rm \${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/nx-plat.dtimg" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/nx-plat.dtimg
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/boot/boot.scr" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/boot/boot.scr
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/boot/bl31.bin" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/boot/bl31.bin
@@ -70,12 +54,13 @@ makeinstall_target() {
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/splash.bmp" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/splash.bmp
[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/README_CONFIG.txt" ] && rm \${BOOT_ROOT}/${DISTRO_PATH}/README_CONFIG.txt
mkdir -p \${BOOT_ROOT}/${DISTRO_PATH}/boot
+[ -f "\${BOOT_ROOT}/${DISTRO_PATH}/storage/.config/retroarch/retroarch.cfg" ] && sed -i -e 's|input_player1_joypad_index = "2"|input_player1_joypad_index = "0"|' \${BOOT_ROOT}/${DISTRO_PATH}/storage/.config/retroarch/retroarch.cfg
cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/nx-plat.dtimg \${BOOT_ROOT}/${DISTRO_PATH}/
cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/README_CONFIG.txt \${BOOT_ROOT}/${DISTRO_PATH}/
cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/boot.scr \${BOOT_ROOT}/${DISTRO_PATH}/boot/
cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/bl31.bin \${BOOT_ROOT}/${DISTRO_PATH}/boot/
cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/bl33.bin \${BOOT_ROOT}/${DISTRO_PATH}/boot/
-cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/${DISTRO}.ini \${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini
+[ ! -f "\${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini" ] && cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/${DISTRO}.ini \${BOOT_ROOT}/bootloader/ini/${DISTRO}.ini
cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/splash.bmp \${BOOT_ROOT}/${DISTRO_PATH}/boot/
cp \${SYSTEM_ROOT}/usr/share/bootloader/boot/${DISTRO_ICON} \${BOOT_ROOT}/${DISTRO_PATH}/boot/
EOF
diff --git a/projects/L4T/devices/Switch/packages/switch-bsp/modprobe.d/xpadneo.conf b/projects/L4T/devices/Switch/packages/switch-bsp/modprobe.d/xpadneo.conf
new file mode 100644
index 00000000000..5eb9991ce81
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/modprobe.d/xpadneo.conf
@@ -0,0 +1,6 @@
+alias hid:b0005g*v0000045Ep000002E0 hid_xpadneo
+alias hid:b0005g*v0000045Ep000002FD hid_xpadneo
+alias hid:b0005g*v0000045Ep00000B05 hid_xpadneo
+alias hid:b0005g*v0000045Ep00000B13 hid_xpadneo
+alias hid:b0005g*v0000045Ep00000B20 hid_xpadneo
+alias hid:b0005g*v0000045Ep00000B22 hid_xpadneo
diff --git a/projects/L4T/devices/Switch/packages/switch-bsp/package.mk b/projects/L4T/devices/Switch/packages/switch-bsp/package.mk
new file mode 100755
index 00000000000..53fd46d301e
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/package.mk
@@ -0,0 +1,30 @@
+PKG_NAME="switch-bsp"
+PKG_VERSION="1.2"
+PKG_LICENSE="GPL"
+PKG_DEPENDS_TARGET="joycond rewritefs xdotool alsa-lib alsa-ucm-conf usb-gadget-scripts"
+PKG_SECTION="virtual"
+PKG_LONGDESC="LibreELEC Nintendo Switch Board Support"
+
+if [ ! "${DISTRO}" = "LibreELEC" ]; then
+ PKG_DEPENDS_TARGET+=" mergerfs v4l-utils" # We use this for CEC in lakka, in libreELEC kodi handles that via libCEC.
+fi
+
+post_install() {
+ enable_service xorg-configure-switch.service
+ enable_service var-bluetoothconfig.mount
+ enable_service pair-joycon.service
+ enable_service fix-permissions.service
+ enable_service alsa-init.service
+
+ mkdir -p ${INSTALL}/usr/bin
+ cp -Pv ${PKG_DIR}/scripts/pair-joycon.sh ${INSTALL}/usr/bin
+ cp -Pv ${PKG_DIR}/scripts/dock-hotplug ${INSTALL}/usr/bin
+ cp -pv ${PKG_DIR}/scripts/fix-sysfs-permissions.sh ${INSTALL}/usr/bin
+ mkdir -p ${INSTALL}/usr/share/alsa/ucm2
+ cp -Prv ${PKG_DIR}/ucm_data/* ${INSTALL}/usr/share/alsa/ucm2/
+
+ #Fix Script Permissions
+ chmod +x ${INSTALL}/usr/bin/pair-joycon.sh
+ chmod +x ${INSTALL}/usr/bin/dock-hotplug
+ chmod +x ${INSTALL}/usr/bin/fix-sysfs-permissions.sh
+}
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/scripts/dock-hotplug b/projects/L4T/devices/Switch/packages/switch-bsp/scripts/dock-hotplug
similarity index 70%
rename from projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/scripts/dock-hotplug
rename to projects/L4T/devices/Switch/packages/switch-bsp/scripts/dock-hotplug
index 5b2a928d2a0..b86112fa5e5 100755
--- a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/scripts/dock-hotplug
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/scripts/dock-hotplug
@@ -22,7 +22,7 @@ dock_hotplug_handle() {
do
if [ ! -e "$x" ]; then continue; fi
export DISPLAY=":${x#X}"
- PULSE_SERVER="127.0.0.1"
+ export PULSE_SERVER="127.0.0.1"
if [[ "$1" -eq 1 ]]
then
@@ -37,17 +37,6 @@ dock_hotplug_handle() {
# Reapply config to avoid X stubbornness.
sleep 0.2
xrandr --output DSI-0 --off --output DP-0 $DP_SETTINGS
-
- #AutoSwitch CPU/GPU profiles
- if [ ! "$(cat /proc/cmdline | grep dock_freq_switch_enabled=1)" = "" ]; then
- if [ "$(cpu-profile get)" = "Stock Performance" ]; then
- cpu-profile set "Maximum Performance"
- fi
-
- if [ "$(gpu-profile get)" = "Handheld Stock Mode" ]; then
- gpu-profile set "Docked Stock Mode"
- fi
- fi
else
xrandr --output DSI-0 --primary --mode 720x1280 --rotate left --panning 1280x720+0+0 --pos 0x0 --dpi 237 --output DP-0 --off
pactl set-card-profile 1 HiFi
@@ -59,17 +48,7 @@ dock_hotplug_handle() {
# Reapply config to avoid X stubbornness.
sleep 0.2
xrandr --output DP-0 --off --output DSI-0 --primary --mode 720x1280 --rotate left --panning 1280x720+0+0 --pos 0x0 --dpi 237
- #AutoSwitch CPU/GPU profiles
- if [ ! "$(cat /proc/cmdline | grep dock_freq_switch_enabled=1)" = "" ]; then
- if [ "$(cpu-profile get)" = "Maximum Performance" ]; then
- cpu-profile set "Stock Performance"
- fi
-
- if [ "$(gpu-profile get)" = "Docked Stock Mode" ]; then
- gpu-profile set "Handheld Stock Mode"
- fi
- fi
- fi
+ fi
done
# Wait for X to set current resolution.
@@ -90,10 +69,12 @@ if [[ "$1" -eq 1 ]]; then LOOPS=5; fi
while [ "$i" -le "$LOOPS" ]; do
if grep -q 1 "/sys/class/switch/dp/state"; then DP_ENABLED=1; else DP_ENABLED=0; fi
- # Prepare CEC info.
- if [ ! "$(cat /proc/cmdline | grep cec_enabled=1)" = "" ]; then
- if [[ "$DP_ENABLED" -eq 0 ]]; then cec-ctl -C
- else cec-ctl -s -o NintendoSwitch --playback --active-source phys-addr="$(cec-ctl | sed -n 's/.*Physical Address.*: //p')"; fi
+ # Prepare CEC info. ignore if libreelec, kodi will handle this.
+ if [ "$(cat /etc/os-release | grep LibreELEC)" = "" ]; then
+ if [ -f /tmp/.CEC ]; then
+ if [[ "$DP_ENABLED" -eq 0 ]]; then cec-ctl -C
+ else cec-ctl -s -o NintendoSwitch --playback --active-source phys-addr="$(cec-ctl | sed -n 's/.*Physical Address.*: //p')"; fi
+ fi
fi
# Configure dock
diff --git a/projects/L4T/devices/Switch/packages/switch-bsp/scripts/fix-sysfs-permissions.sh b/projects/L4T/devices/Switch/packages/switch-bsp/scripts/fix-sysfs-permissions.sh
new file mode 100755
index 00000000000..a8187ead148
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/scripts/fix-sysfs-permissions.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+#Allow all users to take advantage of changing Clock stuff, and setting R2P stuff.
+
+#CPU
+/usr/bin/busybox chmod 766 /sys/kernel/tegra_cpufreq/overclock
+/usr/bin/busybox chmod 766 /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
+/usr/bin/busybox chmod 766 /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
+/usr/bin/busybox chmod 766 /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
+
+#GPU
+/usr/bin/busybox chmod 766 /sys/devices/57000000.gpu/devfreq/57000000.gpu/governor
+/usr/bin/busybox chmod 766 /sys/devices/57000000.gpu/devfreq/57000000.gpu/max_freq
+/usr/bin/busybox chmod 766 /sys/devices/57000000.gpu/devfreq/57000000.gpu/min_freq
+
+#Bluetooth ERTM disable toggle
+/usr/bin/busybox chmod 766 /sys/module/bluetooth/parameters/disable_ertm
+
+#R2P
+/usr/bin/busybox chmod 766 /sys/module/pmc_r2p/parameters/enabled
+/usr/bin/busybox chmod 766 /sys/module/pmc_r2p/parameters/action
+/usr/bin/busybox chmod 766 /sys/module/pmc_r2p/parameters/entry_id
+/usr/bin/busybox chmod 766 /sys/module/pmc_r2p/parameters/param1
+/usr/bin/busybox chmod 766 /sys/module/pmc_r2p/parameters/param2
+
+#Brightness
+/usr/bin/busybox chmod 766 /sys/class/backlight/backlight/brightness
diff --git a/projects/L4T/devices/Switch/packages/switch-bsp/scripts/pair-joycon.sh b/projects/L4T/devices/Switch/packages/switch-bsp/scripts/pair-joycon.sh
new file mode 100755
index 00000000000..b8ca2546afc
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/scripts/pair-joycon.sh
@@ -0,0 +1,216 @@
+#!/bin/bash
+
+if [[ -f /flash/switchroot/joycon_mac.ini ]]; then
+ # Collect joycon_00 info from ini
+ JOYCON_00_TYPE=$(sed -nr "/^\[joycon_00\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n" )
+ JOYCON_00_MAC=$(sed -nr "/^\[joycon_00\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_00_HOST_MAC=$(sed -nr "/^\[joycon_00\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_00_LTK=$(sed -nr "/^\[joycon_00\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ if [[ -z ${JOYCON_00_TYPE} ]]; then
+ JOYCON_00_TYPE="0"
+ fi
+
+ # collect joycon_01 info from ini
+ JOYCON_01_TYPE=$(sed -nr "/^\[joycon_01\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_01_MAC=$(sed -nr "/^\[joycon_01\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_01_HOST_MAC=$(sed -nr "/^\[joycon_01\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_01_LTK=$(sed -nr "/^\[joycon_01\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ if [[ -z ${JOYCON_01_TYPE} ]]; then
+ JOYCON_01_TYPE="0"
+ fi
+
+ # Collect joycon_02 info from ini
+ JOYCON_02_TYPE=$(sed -nr "/^\[joycon_02\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_02_MAC=$(sed -nr "/^\[joycon_02\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_02_HOST_MAC=$(sed -nr "/^\[joycon_02\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ JOYCON_02_LTK=$(sed -nr "/^\[joycon_02\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
+ if [[ -z ${JOYCON_02_TYPE} ]]; then
+ JOYCON_02_TYPE="0"
+ fi
+
+ # Handle Host BT MAC. Agnostically.
+ if [[ ! ${JOYCON_00_TYPE} == "0" ]]; then
+ BT_MAC_ADDR=${JOYCON_00_HOST_MAC}
+ elif [[ ! ${JOYCON_01_TYPE} == "0" ]]; then
+ BT_MAC_ADDR=${JOYCON_01_HOST_MAC}
+ fi
+ # Handle Joycon Pair data.
+ if [[ ${JOYCON_00_TYPE} == "1" ]]; then
+ BT_DEV_00_NAME="Joy-Con (L)"
+ BT_DEV_00_ID=8198
+ BT_DEV_00_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
+ elif [[ ${JOYCON_00_TYPE} == "2" ]]; then
+ BT_DEV_00_NAME="Joy-Con (R)"
+ BT_DEV_00_ID=8199
+ BT_DEV_00_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
+ elif [[ ${JOYCON_00_TYPE} == "3" ]]; then
+ BT_DEV_01_NAME="Pro Controller"
+ BT_DEV_01_ID=8201
+ BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920090902030900010902042801090205090002"
+ fi
+
+ if [[ ${JOYCON_01_TYPE} == "1" ]]; then
+ BT_DEV_01_NAME="Joy-Con (L)"
+ BT_DEV_01_ID=8198
+ BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
+ elif [[ ${JOYCON_01_TYPE} == "2" ]]; then
+ BT_DEV_01_NAME="Joy-Con (R)"
+ BT_DEV_01_ID=8199
+ BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
+ elif [[ ${JOYCON_01_TYPE} == "3" ]]; then
+ BT_DEV_01_NAME="Pro Controller"
+ BT_DEV_01_ID=8201
+ BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920090902030900010902042801090205090002"
+ fi
+
+ if [[ ${JOYCON_02_TYPE} == "1" ]]; then
+ BT_DEV_02_NAME="Joy-Con (L)"
+ BT_DEV_02_ID=8198
+ BT_DEV_02_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
+ elif [[ ${JOYCON_02_TYPE} == "2" ]]; then
+ BT_DEV_02_NAME="Joy-Con (R)"
+ BT_DEV_02_ID=8199
+ BT_DEV_02_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
+ elif [[ ${JOYCON_02_TYPE} == "3" ]]; then
+ BT_DEV_02_NAME="Pro Controller"
+ BT_DEV_02_ID=8201
+ BT_DEV_02_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
+0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
+0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920090902030900010902042801090205090002"
+ fi
+
+ if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/cache ]]; then
+ mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/cache
+ fi
+
+ if [[ ! ${JOYCON_00_TYPE} == "0" ]]; then
+ if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC} ]] || [[ ! $(grep -q ${JOYCON_00_LTK} /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}/info; echo $?) -eq 0 ]]; then
+ mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}
+ cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}/info
+[General]
+Name=${BT_DEV_00_NAME}
+Class=0x000508
+SupportedTechnologies=BR/EDR;
+Trusted=true
+Blocked=false
+Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;
+[LinkKey]
+Key=${JOYCON_00_LTK}
+Type=4
+PINLength=0
+
+[DeviceID]
+Source=2
+Vendor=1406
+Product=${BT_DEV_00_ID}
+Version=1
+
+[ConnectionParameters]
+MinInterval=5
+MaxInterval=15
+Latency=120
+Timeout=600
+EOF
+ cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_00_MAC}
+[General]
+Name=${BT_DEV_00_NAME}
+
+[ServiceRecords]
+${BT_DEV_00_SERVICE_RECORDS}
+EOF
+ fi
+ fi
+
+ if [[ ! ${JOYCON_01_TYPE} == "0" ]]; then
+ if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC} ]] || [[ ! $(grep -q ${JOYCON_01_LTK} /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}/info; echo $?) -eq 0 ]]; then
+ mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}
+ cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}/info
+[General]
+Name=${BT_DEV_01_NAME}
+Class=0x000508
+SupportedTechnologies=BR/EDR;
+Trusted=true
+Blocked=false
+Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;
+[LinkKey]
+Key=${JOYCON_01_LTK}
+Type=4
+PINLength=0
+
+[DeviceID]
+Source=2
+Vendor=1406
+Product=${BT_DEV_01_ID}
+Version=1
+
+[ConnectionParameters]
+MinInterval=5
+MaxInterval=15
+Latency=120
+Timeout=600
+EOF
+ cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_01_MAC}
+[General]
+Name=${BT_DEV_01_NAME}
+
+[ServiceRecords]
+${BT_DEV_01_SERVICE_RECORDS}
+EOF
+
+ fi
+ fi
+ if [[ ! ${JOYCON_02_TYPE} == "0" ]]; then
+ if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_02_MAC} ]] || [[ ! $(grep -q ${JOYCON_02_LTK} /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_02_MAC}/info; echo $?) -eq 0 ]]; then
+ mkdir -p /var/bluetoothconfig/bluetooth/${BT_MAC_ADDR}/${JOYCON_02_MAC}
+ cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_02_MAC}/info
+[General]
+Name=${BT_DEV_02_NAME}
+Class=0x002508
+SupportedTechnologies=BR/EDR;
+Trusted=true
+Blocked=false
+Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;
+[LinkKey]
+Key=${JOYCON_02_LTK}
+Type=4
+PINLength=0
+
+[DeviceID]
+Source=2
+Vendor=1406
+Product=${BT_DEV_02_ID}
+Version=1
+
+[ConnectionParameters]
+MinInterval=5
+MaxInterval=15
+Latency=120
+Timeout=600
+EOF
+ cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_02_MAC}
+[General]
+Name=${BT_DEV_02_NAME}
+
+[ServiceRecords]
+${BT_DEV_02_SERVICE_RECORDS}
+EOF
+
+ fi
+ fi
+fi
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/sleep.d/99-Nintendo-Switch-Suspend.sh b/projects/L4T/devices/Switch/packages/switch-bsp/sleep.d/99-Nintendo-Switch-Suspend.sh
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/sleep.d/99-Nintendo-Switch-Suspend.sh
rename to projects/L4T/devices/Switch/packages/switch-bsp/sleep.d/99-Nintendo-Switch-Suspend.sh
diff --git a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/system.d/alsa-init.service b/projects/L4T/devices/Switch/packages/switch-bsp/system.d/alsa-init.service
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/system.d/alsa-init.service
rename to projects/L4T/devices/Switch/packages/switch-bsp/system.d/alsa-init.service
diff --git a/projects/L4T/devices/Switch/packages/switch-bsp/system.d/fix-permissions.service b/projects/L4T/devices/Switch/packages/switch-bsp/system.d/fix-permissions.service
new file mode 100644
index 00000000000..0df8e0e33d5
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/system.d/fix-permissions.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Fix permissions on sysfs nodes.
+Before=graphical.target kodi.service retroarch.service
+After=multi-user.target
+After=xorg.service
+
+[Service]
+Environment=TERM=linux
+Type=oneshot
+ExecStart=/usr/bin/fix-sysfs-permissions.sh
+StandardError=journal
+RemainAfterExit=no
+
+[Install]
+WantedBy=graphical.target
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/system.d/pair-joycon.service b/projects/L4T/devices/Switch/packages/switch-bsp/system.d/pair-joycon.service
similarity index 91%
rename from projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/system.d/pair-joycon.service
rename to projects/L4T/devices/Switch/packages/switch-bsp/system.d/pair-joycon.service
index ab88e5fc1ea..41ca5669188 100644
--- a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/system.d/pair-joycon.service
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/system.d/pair-joycon.service
@@ -7,7 +7,7 @@ Before=bluetooth.service
Environment=TERM=linux
Type=oneshot
ExecStart=/usr/bin/pair-joycon.sh
-StandardError=syslog
+StandardError=journal
RemainAfterExit=no
[Install]
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/system.d/var-bluetoothconfig.mount b/projects/L4T/devices/Switch/packages/switch-bsp/system.d/var-bluetoothconfig.mount
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/system.d/var-bluetoothconfig.mount
rename to projects/L4T/devices/Switch/packages/switch-bsp/system.d/var-bluetoothconfig.mount
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/system.d/xorg-configure-switch.service b/projects/L4T/devices/Switch/packages/switch-bsp/system.d/xorg-configure-switch.service
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/system.d/xorg-configure-switch.service
rename to projects/L4T/devices/Switch/packages/switch-bsp/system.d/xorg-configure-switch.service
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/tmpfiles.d/mount-bluez-fs.conf b/projects/L4T/devices/Switch/packages/switch-bsp/tmpfiles.d/mount-bluez-fs.conf
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/tmpfiles.d/mount-bluez-fs.conf
rename to projects/L4T/devices/Switch/packages/switch-bsp/tmpfiles.d/mount-bluez-fs.conf
diff --git a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/ucm_data/tegra-snd-t210r/HiFi.conf b/projects/L4T/devices/Switch/packages/switch-bsp/ucm_data/tegra-snd-t210r/HiFi.conf
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/ucm_data/tegra-snd-t210r/HiFi.conf
rename to projects/L4T/devices/Switch/packages/switch-bsp/ucm_data/tegra-snd-t210r/HiFi.conf
diff --git a/projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/ucm_data/tegra-snd-t210r/tegra-snd-t210r.conf b/projects/L4T/devices/Switch/packages/switch-bsp/ucm_data/tegra-snd-t210r/tegra-snd-t210r.conf
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-alsa-ucm-configs/ucm_data/tegra-snd-t210r/tegra-snd-t210r.conf
rename to projects/L4T/devices/Switch/packages/switch-bsp/ucm_data/tegra-snd-t210r/tegra-snd-t210r.conf
diff --git a/projects/L4T/devices/Switch/packages/switch-bsp/udev.d/50-xpadneo-fixup-steamlink.rules b/projects/L4T/devices/Switch/packages/switch-bsp/udev.d/50-xpadneo-fixup-steamlink.rules
new file mode 100644
index 00000000000..b06bda42c96
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/udev.d/50-xpadneo-fixup-steamlink.rules
@@ -0,0 +1,2 @@
+#FIXME(issue-291) Work around Steamlink not properly detecting the mappings
+ACTION=="add|change", DRIVERS=="xpadneo", SUBSYSTEM=="hidraw", MODE:="0000"
diff --git a/projects/L4T/devices/Switch/packages/switch-bsp/udev.d/60-xpadneo.rules b/projects/L4T/devices/Switch/packages/switch-bsp/udev.d/60-xpadneo.rules
new file mode 100644
index 00000000000..bc65bfd3f26
--- /dev/null
+++ b/projects/L4T/devices/Switch/packages/switch-bsp/udev.d/60-xpadneo.rules
@@ -0,0 +1,2 @@
+ACTION=="add", KERNEL=="0005:045E:02FD.*|0005:045E:02E0.*|0005:045E:0B05.*|0005:045E:0B13.*|0005:045E:0B20.*|0005:045E:0B22.*", SUBSYSTEM=="hid", DRIVER!="xpadneo", ATTR{driver/unbind}="%k", ATTR{[drivers/hid:xpadneo]bind}="%k"
+ACTION=="add|change", DRIVERS=="xpadneo", SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="1", TAG+="uaccess", MODE="0664", ENV{LIBINPUT_IGNORE_DEVICE}="1"
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/udev.d/93-dock_hotplug.rules b/projects/L4T/devices/Switch/packages/switch-bsp/udev.d/93-dock_hotplug.rules
similarity index 100%
rename from projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/udev.d/93-dock_hotplug.rules
rename to projects/L4T/devices/Switch/packages/switch-bsp/udev.d/93-dock_hotplug.rules
diff --git a/projects/L4T/devices/Switch/packages/switch-cpu-profile/package.mk b/projects/L4T/devices/Switch/packages/switch-cpu-profile/package.mk
deleted file mode 100644
index 01bfead6eb2..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-cpu-profile/package.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-PKG_NAME="switch-cpu-profile"
-PKG_VERSION="1.1"
-PKG_DEPENDS_TARGET="Python3"
-PKG_TOOLCHAIN="manual"
-
-makeinstall_target() {
- mkdir -p ${INSTALL}/usr/bin
- #cp -v ${PKG_DIR}/scripts/cpu-profile ${INSTALL}/usr/bin
- touch ${INSTALL}/usr/bin/cpu-profile
- chmod +x ${INSTALL}/usr/bin/cpu-profile
-}
-
-post_install() {
- enable_service switch-cpu-profile.service
-}
diff --git a/projects/L4T/devices/Switch/packages/switch-cpu-profile/scripts/cpu-profile b/projects/L4T/devices/Switch/packages/switch-cpu-profile/scripts/cpu-profile
deleted file mode 100755
index cab3b527fbf..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-cpu-profile/scripts/cpu-profile
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/python
-
-import sys
-
-'''
-This is a script to manage the Switch CPU clock profiles. When shutting down, the current profile is lost -
-therefore, this script must be called at each reboot to restore the default profile.
-
-Written by natinusala for Lakka. See print_usage() for usage.
-
-For now the profile is not retained and is set to default speed when rebooting.
-'''
-
-# File corresponding to the current profile
-PROFILE_FILE = "/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq"
-OVERCLOCK_FILE = "/sys/kernel/tegra_cpufreq/overclock"
-SAVED_PROFILE_FILE = "/storage/.config/.cpu_profile"
-
-# Profiles list, in KHz - max 2091000
-PROFILES = {
- "Max Overdrive +3": "2091000",
- "Max Overdrive +2": "1989000",
- "Max Overdrive +1": "1887000",
- "Maximum Performance": "1785000",
- "High Performance": "1581000",
- "Boost Performance": "1224000",
- "Stock Performance": "1020000",
- "Powersaving Mode 1": "918000",
- "Powersaving Mode 2": "816000",
- "Powersaving Mode 3": "714000",
-}
-
-# Default profile
-DEFAULT_PROFILE = "Stock Performance"
-
-def get_saved_profile():
- try:
- f=open(SAVED_PROFILE_FILE, "r")
- except IOError:
- return DEFAULT_PROFILE
- NEW_DEFAULT_PROFILE = str(f.read().strip())
- if NEW_DEFAULT_PROFILE == '':
- return DEFAULT_PROFILE
- else:
- return NEW_DEFAULT_PROFILE
-
-def save_profile(profile):
- with open(SAVED_PROFILE_FILE, "w") as f:
- f.write(profile)
- f.flush()
-
-def get_profile():
- with open(PROFILE_FILE, "r") as f:
- pstate = str(f.read().strip())
-
- profile_code = pstate
-
- for profile in PROFILES:
- if profile_code == PROFILES[profile]:
- return profile
-
- raise Exception("Unknown profile code %s" % profile_code)
-
-
-def apply_profile(profile):
- if profile not in PROFILES:
- raise Exception("Unknown profile %s" % profile)
-
- with open(PROFILE_FILE, "w") as f:
- f.write(PROFILES[profile])
- f.flush()
- print(("Applied profile %s" % profile))
-
-
-def unlock_full_power():
- with open(OVERCLOCK_FILE, "w") as f:
- f.write("1")
- f.flush()
- print("Granted overclock access")
-
-
-def print_usage():
- print('''
- Usage :
- cpu-profile init
- Sets the default profile - should be called on boot
-
- cpu-profile list
- Lists all the available profiles and their corresponding frequency
-
- cpu-profile set
- Sets the current profile to
-
- cpu-profile get
- Gets the current profile name
- ''')
-
-
-def print_profiles():
- print("Format : - [* : enabled] [d : reboot default]")
-
- max_profile_name_length = max([len(x) for x in list(PROFILES.keys())])
-
- current_profile = get_profile()
-
- for profile in reversed(list(PROFILES.keys())):
- profile_name = profile
- profile_freq = PROFILES[profile]
- is_default = (profile_name == DEFAULT_PROFILE)
- is_current = (current_profile == profile_name)
- padding = " " * (max_profile_name_length - len(profile_name))
- print("%s%s - %s %s %s" % (profile_name, padding, profile_freq, "*" if is_current else " ", "d" if is_default else ""))
-
-
-# Main
-if __name__ == "__main__":
- argc = len(sys.argv)
- if argc == 2:
- if sys.argv[1] == "init":
- apply_profile(get_saved_profile())
- unlock_full_power()
- elif sys.argv[1] == "get":
- print(get_profile())
- elif sys.argv[1] == "list":
- print_profiles()
- else:
- print_usage()
- elif argc == 3:
- if sys.argv[1] == "set":
- apply_profile(sys.argv[2])
- save_profile(sys.argv[2])
- else:
- print_usage()
- else:
- print_usage()
diff --git a/projects/L4T/devices/Switch/packages/switch-cpu-profile/system.d/switch-cpu-profile.service b/projects/L4T/devices/Switch/packages/switch-cpu-profile/system.d/switch-cpu-profile.service
deleted file mode 100644
index 6b1123473b6..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-cpu-profile/system.d/switch-cpu-profile.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Switch CPU Profile
-ConditionKernelCommandLine=!installer
-Requires=xorg.service
-After=xorg.service
-
-[Service]
-Environment=TERM=linux
-Type=oneshot
-ExecStart=/usr/bin/cpu-profile init
-StandardError=syslog
-RemainAfterExit=no
-
-[Install]
-WantedBy=graphical.target
diff --git a/projects/L4T/devices/Switch/packages/switch-gpu-profile/package.mk b/projects/L4T/devices/Switch/packages/switch-gpu-profile/package.mk
deleted file mode 100644
index 24ca5c969c8..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-gpu-profile/package.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-PKG_NAME="switch-gpu-profile"
-PKG_VERSION="1.1"
-PKG_DEPENDS_TARGET="Python3"
-PKG_TOOLCHAIN="manual"
-
-makeinstall_target() {
- mkdir -p ${INSTALL}/usr/bin
- #cp -v ${PKG_DIR}/scripts/gpu-profile ${INSTALL}/usr/bin
- touch ${INSTALL}/usr/bin/cpu-profile
- chmod +x ${INSTALL}/usr/bin/cpu-profile
-
-}
-
-post_install() {
- enable_service switch-gpu-profile.service
-}
diff --git a/projects/L4T/devices/Switch/packages/switch-gpu-profile/scripts/gpu-profile b/projects/L4T/devices/Switch/packages/switch-gpu-profile/scripts/gpu-profile
deleted file mode 100755
index 512ba0d426b..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-gpu-profile/scripts/gpu-profile
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/python
-
-import sys
-
-'''
-This is a script to manage the Switch GPU clock profiles. When shutting down, the current profile is lost -
-therefore, this script must be called at each reboot to restore the default profile.
-
-Written by natinusala for Lakka. See print_usage() for usage.
-
-For now the profile is not retained and is set to default non-docked speed when rebooting.
-
-L4T variant.
-'''
-
-# File corresponding to the current profile
-PROFILE_FILE_MAX = "/sys/devices/57000000.gpu/devfreq/57000000.gpu/max_freq"
-PROFILE_FILE_MIN = "/sys/devices/57000000.gpu/devfreq/57000000.gpu/min_freq"
-SAVED_PROFILE_FILE = "/storage/.config/.gpu_profile"
-
-# Profiles list
-PROFILES = {
- "Docked Stock +2": "921600000", # 921 Mhz
- "Docked Stock +1": "844800000", # 844 Mhz
- "Docked Stock Mode": "768000000", # 768 Mhz
- "Handheld Boost +3": "691200000", # 691 Mhz
- "Handheld Boost +2": "614400000", # 614 Mhz
- "Handheld Boost +1": "537600000", # 537 Mhz
- "Handheld Boost Mode": "460800000", # 460 Mhz
- "Handheld Stock +1": "384000000", # 384 Mhz
- "Handheld Stock Mode": "307200000", # 307 Mhz
- "Powersaving +2": "230400000", # 230 Mhz
- "Powersaving +1": "153600000", # 153 Mhz
- "Powersaving Mode": "76800000", # 76 Mhz
-}
-
-# Default profile
-DEFAULT_PROFILE = "Handheld Stock Mode"
-
-def get_saved_profile():
- try:
- f=open(SAVED_PROFILE_FILE, "r")
- except IOError:
- return DEFAULT_PROFILE
- NEW_DEFAULT_PROFILE = str(f.read().strip())
- if NEW_DEFAULT_PROFILE == '':
- return DEFAULT_PROFILE
- else:
- return NEW_DEFAULT_PROFILE
-
-def save_profile(profile):
- with open(SAVED_PROFILE_FILE, "w") as f:
- f.write(profile)
- f.flush()
-
-def get_profile():
- with open(PROFILE_FILE_MAX, "r") as f:
- pstate = str(f.read().strip())
-
- for profile in PROFILES:
- if pstate == PROFILES[profile]:
- return profile
-
- raise Exception("Unknown profile %s" % pstate)
-
-
-
-def apply_profile(profile):
- if profile not in PROFILES:
- raise Exception("Unknown profile %s" % profile)
-
- files = []
- cur_profile = int(PROFILES[get_profile()])
- new_profile = int(PROFILES[profile])
-
- if new_profile < cur_profile:
- files = [
- PROFILE_FILE_MIN,
- PROFILE_FILE_MAX
- ]
- else:
- files = [
- PROFILE_FILE_MAX,
- PROFILE_FILE_MIN
- ]
-
- for pfile in files:
- with open(pfile, "w") as f:
- f.write(PROFILES[profile])
- f.flush()
- print(("Applied profile %s" % profile))
-
-
-
-def print_usage():
- print('''
- Usage :
- gpu-profile init
- Sets the default profile - should be called on boot
-
- gpu-profile set
- Sets the current profile to
-
- gpu-profile get
- Gets the current profile name
- ''')
-
-
-# Main
-if __name__ == "__main__":
- argc = len(sys.argv)
- if argc == 2:
- if sys.argv[1] == "init":
- apply_profile(get_saved_profile())
- elif sys.argv[1] == "get":
- print(get_profile())
- else:
- print_usage()
- elif argc == 3:
- if sys.argv[1] == "set":
- apply_profile(sys.argv[2])
- save_profile(sys.argv[2])
- else:
- print_usage()
- else:
- print_usage()
diff --git a/projects/L4T/devices/Switch/packages/switch-gpu-profile/system.d/switch-gpu-profile.service b/projects/L4T/devices/Switch/packages/switch-gpu-profile/system.d/switch-gpu-profile.service
deleted file mode 100644
index 3e2cfbf27d6..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-gpu-profile/system.d/switch-gpu-profile.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Switch GPU Profile
-ConditionKernelCommandLine=!installer
-Requires=xorg.service
-After=xorg.service
-
-[Service]
-Environment=TERM=linux
-Type=oneshot
-ExecStart=/usr/bin/gpu-profile init
-StandardError=syslog
-RemainAfterExit=no
-
-[Install]
-WantedBy=graphical.target
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/package.mk b/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/package.mk
deleted file mode 100755
index 33fb00ca591..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/package.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-PKG_NAME="switch-joycon-bluetooth-dock-configs"
-PKG_LICENSE="GPL"
-PKG_DEPENDS_TARGET="joycond rewritefs xdotool"
-PKG_SECTION="virtual"
-PKG_LONGDESC="Scripts for docking, and pairing joycons. Bluez config mount"
-
-post_install() {
- enable_service xorg-configure-switch.service
- enable_service var-bluetoothconfig.mount
- enable_service pair-joycon.service
-
- mkdir -p ${INSTALL}/usr/bin
- cp -Pv ${PKG_DIR}/scripts/pair-joycon.sh ${INSTALL}/usr/bin
- cp -Pv ${PKG_DIR}/scripts/dock-hotplug ${INSTALL}/usr/bin
- chmod +x ${INSTALL}/usr/bin/pair-joycon.sh
- chmod +x ${INSTALL}/usr/bin/dock-hotplug
-
-}
diff --git a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/scripts/pair-joycon.sh b/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/scripts/pair-joycon.sh
deleted file mode 100755
index d02dea18a1c..00000000000
--- a/projects/L4T/devices/Switch/packages/switch-joycon-bluetooth-dock-configs/scripts/pair-joycon.sh
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/bin/bash
-
-if [[ -f /flash/switchroot/joycon_mac.ini ]]; then
- # Collect joycon_00 info from ini
- JOYCON_00_TYPE=$(sed -nr "/^\[joycon_00\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n" )
- JOYCON_00_MAC=$(sed -nr "/^\[joycon_00\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
- JOYCON_00_HOST_MAC=$(sed -nr "/^\[joycon_00\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
- JOYCON_00_LTK=$(sed -nr "/^\[joycon_00\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
-
- # collect joycon_00 info from ini
- JOYCON_01_TYPE=$(sed -nr "/^\[joycon_01\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
- JOYCON_01_MAC=$(sed -nr "/^\[joycon_01\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
- JOYCON_01_HOST_MAC=$(sed -nr "/^\[joycon_01\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
- JOYCON_01_LTK=$(sed -nr "/^\[joycon_01\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
-
- # Handle Host BT MAC. Agnostically.
- if [[ ! ${JOYCON_00_TYPE} == "0" ]]; then
- BT_MAC_ADDR=${JOYCON_00_HOST_MAC}
- elif [[ ! ${JOYCON_01_TYPE} == "0" ]]; then
- BT_MAC_ADDR=${JOYCON_01_HOST_MAC}
- fi
- # Handle Joycon Pair data.
- if [[ ${JOYCON_00_TYPE} == "1" ]]; then
- BT_DEV_00_NAME="Joy-Con (L)"
- BT_DEV_00_ID=8198
- BT_DEV_00_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
-0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
-0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
- elif [[ ${JOYCON_00_TYPE} == "2" ]]; then
- BT_DEV_00_NAME="Joy-Con (R)"
- BT_DEV_00_ID=8199
- BT_DEV_00_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
-0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
-0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
- fi
-
- if [[ ${JOYCON_01_TYPE} == "1" ]]; then
- BT_DEV_01_NAME="Joy-Con (L)"
- BT_DEV_01_ID=8198
- BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
-0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
-0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
- elif [[ ${JOYCON_01_TYPE} == "2" ]]; then
- BT_DEV_01_NAME="Joy-Con (R)"
- BT_DEV_01_ID=8199
- BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
-0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
-0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
- fi
- if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/cache ]]; then
- mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/cache
- fi
-
- if [[ ! ${JOYCON_00_TYPE} == "0" ]]; then
- if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC} ]]; then
- mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}
- cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}/info
-[General]
-Name=${BT_DEV_00_NAME}
-Class=0x000508
-SupportedTechnologies=BR/EDR;
-Trusted=true
-Blocked=false
-Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;
-[LinkKey]
-Key=${JOYCON_00_LTK}
-Type=4
-PINLength=0
-
-[DeviceID]
-Source=2
-Vendor=1406
-Product=${BT_DEV_00_ID}
-Version=1
-
-[ConnectionParameters]
-MinInterval=5
-MaxInterval=15
-Latency=120
-Timeout=600
-EOF
- cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_00_MAC}
-[General]
-Name=${BT_DEV_00_NAME}
-
-[ServiceRecords]
-${BT_DEV_00_SERVICE_RECORDS}
-EOF
- fi
- fi
-
- if [[ ! ${JOYCON_01_TYPE} == "0" ]]; then
- if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC} ]]; then
- mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}
- cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}/info
-[General]
-Name=${BT_DEV_01_NAME}
-Class=0x000508
-SupportedTechnologies=BR/EDR;
-Trusted=true
-Blocked=false
-Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;
-[LinkKey]
-Key=${JOYCON_01_LTK}
-Type=4
-PINLength=0
-
-[DeviceID]
-Source=2
-Vendor=1406
-Product=${BT_DEV_01_ID}
-Version=1
-
-[ConnectionParameters]
-MinInterval=5
-MaxInterval=15
-Latency=120
-Timeout=600
-EOF
- cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_01_MAC}
-[General]
-Name=${BT_DEV_01_NAME}
-
-[ServiceRecords]
-${BT_DEV_01_SERVICE_RECORDS}
-EOF
-
- fi
- fi
-fi
diff --git a/projects/L4T/devices/Switch/packages/switch-u-boot/package.mk b/projects/L4T/devices/Switch/packages/switch-u-boot/package.mk
index 12a7464b956..821ea9d7fc0 100644
--- a/projects/L4T/devices/Switch/packages/switch-u-boot/package.mk
+++ b/projects/L4T/devices/Switch/packages/switch-u-boot/package.mk
@@ -1,9 +1,9 @@
PKG_NAME="switch-u-boot"
-PKG_VERSION="f6ee487cdf2a2efaf0cac8d1b3b003ea90fb1ef3"
+PKG_VERSION="2606ef5dfa14faedca16f2dcdea59719c7c963f7"
PKG_GIT_CLONE_BRANCH="linux-hekatf"
PKG_DEPENDS_HOST="toolchain Python3:host gcc:host swig:host"
PKG_DEPENDS_TARGET="toolchain Python3 gcc:target swig:host"
-PKG_SITE="https://gitlab.com/switchroot/switch-uboot"
+PKG_SITE="https://github.com/CTCaer/switch-l4t-uboot"
PKG_URL="${PKG_SITE}.git"
PKG_TOOLCHAIN="make"
diff --git a/projects/L4T/devices/Switch/packages/usb-gadget-scripts/package.mk b/projects/L4T/devices/Switch/packages/usb-gadget-scripts/package.mk
index 1d8de386b86..629d3e83467 100644
--- a/projects/L4T/devices/Switch/packages/usb-gadget-scripts/package.mk
+++ b/projects/L4T/devices/Switch/packages/usb-gadget-scripts/package.mk
@@ -1,4 +1,5 @@
PKG_NAME="usb-gadget-scripts"
+PKG_VERSION="2.0"
PKG_DEPENDS_TARGET="umtp-responder"
PKG_SHORTDESC="Nintendo Switch USB Gadget scripts, and configs"
PKG_TOOLCHAIN="manual"
diff --git a/projects/L4T/devices/Switch/patches/joycond/01-Fix-cmake-install.patch b/projects/L4T/devices/Switch/patches/joycond/01-Fix-cmake-install.patch
index a556227ac98..5aef961862b 100644
--- a/projects/L4T/devices/Switch/patches/joycond/01-Fix-cmake-install.patch
+++ b/projects/L4T/devices/Switch/patches/joycond/01-Fix-cmake-install.patch
@@ -6,7 +6,7 @@ diff -Naur joycond-031f04311a912514cea9deb020512ee6d7063398/CMakeLists.txt joyco
add_subdirectory(src)
-install(FILES joycond DESTINATION /usr/bin/
-+install(FILES .aarch64-libreelec-linux-gnueabi/joycond DESTINATION /usr/bin/
++install(FILES .aarch64-libreelec-linux-gnu/joycond DESTINATION /usr/bin/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES udev/89-joycond.rules udev/72-joycond.rules DESTINATION /lib/udev/rules.d/
diff --git a/projects/L4T/devices/Switch/patches/l4t-kernel-sources/04-Revert-arm64-32bit-sigcontext-definition-to-uapi-signcontext.h.patch b/projects/L4T/devices/Switch/patches/l4t-kernel-sources/04-Revert-arm64-32bit-sigcontext-definition-to-uapi-signcontext.h.patch
deleted file mode 100644
index 28578ef5505..00000000000
--- a/projects/L4T/devices/Switch/patches/l4t-kernel-sources/04-Revert-arm64-32bit-sigcontext-definition-to-uapi-signcontext.h.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From ae51813c1048c789057660b96dfbb1943432d663 Mon Sep 17 00:00:00 2001
-From: Ronald Brown
-Date: Mon, 12 Apr 2021 19:18:55 +0000
-Subject: [PATCH] Revert "arm64: Add 32-bit sigcontext definition to uapi
- signcontext.h"
-
-This reverts commit a868475f632336bd368ca40e3edafa70b5138181.
----
- arch/arm64/include/uapi/asm/sigcontext.h | 32 ------------------------
- 1 file changed, 32 deletions(-)
-
-diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
-index c731ca011ca3..ee469be1ae1d 100644
---- a/arch/arm64/include/uapi/asm/sigcontext.h
-+++ b/arch/arm64/include/uapi/asm/sigcontext.h
-@@ -16,7 +16,6 @@
- #ifndef _UAPI__ASM_SIGCONTEXT_H
- #define _UAPI__ASM_SIGCONTEXT_H
-
--#ifdef CONFIG_64BIT
- #include
-
- /*
-@@ -62,35 +61,4 @@ struct esr_context {
- __u64 esr;
- };
-
--#else /* CONFIG_64BIT */
--
--/*
-- * Signal context structure - contains all info to do with the state
-- * before the signal handler was invoked. Note: only add new entries
-- * to the end of the structure.
-- */
--struct sigcontext {
-- unsigned long trap_no;
-- unsigned long error_code;
-- unsigned long oldmask;
-- unsigned long arm_r0;
-- unsigned long arm_r1;
-- unsigned long arm_r2;
-- unsigned long arm_r3;
-- unsigned long arm_r4;
-- unsigned long arm_r5;
-- unsigned long arm_r6;
-- unsigned long arm_r7;
-- unsigned long arm_r8;
-- unsigned long arm_r9;
-- unsigned long arm_r10;
-- unsigned long arm_fp;
-- unsigned long arm_ip;
-- unsigned long arm_sp;
-- unsigned long arm_lr;
-- unsigned long arm_pc;
-- unsigned long arm_cpsr;
-- unsigned long fault_address;
--};
--#endif /* CONFIG_64BIT */
- #endif /* _UAPI__ASM_SIGCONTEXT_H */
---
-GitLab
-
diff --git a/projects/L4T/devices/Switch/patches/linux/0001-Fix-Volume-Mappings.patch b/projects/L4T/devices/Switch/patches/linux/0001-Fix-Volume-Mappings.patch
index 76186d2f177..afa97c5414b 100644
--- a/projects/L4T/devices/Switch/patches/linux/0001-Fix-Volume-Mappings.patch
+++ b/projects/L4T/devices/Switch/patches/linux/0001-Fix-Volume-Mappings.patch
@@ -1,22 +1,13 @@
-From ec7fa0e304bcd9be9e3b6e40f7bfa8e1a0042989 Mon Sep 17 00:00:00 2001
-From: Ronald Brown
-Date: Wed, 14 Apr 2021 08:02:49 -0700
-Subject: [PATCH] Change dts to fix volume mappings in lakka.
-
----
- .../nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi b/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi
-index 8c508ec9d413..b80774f5980c 100644
---- a/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi
-+++ b/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi
-@@ -23,13 +23,13 @@
+diff -Naur linux-Switch-5.1.0/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi linux-Switch-5.1.0-2/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi
+--- linux-Switch-5.1.0/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi 2023-04-12 07:00:12.773160197 +0200
++++ linux-Switch-5.1.0-2/nvidia/platform/t210/nx/kernel-dts/nx-platforms/tegra210-nx-keys.dtsi 2023-04-12 07:02:08.027831616 +0200
+@@ -37,14 +37,14 @@
volume_down {
label = "Volume Down";
gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
- linux,code = ;
+ linux,code = ;
+ debounce-interval = <16>;
};
volume_up {
@@ -24,9 +15,6 @@ index 8c508ec9d413..b80774f5980c 100644
gpios = <&gpio TEGRA_GPIO(X, 6) GPIO_ACTIVE_LOW>;
- linux,code = ;
+ linux,code = ;
+ debounce-interval = <16>;
};
};
- };
---
-GitLab
-
diff --git a/projects/L4T/devices/Switch/patches/linux/0004-fix-libcec-build.patch b/projects/L4T/devices/Switch/patches/linux/0004-fix-libcec-build.patch
new file mode 100644
index 00000000000..41e22bbf21a
--- /dev/null
+++ b/projects/L4T/devices/Switch/patches/linux/0004-fix-libcec-build.patch
@@ -0,0 +1,304 @@
+From 0dbacebede1e4e44bf500f94d692fad05eb2c293 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil
+Date: Wed, 2 Nov 2016 08:25:28 -0200
+Subject: [PATCH] [media] cec: move the CEC framework out of staging and to
+ media
+
+The last open issues have been addressed, so it is time to move
+this out of staging and into the mainline and to move the public
+cec headers to include/uapi/linux.
+
+Signed-off-by: Hans Verkuil
+Signed-off-by: Mauro Carvalho Chehab
+---
+ Documentation/media/Makefile | 2 +-
+ drivers/media/Kconfig | 16 ++++++++++++++++
+ drivers/media/Makefile | 4 ++++
+ drivers/{staging => }/media/cec/Makefile | 2 +-
+ drivers/{staging => }/media/cec/cec-adap.c | 0
+ drivers/{staging => }/media/cec/cec-api.c | 0
+ drivers/{staging => }/media/cec/cec-core.c | 0
+ drivers/{staging => }/media/cec/cec-priv.h | 0
+ drivers/media/i2c/Kconfig | 6 +++---
+ drivers/media/platform/vivid/Kconfig | 2 +-
+ drivers/staging/media/Kconfig | 2 --
+ drivers/staging/media/Makefile | 1 -
+ drivers/staging/media/cec/Kconfig | 12 ------------
+ drivers/staging/media/cec/TODO | 9 ---------
+ drivers/staging/media/pulse8-cec/Kconfig | 2 +-
+ drivers/staging/media/s5p-cec/Kconfig | 2 +-
+ drivers/staging/media/st-cec/Kconfig | 2 +-
+ include/media/cec.h | 2 +-
+ include/uapi/linux/Kbuild | 2 ++
+ include/{ => uapi}/linux/cec-funcs.h | 6 ------
+ include/{ => uapi}/linux/cec.h | 6 ------
+ 21 files changed, 32 insertions(+), 46 deletions(-)
+ rename drivers/{staging => }/media/cec/Makefile (70%)
+ rename drivers/{staging => }/media/cec/cec-adap.c (100%)
+ rename drivers/{staging => }/media/cec/cec-api.c (100%)
+ rename drivers/{staging => }/media/cec/cec-core.c (100%)
+ rename drivers/{staging => }/media/cec/cec-priv.h (100%)
+ delete mode 100644 drivers/staging/media/cec/Kconfig
+ delete mode 100644 drivers/staging/media/cec/TODO
+ rename include/{ => uapi}/linux/cec-funcs.h (99%)
+ rename include/{ => uapi}/linux/cec.h (99%)
+
+diff --git a/Documentation/media/Makefile b/Documentation/media/Makefile
+index a7fb35291f6c61..61afa052c501a1 100644
+--- a/Documentation/media/Makefile
++++ b/Documentation/media/Makefile
+@@ -51,7 +51,7 @@ $(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h ${PARSER} $(SRC_DIR)/videodev2.
+ $(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions
+ @$($(quiet)gen_rst)
+
+-$(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
++$(BUILDDIR)/cec.h.rst: ${UAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
+ @$($(quiet)gen_rst)
+
+ $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
+diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
+index 7b854029121731..bc643cbf813ef8 100644
+--- a/drivers/media/Kconfig
++++ b/drivers/media/Kconfig
+@@ -80,6 +80,22 @@ config MEDIA_RC_SUPPORT
+
+ Say Y when you have a TV or an IR device.
+
++config MEDIA_CEC_SUPPORT
++ bool "HDMI CEC support"
++ select MEDIA_CEC_EDID
++ ---help---
++ Enable support for HDMI CEC (Consumer Electronics Control),
++ which is an optional HDMI feature.
++
++ Say Y when you have an HDMI receiver, transmitter or a USB CEC
++ adapter that supports HDMI CEC.
++
++config MEDIA_CEC_DEBUG
++ bool "HDMI CEC debugfs interface"
++ depends on MEDIA_CEC_SUPPORT && DEBUG_FS
++ ---help---
++ Turns on the DebugFS interface for CEC devices.
++
+ config MEDIA_CEC_EDID
+ bool
+
+diff --git a/drivers/media/Makefile b/drivers/media/Makefile
+index 0deaa93efdee61..d87ccb8eeabe6b 100644
+--- a/drivers/media/Makefile
++++ b/drivers/media/Makefile
+@@ -6,6 +6,10 @@ ifeq ($(CONFIG_MEDIA_CEC_EDID),y)
+ obj-$(CONFIG_MEDIA_SUPPORT) += cec-edid.o
+ endif
+
++ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
++ obj-$(CONFIG_MEDIA_SUPPORT) += cec/
++endif
++
+ media-objs := media-device.o media-devnode.o media-entity.o
+
+ #
+diff --git a/drivers/staging/media/cec/Makefile b/drivers/media/cec/Makefile
+similarity index 70%
+rename from drivers/staging/media/cec/Makefile
+rename to drivers/media/cec/Makefile
+index bd7f3c5934680b..d6686337275ff8 100644
+--- a/drivers/staging/media/cec/Makefile
++++ b/drivers/media/cec/Makefile
+@@ -1,5 +1,5 @@
+ cec-objs := cec-core.o cec-adap.o cec-api.o
+
+-ifeq ($(CONFIG_MEDIA_CEC),y)
++ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
+ obj-$(CONFIG_MEDIA_SUPPORT) += cec.o
+ endif
+diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c
+similarity index 100%
+rename from drivers/staging/media/cec/cec-adap.c
+rename to drivers/media/cec/cec-adap.c
+diff --git a/drivers/staging/media/cec/cec-api.c b/drivers/media/cec/cec-api.c
+similarity index 100%
+rename from drivers/staging/media/cec/cec-api.c
+rename to drivers/media/cec/cec-api.c
+diff --git a/drivers/staging/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
+similarity index 100%
+rename from drivers/staging/media/cec/cec-core.c
+rename to drivers/media/cec/cec-core.c
+diff --git a/drivers/staging/media/cec/cec-priv.h b/drivers/media/cec/cec-priv.h
+similarity index 100%
+rename from drivers/staging/media/cec/cec-priv.h
+rename to drivers/media/cec/cec-priv.h
+diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
+index 2669b4bad91068..b31fa6fae00917 100644
+--- a/drivers/media/i2c/Kconfig
++++ b/drivers/media/i2c/Kconfig
+@@ -221,7 +221,7 @@ config VIDEO_ADV7604
+
+ config VIDEO_ADV7604_CEC
+ bool "Enable Analog Devices ADV7604 CEC support"
+- depends on VIDEO_ADV7604 && MEDIA_CEC
++ depends on VIDEO_ADV7604 && MEDIA_CEC_SUPPORT
+ ---help---
+ When selected the adv7604 will support the optional
+ HDMI CEC feature.
+@@ -242,7 +242,7 @@ config VIDEO_ADV7842
+
+ config VIDEO_ADV7842_CEC
+ bool "Enable Analog Devices ADV7842 CEC support"
+- depends on VIDEO_ADV7842 && MEDIA_CEC
++ depends on VIDEO_ADV7842 && MEDIA_CEC_SUPPORT
+ ---help---
+ When selected the adv7842 will support the optional
+ HDMI CEC feature.
+@@ -481,7 +481,7 @@ config VIDEO_ADV7511
+
+ config VIDEO_ADV7511_CEC
+ bool "Enable Analog Devices ADV7511 CEC support"
+- depends on VIDEO_ADV7511 && MEDIA_CEC
++ depends on VIDEO_ADV7511 && MEDIA_CEC_SUPPORT
+ ---help---
+ When selected the adv7511 will support the optional
+ HDMI CEC feature.
+diff --git a/drivers/media/platform/vivid/Kconfig b/drivers/media/platform/vivid/Kconfig
+index 8e6918c5c87c5d..db0dd19d227acc 100644
+--- a/drivers/media/platform/vivid/Kconfig
++++ b/drivers/media/platform/vivid/Kconfig
+@@ -25,7 +25,7 @@ config VIDEO_VIVID
+
+ config VIDEO_VIVID_CEC
+ bool "Enable CEC emulation support"
+- depends on VIDEO_VIVID && MEDIA_CEC
++ depends on VIDEO_VIVID && MEDIA_CEC_SUPPORT
+ ---help---
+ When selected the vivid module will emulate the optional
+ HDMI CEC feature.
+diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig
+index 6620d96ee44d2f..0abe5ffb49346d 100644
+--- a/drivers/staging/media/Kconfig
++++ b/drivers/staging/media/Kconfig
+@@ -21,8 +21,6 @@ if STAGING_MEDIA && MEDIA_SUPPORT
+ # Please keep them in alphabetic order
+ source "drivers/staging/media/bcm2048/Kconfig"
+
+-source "drivers/staging/media/cec/Kconfig"
+-
+ source "drivers/staging/media/cxd2099/Kconfig"
+
+ source "drivers/staging/media/davinci_vpfe/Kconfig"
+diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile
+index 906257e94dda89..246299eff80dc3 100644
+--- a/drivers/staging/media/Makefile
++++ b/drivers/staging/media/Makefile
+@@ -1,5 +1,4 @@
+ obj-$(CONFIG_I2C_BCM2048) += bcm2048/
+-obj-$(CONFIG_MEDIA_CEC) += cec/
+ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_CEC) += s5p-cec/
+ obj-$(CONFIG_DVB_CXD2099) += cxd2099/
+ obj-$(CONFIG_LIRC_STAGING) += lirc/
+diff --git a/drivers/staging/media/cec/Kconfig b/drivers/staging/media/cec/Kconfig
+deleted file mode 100644
+index 6e12d41b1f86a7..00000000000000
+--- a/drivers/staging/media/cec/Kconfig
++++ /dev/null
+@@ -1,12 +0,0 @@
+-config MEDIA_CEC
+- bool "CEC API (EXPERIMENTAL)"
+- depends on MEDIA_SUPPORT
+- select MEDIA_CEC_EDID
+- ---help---
+- Enable the CEC API.
+-
+-config MEDIA_CEC_DEBUG
+- bool "CEC debugfs interface (EXPERIMENTAL)"
+- depends on MEDIA_CEC && DEBUG_FS
+- ---help---
+- Turns on the DebugFS interface for CEC devices.
+diff --git a/drivers/staging/media/pulse8-cec/Kconfig b/drivers/staging/media/pulse8-cec/Kconfig
+index c6aa2d1c9df0ad..6ffc407de62fbd 100644
+--- a/drivers/staging/media/pulse8-cec/Kconfig
++++ b/drivers/staging/media/pulse8-cec/Kconfig
+@@ -1,6 +1,6 @@
+ config USB_PULSE8_CEC
+ tristate "Pulse Eight HDMI CEC"
+- depends on USB_ACM && MEDIA_CEC
++ depends on USB_ACM && MEDIA_CEC_SUPPORT
+ select SERIO
+ select SERIO_SERPORT
+ ---help---
+diff --git a/drivers/staging/media/s5p-cec/Kconfig b/drivers/staging/media/s5p-cec/Kconfig
+index 0315fd7ad0f1bd..ddfd955da0d40d 100644
+--- a/drivers/staging/media/s5p-cec/Kconfig
++++ b/drivers/staging/media/s5p-cec/Kconfig
+@@ -1,6 +1,6 @@
+ config VIDEO_SAMSUNG_S5P_CEC
+ tristate "Samsung S5P CEC driver"
+- depends on VIDEO_DEV && MEDIA_CEC && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
++ depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
+ ---help---
+ This is a driver for Samsung S5P HDMI CEC interface. It uses the
+ generic CEC framework interface.
+diff --git a/drivers/staging/media/st-cec/Kconfig b/drivers/staging/media/st-cec/Kconfig
+index 784d2c600aca10..c04283db58d6d1 100644
+--- a/drivers/staging/media/st-cec/Kconfig
++++ b/drivers/staging/media/st-cec/Kconfig
+@@ -1,6 +1,6 @@
+ config VIDEO_STI_HDMI_CEC
+ tristate "STMicroelectronics STiH4xx HDMI CEC driver"
+- depends on VIDEO_DEV && MEDIA_CEC && (ARCH_STI || COMPILE_TEST)
++ depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (ARCH_STI || COMPILE_TEST)
+ ---help---
+ This is a driver for STIH4xx HDMI CEC interface. It uses the
+ generic CEC framework interface.
+diff --git a/include/media/cec.h b/include/media/cec.h
+index fdb5d600e4bb98..717eaf552f3d0c 100644
+--- a/include/media/cec.h
++++ b/include/media/cec.h
+@@ -196,7 +196,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
+ return adap->phys_addr == 0;
+ }
+
+-#if IS_ENABLED(CONFIG_MEDIA_CEC)
++#if IS_ENABLED(CONFIG_MEDIA_CEC_SUPPORT)
+ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
+ void *priv, const char *name, u32 caps, u8 available_las,
+ struct device *parent);
+diff --git a/include/linux/cec-funcs.h b/include/uapi/linux/cec-funcs.h
+similarity index 99%
+rename from include/linux/cec-funcs.h
+rename to include/uapi/linux/cec-funcs.h
+index 138bbf721e70ca..1a1de2169f4891 100644
+--- a/include/linux/cec-funcs.h
++++ b/include/uapi/linux/cec-funcs.h
+@@ -33,12 +33,6 @@
+ * SOFTWARE.
+ */
+
+-/*
+- * Note: this framework is still in staging and it is likely the API
+- * will change before it goes out of staging.
+- *
+- * Once it is moved out of staging this header will move to uapi.
+- */
+ #ifndef _CEC_UAPI_FUNCS_H
+ #define _CEC_UAPI_FUNCS_H
+
+diff --git a/include/linux/cec.h b/include/uapi/linux/cec.h
+similarity index 99%
+rename from include/linux/cec.h
+rename to include/uapi/linux/cec.h
+index 9c87711c0e1c0b..f4ec0af67707aa 100644
+--- a/include/linux/cec.h
++++ b/include/uapi/linux/cec.h
+@@ -33,12 +33,6 @@
+ * SOFTWARE.
+ */
+
+-/*
+- * Note: this framework is still in staging and it is likely the API
+- * will change before it goes out of staging.
+- *
+- * Once it is moved out of staging this header will move to uapi.
+- */
+ #ifndef _CEC_UAPI_H
+ #define _CEC_UAPI_H
+
diff --git a/projects/L4T/devices/Switch/patches/linux/0005-fix-libcec-build-2.patch b/projects/L4T/devices/Switch/patches/linux/0005-fix-libcec-build-2.patch
new file mode 100644
index 00000000000..8ea7df04fc5
--- /dev/null
+++ b/projects/L4T/devices/Switch/patches/linux/0005-fix-libcec-build-2.patch
@@ -0,0 +1,12 @@
+diff -Naur linux-Switch-5.1.2/nvidia/drivers/video/tegra/Kconfig linux-Switch-5.1.2-2/nvidia/drivers/video/tegra/Kconfig
+--- linux-Switch-5.1.2/nvidia/drivers/video/tegra/Kconfig 2024-01-29 05:57:16.331738434 +0100
++++ linux-Switch-5.1.2-2/nvidia/drivers/video/tegra/Kconfig 2024-01-29 07:21:54.862883090 +0100
+@@ -231,7 +231,7 @@
+
+ config TEGRA_DP_BRANCH_STDP2550
+ bool "Enable DP branch STDP2550/RTD2172N support."
+- depends on TEGRA_DP && MEDIA_CEC
++ depends on TEGRA_DP && MEDIA_CEC_SUPPORT
+ default n
+ help
+ Say Y here to enable the DP branch MegaChips STDP2550 and Realtek
diff --git a/projects/L4T/devices/Switch/patches/linux/0006-debug-cec.patch b/projects/L4T/devices/Switch/patches/linux/0006-debug-cec.patch
deleted file mode 100644
index 543ff54e4e2..00000000000
--- a/projects/L4T/devices/Switch/patches/linux/0006-debug-cec.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -Naur linux-Switch/nvidia/drivers/video/tegra/dc/dp_branch.c linux-Switch-2/nvidia/drivers/video/tegra/dc/dp_branch.c
---- linux-Switch/nvidia/drivers/video/tegra/dc/dp_branch.c 2022-01-05 18:00:36.325665889 +0100
-+++ linux-Switch-2/nvidia/drivers/video/tegra/dc/dp_branch.c 2022-01-05 18:17:06.605838285 +0100
-@@ -66,6 +66,15 @@
- tegra_dc_dp_dpcd_write(dp, NV_DPCD_BRANCH_STDP_CEC_RX_INFO,
- dpcd_data);
-
-+
-+
-+ printk(KERN_ALERT "dp: cec: rx data: ");
-+ for (i = 0; i < msg_len; i++)
-+ printk(KERN_CONT "%02X ", msg[i]);
-+ printk(KERN_CONT "\n");
-+
-+
-+
- return msg_len;
- }
-
-@@ -332,6 +341,11 @@
- cec_transmit_done(data->adap, CEC_TX_STATUS_OK,
- 0, 0, 0, 0);
- }
-+
-+ printk(KERN_ALERT "dp: cec: tx data: ");
-+ for (i = 0; i < data->cec_tx_len; i++)
-+ printk(KERN_CONT "%02X ", data->cec_tx_buf[i]);
-+ printk(KERN_CONT " (tries: %d/%d)\n", i, data->cec_tx_attempts);
- }
-
- static void dpb_stm_cec_rx_worker(struct work_struct *work)
diff --git a/projects/L4T/devices/Switch/patches/peripheral.joystick/01-use-real-vendor-product-id.patch b/projects/L4T/devices/Switch/patches/peripheral.joystick/01-use-real-vendor-product-id.patch
new file mode 100644
index 00000000000..1a845bd7b67
--- /dev/null
+++ b/projects/L4T/devices/Switch/patches/peripheral.joystick/01-use-real-vendor-product-id.patch
@@ -0,0 +1,48 @@
+From 082e1d3d2004a6bf61009647597d6f1cabac79d5 Mon Sep 17 00:00:00 2001
+From: Nicolas Adenis-Lamarre
+Date: Mon, 24 Oct 2022 12:59:58 +0000
+Subject: [PATCH] use real vendor/product id
+
+the current way doesn't provide the real vendor/produc ids
+that can be found via evtest.
+This patch applies the same commands from the evtest source code.
+It works for any pad, including bluetooth pads.
+
+This patch was originally written for the batocera project at:
+https://github.com/batocera-linux/batocera.linux/tree/master/board/batocera/patches/kodi-peripheral-joystick
+
+Signed-off-by: Nicolas Adenis-Lamarre
+---
+ src/api/udev/JoystickUdev.cpp | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/src/api/udev/JoystickUdev.cpp b/src/api/udev/JoystickUdev.cpp
+index 3c0c6113..2ef41a2b 100644
+--- a/src/api/udev/JoystickUdev.cpp
++++ b/src/api/udev/JoystickUdev.cpp
+@@ -275,15 +275,16 @@ bool CJoystickUdev::GetProperties()
+ }
+ SetName(name);
+
+- // Don't worry about unref'ing the parent
+- struct udev_device* parent = udev_device_get_parent_with_subsystem_devtype(m_dev, "usb", "usb_device");
+-
+- const char* buf;
+- if ((buf = udev_device_get_sysattr_value(parent, "idVendor")) != nullptr)
+- SetVendorID(strtol(buf, NULL, 16));
+-
+- if ((buf = udev_device_get_sysattr_value(parent, "idProduct")) != nullptr)
+- SetProductID(strtol(buf, NULL, 16));
++ unsigned short id[4];
++ char val[16];
++ if(ioctl(m_fd, EVIOCGID, id) == 0) {
++ sprintf(val, "%x", id[ID_VENDOR]);
++ SetVendorID(strtol(val, NULL, 16));
++ esyslog("joystick information vendorid=%s for %s", val, m_path.c_str());
++ sprintf(val, "%x", id[ID_PRODUCT]);
++ SetProductID(strtol(val, NULL, 16));
++ esyslog("joystick information productid=%s for %s", val, m_path.c_str());
++ }
+
+ struct stat st;
+ if (fstat(m_fd, &st) < 0)
diff --git a/projects/L4T/devices/Switch/patches/peripheral.joystick/02-fix-axis-when-not-aligned-on-0.patch b/projects/L4T/devices/Switch/patches/peripheral.joystick/02-fix-axis-when-not-aligned-on-0.patch
new file mode 100644
index 00000000000..f3c56eadfcb
--- /dev/null
+++ b/projects/L4T/devices/Switch/patches/peripheral.joystick/02-fix-axis-when-not-aligned-on-0.patch
@@ -0,0 +1,36 @@
+From 3f76122bbe2ec31b75c78558ca8dca84d042ca12 Mon Sep 17 00:00:00 2001
+From: Nicolas Adenis-Lamarre
+Date: Wed, 28 Jun 2023 05:18:19 +0000
+Subject: [PATCH] fix axis when not aligned on 0
+
+Signed-off-by: Nicolas Adenis-Lamarre
+---
+ src/api/udev/JoystickUdev.cpp | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/src/api/udev/JoystickUdev.cpp b/src/api/udev/JoystickUdev.cpp
+index 3c0c6113..ce088156 100644
+--- a/src/api/udev/JoystickUdev.cpp
++++ b/src/api/udev/JoystickUdev.cpp
+@@ -217,10 +217,17 @@ bool CJoystickUdev::ScanEvents(void)
+ const unsigned int axisIndex = it->second.axisIndex;
+ const input_absinfo& info = it->second.axisInfo;
+
+- if (event.value >= 0)
+- SetAxisValue(axisIndex, event.value, info.maximum);
+- else
+- SetAxisValue(axisIndex, event.value, -info.minimum);
++ int middle = (info.minimum+info.maximum)/2;
++ int length = (info.maximum-info.minimum)/2;
++
++ if (event.value >= middle && event.value-middle > length/2) {
++ SetAxisValue(axisIndex, event.value-middle, length);
++ }
++ else if (event.value <= middle && middle-event.value > length/2) {
++ SetAxisValue(axisIndex, -(middle-event.value), length);
++ } else {
++ SetAxisValue(axisIndex, 0, length);
++ }
+ }
+ }
+ break;
diff --git a/projects/L4T/devices/Switch/patches/peripheral.joystick/03-count-correctly-all-buttons-even-if-not-mapped.patch b/projects/L4T/devices/Switch/patches/peripheral.joystick/03-count-correctly-all-buttons-even-if-not-mapped.patch
new file mode 100644
index 00000000000..aec86b4306a
--- /dev/null
+++ b/projects/L4T/devices/Switch/patches/peripheral.joystick/03-count-correctly-all-buttons-even-if-not-mapped.patch
@@ -0,0 +1,28 @@
+From 84f6cf46bb84cd47469bb098bd9fd82a3bb93861 Mon Sep 17 00:00:00 2001
+From: Nicolas Adenis-Lamarre
+Date: Wed, 28 Jun 2023 05:21:35 +0000
+Subject: [PATCH] count correctly all buttons even if not mapped
+
+Signed-off-by: Nicolas Adenis-Lamarre
+---
+ src/api/udev/JoystickUdev.cpp | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/src/api/udev/JoystickUdev.cpp b/src/api/udev/JoystickUdev.cpp
+index 3c0c6113..ed6d7747 100644
+--- a/src/api/udev/JoystickUdev.cpp
++++ b/src/api/udev/JoystickUdev.cpp
+@@ -303,12 +303,7 @@ bool CJoystickUdev::GetProperties()
+ // Go through all possible keycodes, check if they are used, and map them to
+ // button/axes/hat indices
+ unsigned int buttons = 0;
+- for (unsigned int i = KEY_UP; i <= KEY_DOWN; i++)
+- {
+- if (test_bit(i, keybit))
+- m_button_bind[i] = buttons++;
+- }
+- for (unsigned int i = BTN_MISC; i < KEY_MAX; i++)
++ for (unsigned int i = 0; i < KEY_MAX; i++)
+ {
+ if (test_bit(i, keybit))
+ m_button_bind[i] = buttons++;
diff --git a/projects/L4T/devices/Switch/patches/peripheral.joystick/04-close-correctly-the-uninitialized-joysticks.patch b/projects/L4T/devices/Switch/patches/peripheral.joystick/04-close-correctly-the-uninitialized-joysticks.patch
new file mode 100644
index 00000000000..4838fcd44be
--- /dev/null
+++ b/projects/L4T/devices/Switch/patches/peripheral.joystick/04-close-correctly-the-uninitialized-joysticks.patch
@@ -0,0 +1,46 @@
+From a408321154d45342a42f4b54e44af7676b4c4933 Mon Sep 17 00:00:00 2001
+From: Nicolas Adenis-Lamarre
+Date: Wed, 28 Jun 2023 05:23:16 +0000
+Subject: [PATCH] close correctly the uninitialized joysticks
+
+without that closing, the number of open files is growing (can be observed via lsof | grep kodi | grep /dev)
+and ends to crash kodi after a long time
+
+Signed-off-by: Nicolas Adenis-Lamarre
+---
+ src/api/udev/JoystickInterfaceUdev.cpp | 9 +++++++--
+ src/api/udev/JoystickUdev.h | 1 +
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/api/udev/JoystickInterfaceUdev.cpp b/src/api/udev/JoystickInterfaceUdev.cpp
+index 8ee6dfa3..0459927c 100644
+--- a/src/api/udev/JoystickInterfaceUdev.cpp
++++ b/src/api/udev/JoystickInterfaceUdev.cpp
+@@ -92,8 +92,13 @@ bool CJoystickInterfaceUdev::ScanForJoysticks(JoystickVector& joysticks)
+
+ if (devnode != nullptr)
+ {
+- JoystickPtr joystick = JoystickPtr(new CJoystickUdev(dev, devnode));
+- joysticks.push_back(joystick);
++ CJoystickUdev *j = new CJoystickUdev(dev, devnode);
++ if(j->isInitialized()) {
++ JoystickPtr joystick = JoystickPtr(j);
++ joysticks.push_back(joystick);
++ } else {
++ delete j;
++ }
+ }
+
+ udev_device_unref(dev);
+diff --git a/src/api/udev/JoystickUdev.h b/src/api/udev/JoystickUdev.h
+index 6ce5740f..949d2f27 100644
+--- a/src/api/udev/JoystickUdev.h
++++ b/src/api/udev/JoystickUdev.h
+@@ -58,6 +58,7 @@ namespace JOYSTICK
+ virtual bool Initialize(void) override;
+ virtual void Deinitialize(void) override;
+ virtual void ProcessEvents(void) override;
++ bool isInitialized() { return m_bInitialized; }
+
+ protected:
+ // implementation of CJoystick
diff --git a/projects/L4T/devices/Switch/patches/peripheral.joystick/05-Add-Switch-joycon-mappings.patch b/projects/L4T/devices/Switch/patches/peripheral.joystick/05-Add-Switch-joycon-mappings.patch
new file mode 100644
index 00000000000..23a4d3bb6cf
--- /dev/null
+++ b/projects/L4T/devices/Switch/patches/peripheral.joystick/05-Add-Switch-joycon-mappings.patch
@@ -0,0 +1,214 @@
+diff -Naur peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_18b_4a.xml peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_18b_4a.xml
+--- peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_18b_4a.xml 1970-01-01 01:00:00.000000000 +0100
++++ peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_18b_4a.xml 2024-02-04 18:58:05.396501380 +0100
+@@ -0,0 +1,37 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff -Naur peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_22b_4a.xml peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_22b_4a.xml
+--- peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_22b_4a.xml 1970-01-01 01:00:00.000000000 +0100
++++ peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Combined_Joy-Cons_V057E_P2008_22b_4a.xml 2024-02-04 19:18:42.955765642 +0100
+@@ -0,0 +1,37 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff -Naur peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Left_Joy-Con_V057E_P2006_11b_2a.xml peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Left_Joy-Con_V057E_P2006_11b_2a.xml
+--- peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Left_Joy-Con_V057E_P2006_11b_2a.xml 1970-01-01 01:00:00.000000000 +0100
++++ peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Left_Joy-Con_V057E_P2006_11b_2a.xml 2024-02-04 07:32:57.729631786 +0100
+@@ -0,0 +1,21 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff -Naur peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Lite_Gamepad_V057E_PF123_18b_4a.xml peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Lite_Gamepad_V057E_PF123_18b_4a.xml
+--- peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Lite_Gamepad_V057E_PF123_18b_4a.xml 1970-01-01 01:00:00.000000000 +0100
++++ peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Lite_Gamepad_V057E_PF123_18b_4a.xml 2024-02-04 18:59:57.934616823 +0100
+@@ -0,0 +1,37 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff -Naur peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Pro_Controller_V057E_P2009_18b_4a.xml peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Pro_Controller_V057E_P2009_18b_4a.xml
+--- peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Pro_Controller_V057E_P2009_18b_4a.xml 1970-01-01 01:00:00.000000000 +0100
++++ peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Pro_Controller_V057E_P2009_18b_4a.xml 2024-02-04 19:01:34.232427026 +0100
+@@ -0,0 +1,37 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff -Naur peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Right_Joy-Con_V057E_P2007_11b_2a.xml peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Right_Joy-Con_V057E_P2007_11b_2a.xml
+--- peripheral.joystick-21.1.10-Omega/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Right_Joy-Con_V057E_P2007_11b_2a.xml 1970-01-01 01:00:00.000000000 +0100
++++ peripheral.joystick-21.1.10-Omega-2/peripheral.joystick/resources/buttonmaps/xml/udev/Nintendo_Switch_Right_Joy-Con_V057E_P2007_11b_2a.xml 2024-02-04 07:32:57.729631786 +0100
+@@ -0,0 +1,21 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
diff --git a/projects/L4T/options b/projects/L4T/options
index 1ddf406c4e2..4aa7734eead 100644
--- a/projects/L4T/options
+++ b/projects/L4T/options
@@ -2,12 +2,10 @@
# setup system defaults
################################################################################
- #VALGRIND="yes"
-
# Bootloader to use (syslinux / u-boot / bcm2835-bootloader)
- BOOTLOADER="u-boot"
-
- # Kernel target for u-boot (default 'uImage' if BOOTLOADER=u-boot) (uImage / zImage)
+ BOOTLOADER="u-boot"
+
+ # Kernel target for u-boot (default 'uImage' if BOOTLOADER=u-boot) (uImage / zImage)
KERNEL_TARGET="Image"
# Kernel extra targets to build
@@ -15,9 +13,6 @@
# Additional kernel make parameters (for example to specify the u-boot loadaddress)
KERNEL_MAKE_EXTRACMD="dtbs"
-
- #Set kernel toolchain
- #KERNEL_TOOLCHAIN=""
################################################################################
# setup build defaults
@@ -33,12 +28,10 @@
################################################################################
# setup project defaults
################################################################################
- #Set LIBDRM config options.... this isnt needed on L4T, as we install seperate libDRM in tegra-bsp package.
- #LIBDRM_CONFIG="--enable-tegra-experimental-api"
-
+
# build and install ALSA Audio support (yes / no)
ALSA_SUPPORT="yes"
-
+
# build and install PulseAudio support (yes / no)
PULSEAUDIO_SUPPORT="yes"
@@ -46,21 +39,22 @@
WIREGUARD_SUPPORT="no"
if [ "${DISTRO}" = "Lakka" ]; then
- # OpenGL(X) implementation to use (no / Mesa)
- OPENGLES="no" #OpenGLES works, but breaks some cores that dont support it(Moonlight)
+ # OpenGL(X) implementation to use (no / Mesa)
+ OPENGLES="no" #OpenGLES works, but breaks some cores that dont support it(Moonlight)
# OpenGL implementation to use (no / Mesa)
- OPENGL="mesa"
+ OPENGL="mesa"
else
- # OpenGL(X) implementation to use (no / Mesa)
- OPENGLES="mesa" #OpenGLES works, but breaks some cores that dont support it(Moonlight)
+ # OpenGL(X) implementation to use (no / Mesa)
+ OPENGLES="mesa" #OpenGLES works, but breaks some cores that dont support it(Moonlight)
# OpenGL implementation to use (no / Mesa)
- OPENGL="mesa"
+ OPENGL="mesa"
fi
# Vulkan Support
- VULKAN="vulkan-loader"
+ VULKAN="vulkan-loader"
+
# include uvesafb support (yes / no)
UVESAFB_SUPPORT="no"
@@ -106,22 +100,21 @@
# Kernel to build
LINUX="L4T"
-
+
# CEC Support
CEC_FRAMEWORK_SUPPORT="no"
# Set Distro Specific options
if [ "${DISTRO}" = "LibreELEC" ]; then
#Add Support for git downloads
- GET_HANDLER_SUPPORT+=" git"
- #Use wpa_supplicant over iwd
- WIRELESS_DAEMON="wpa_supplicant"
- fi
+ GET_HANDLER_SUPPORT+=" git"
+ fi
- # disable arm target
+ #Use wpa_supplicant over iwd
+ WIRELESS_DAEMON="wpa_supplicant"
+ # disable arm target
if [ "${ARCH}" = "arm" ]; then
echo "Error: 32bit ARM arch is not supported by L4T"
exit 1
fi
-
diff --git a/projects/L4T/packages/busybox/config/busybox-host.conf b/projects/L4T/packages/busybox/config/busybox-host.conf
new file mode 100644
index 00000000000..e5af86eefa5
--- /dev/null
+++ b/projects/L4T/packages/busybox/config/busybox-host.conf
@@ -0,0 +1,1164 @@
+#
+# Automatically generated make config: don't edit
+# Busybox version: 1.32.0.git
+# Sun Feb 2 19:48:47 2020
+#
+CONFIG_HAVE_DOT_CONFIG=y
+
+#
+# Settings
+#
+# CONFIG_DESKTOP is not set
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_FEDORA_COMPAT is not set
+# CONFIG_INCLUDE_SUSv2 is not set
+CONFIG_LONG_OPTS=y
+CONFIG_SHOW_USAGE=y
+CONFIG_FEATURE_VERBOSE_USAGE=y
+# CONFIG_FEATURE_COMPRESS_USAGE is not set
+CONFIG_LFS=y
+# CONFIG_PAM is not set
+# CONFIG_FEATURE_DEVPTS is not set
+# CONFIG_FEATURE_UTMP is not set
+# CONFIG_FEATURE_WTMP is not set
+# CONFIG_FEATURE_PIDFILE is not set
+CONFIG_PID_FILE_PATH=""
+CONFIG_BUSYBOX=y
+CONFIG_FEATURE_SHOW_SCRIPT=y
+# CONFIG_FEATURE_INSTALLER is not set
+CONFIG_INSTALL_NO_USR=y
+# CONFIG_FEATURE_SUID is not set
+# CONFIG_FEATURE_SUID_CONFIG is not set
+# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
+CONFIG_FEATURE_PREFER_APPLETS=y
+CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_CLEAN_UP is not set
+# CONFIG_FEATURE_SYSLOG_INFO is not set
+# CONFIG_FEATURE_SYSLOG is not set
+CONFIG_PLATFORM_LINUX=y
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+# CONFIG_PIE is not set
+# CONFIG_NOMMU is not set
+# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
+# CONFIG_FEATURE_INDIVIDUAL is not set
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
+CONFIG_CROSS_COMPILER_PREFIX=""
+CONFIG_SYSROOT=""
+CONFIG_EXTRA_CFLAGS=""
+CONFIG_EXTRA_LDFLAGS=""
+CONFIG_EXTRA_LDLIBS=""
+# CONFIG_USE_PORTABLE_CODE is not set
+# CONFIG_STACK_OPTIMIZATION_386 is not set
+
+#
+# Installation Options ("make install" behavior)
+#
+CONFIG_INSTALL_APPLET_SYMLINKS=y
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
+# CONFIG_INSTALL_APPLET_DONT is not set
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
+CONFIG_PREFIX="./_install-hosttools"
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+# CONFIG_DEBUG_SANITIZE is not set
+# CONFIG_UNIT_TEST is not set
+# CONFIG_WERROR is not set
+# CONFIG_WARN_SIMPLE_MSG is not set
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Library Tuning
+#
+# CONFIG_FEATURE_USE_BSS_TAIL is not set
+CONFIG_FLOAT_DURATION=y
+# CONFIG_FEATURE_RTMINMAX is not set
+# CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS is not set
+# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
+CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_PASSWORD_MINLEN=6
+CONFIG_MD5_SMALL=1
+CONFIG_SHA3_SMALL=0
+CONFIG_FEATURE_FAST_TOP=y
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+# CONFIG_FEATURE_ETC_SERVICES is not set
+CONFIG_FEATURE_EDITING=y
+CONFIG_FEATURE_EDITING_MAX_LEN=1024
+# CONFIG_FEATURE_EDITING_VI is not set
+CONFIG_FEATURE_EDITING_HISTORY=15
+# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
+# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
+# CONFIG_FEATURE_REVERSE_SEARCH is not set
+CONFIG_FEATURE_TAB_COMPLETION=y
+# CONFIG_FEATURE_USERNAME_COMPLETION is not set
+# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set
+# CONFIG_FEATURE_EDITING_WINCH is not set
+# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
+# CONFIG_LOCALE_SUPPORT is not set
+CONFIG_UNICODE_SUPPORT=y
+# CONFIG_UNICODE_USING_LOCALE is not set
+# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
+CONFIG_SUBST_WCHAR=63
+CONFIG_LAST_SUPPORTED_WCHAR=767
+# CONFIG_UNICODE_COMBINING_WCHARS is not set
+# CONFIG_UNICODE_WIDE_WCHARS is not set
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
+# CONFIG_FEATURE_NON_POSIX_CP is not set
+CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
+CONFIG_FEATURE_USE_SENDFILE=y
+CONFIG_FEATURE_COPYBUF_KB=4
+# CONFIG_FEATURE_SKIP_ROOTFS is not set
+# CONFIG_MONOTONIC_SYSCALL is not set
+# CONFIG_IOCTL_HEX2STR_ERROR is not set
+# CONFIG_FEATURE_HWIB is not set
+
+#
+# Applets
+#
+
+#
+# Archival Utilities
+#
+# CONFIG_FEATURE_SEAMLESS_XZ is not set
+# CONFIG_FEATURE_SEAMLESS_LZMA is not set
+# CONFIG_FEATURE_SEAMLESS_BZ2 is not set
+# CONFIG_FEATURE_SEAMLESS_GZ is not set
+# CONFIG_FEATURE_SEAMLESS_Z is not set
+# CONFIG_AR is not set
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
+# CONFIG_FEATURE_AR_CREATE is not set
+# CONFIG_UNCOMPRESS is not set
+# CONFIG_GUNZIP is not set
+# CONFIG_ZCAT is not set
+# CONFIG_FEATURE_GUNZIP_LONG_OPTIONS is not set
+# CONFIG_BUNZIP2 is not set
+# CONFIG_BZCAT is not set
+# CONFIG_UNLZMA is not set
+# CONFIG_LZCAT is not set
+# CONFIG_LZMA is not set
+# CONFIG_UNXZ is not set
+# CONFIG_XZCAT is not set
+# CONFIG_XZ is not set
+# CONFIG_BZIP2 is not set
+CONFIG_BZIP2_SMALL=0
+# CONFIG_FEATURE_BZIP2_DECOMPRESS is not set
+# CONFIG_CPIO is not set
+# CONFIG_FEATURE_CPIO_O is not set
+# CONFIG_FEATURE_CPIO_P is not set
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+# CONFIG_GZIP is not set
+# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
+CONFIG_GZIP_FAST=0
+# CONFIG_FEATURE_GZIP_LEVELS is not set
+# CONFIG_FEATURE_GZIP_DECOMPRESS is not set
+# CONFIG_LZOP is not set
+# CONFIG_UNLZOP is not set
+# CONFIG_LZOPCAT is not set
+# CONFIG_LZOP_COMPR_HIGH is not set
+# CONFIG_RPM is not set
+# CONFIG_RPM2CPIO is not set
+# CONFIG_TAR is not set
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+# CONFIG_FEATURE_TAR_CREATE is not set
+# CONFIG_FEATURE_TAR_AUTODETECT is not set
+# CONFIG_FEATURE_TAR_FROM is not set
+# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_GNU_EXTENSIONS is not set
+# CONFIG_FEATURE_TAR_TO_COMMAND is not set
+# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
+# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set
+# CONFIG_FEATURE_TAR_SELINUX is not set
+# CONFIG_UNZIP is not set
+# CONFIG_FEATURE_UNZIP_CDF is not set
+# CONFIG_FEATURE_UNZIP_BZIP2 is not set
+# CONFIG_FEATURE_UNZIP_LZMA is not set
+# CONFIG_FEATURE_UNZIP_XZ is not set
+# CONFIG_FEATURE_LZMA_FAST is not set
+
+#
+# Coreutils
+#
+# CONFIG_BASENAME is not set
+# CONFIG_CAT is not set
+# CONFIG_FEATURE_CATN is not set
+# CONFIG_FEATURE_CATV is not set
+# CONFIG_CHGRP is not set
+# CONFIG_CHMOD is not set
+# CONFIG_CHOWN is not set
+# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
+# CONFIG_CHROOT is not set
+# CONFIG_CKSUM is not set
+# CONFIG_COMM is not set
+# CONFIG_CP is not set
+# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
+# CONFIG_FEATURE_CP_REFLINK is not set
+# CONFIG_CUT is not set
+# CONFIG_DATE is not set
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+# CONFIG_FEATURE_DATE_NANO is not set
+# CONFIG_FEATURE_DATE_COMPAT is not set
+# CONFIG_DD is not set
+# CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set
+# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set
+# CONFIG_FEATURE_DD_IBS_OBS is not set
+# CONFIG_FEATURE_DD_STATUS is not set
+# CONFIG_DF is not set
+# CONFIG_FEATURE_DF_FANCY is not set
+# CONFIG_DIRNAME is not set
+# CONFIG_DOS2UNIX is not set
+# CONFIG_UNIX2DOS is not set
+# CONFIG_DU is not set
+# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set
+# CONFIG_ECHO is not set
+# CONFIG_FEATURE_FANCY_ECHO is not set
+# CONFIG_ENV is not set
+# CONFIG_EXPAND is not set
+# CONFIG_UNEXPAND is not set
+# CONFIG_EXPR is not set
+# CONFIG_EXPR_MATH_SUPPORT_64 is not set
+# CONFIG_FACTOR is not set
+# CONFIG_FALSE is not set
+# CONFIG_FOLD is not set
+# CONFIG_HEAD is not set
+# CONFIG_FEATURE_FANCY_HEAD is not set
+# CONFIG_HOSTID is not set
+# CONFIG_ID is not set
+# CONFIG_GROUPS is not set
+# CONFIG_INSTALL is not set
+# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
+# CONFIG_LINK is not set
+# CONFIG_LN is not set
+# CONFIG_LOGNAME is not set
+# CONFIG_LS is not set
+# CONFIG_FEATURE_LS_FILETYPES is not set
+# CONFIG_FEATURE_LS_FOLLOWLINKS is not set
+# CONFIG_FEATURE_LS_RECURSIVE is not set
+# CONFIG_FEATURE_LS_WIDTH is not set
+# CONFIG_FEATURE_LS_SORTFILES is not set
+# CONFIG_FEATURE_LS_TIMESTAMPS is not set
+# CONFIG_FEATURE_LS_USERNAME is not set
+# CONFIG_FEATURE_LS_COLOR is not set
+# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
+# CONFIG_MD5SUM is not set
+# CONFIG_SHA1SUM is not set
+# CONFIG_SHA256SUM is not set
+# CONFIG_SHA512SUM is not set
+# CONFIG_SHA3SUM is not set
+# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
+# CONFIG_MKDIR is not set
+# CONFIG_MKFIFO is not set
+# CONFIG_MKNOD is not set
+# CONFIG_MKTEMP is not set
+# CONFIG_MV is not set
+# CONFIG_NICE is not set
+# CONFIG_NL is not set
+# CONFIG_NOHUP is not set
+# CONFIG_NPROC is not set
+# CONFIG_OD is not set
+# CONFIG_PASTE is not set
+# CONFIG_PRINTENV is not set
+# CONFIG_PRINTF is not set
+# CONFIG_PWD is not set
+# CONFIG_READLINK is not set
+# CONFIG_FEATURE_READLINK_FOLLOW is not set
+# CONFIG_REALPATH is not set
+# CONFIG_RM is not set
+# CONFIG_RMDIR is not set
+# CONFIG_SEQ is not set
+# CONFIG_SHRED is not set
+# CONFIG_SHUF is not set
+# CONFIG_SLEEP is not set
+# CONFIG_FEATURE_FANCY_SLEEP is not set
+# CONFIG_SORT is not set
+# CONFIG_FEATURE_SORT_BIG is not set
+# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
+# CONFIG_SPLIT is not set
+# CONFIG_FEATURE_SPLIT_FANCY is not set
+# CONFIG_STAT is not set
+# CONFIG_FEATURE_STAT_FORMAT is not set
+# CONFIG_FEATURE_STAT_FILESYSTEM is not set
+# CONFIG_STTY is not set
+# CONFIG_SUM is not set
+# CONFIG_SYNC is not set
+# CONFIG_FEATURE_SYNC_FANCY is not set
+# CONFIG_FSYNC is not set
+# CONFIG_TAC is not set
+# CONFIG_TAIL is not set
+# CONFIG_FEATURE_FANCY_TAIL is not set
+# CONFIG_TEE is not set
+# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
+# CONFIG_TEST is not set
+# CONFIG_TEST1 is not set
+# CONFIG_TEST2 is not set
+# CONFIG_FEATURE_TEST_64 is not set
+# CONFIG_TIMEOUT is not set
+# CONFIG_TOUCH is not set
+# CONFIG_FEATURE_TOUCH_NODEREF is not set
+# CONFIG_FEATURE_TOUCH_SUSV3 is not set
+# CONFIG_TR is not set
+# CONFIG_FEATURE_TR_CLASSES is not set
+# CONFIG_FEATURE_TR_EQUIV is not set
+# CONFIG_TRUE is not set
+# CONFIG_TRUNCATE is not set
+# CONFIG_TTY is not set
+# CONFIG_UNAME is not set
+CONFIG_UNAME_OSNAME=""
+CONFIG_BB_ARCH=y
+# CONFIG_UNIQ is not set
+# CONFIG_UNLINK is not set
+# CONFIG_USLEEP is not set
+# CONFIG_UUDECODE is not set
+# CONFIG_BASE64 is not set
+# CONFIG_UUENCODE is not set
+# CONFIG_WC is not set
+# CONFIG_FEATURE_WC_LARGE is not set
+# CONFIG_WHO is not set
+# CONFIG_W is not set
+# CONFIG_USERS is not set
+# CONFIG_WHOAMI is not set
+# CONFIG_YES is not set
+
+#
+# Common options
+#
+# CONFIG_FEATURE_VERBOSE is not set
+# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
+# CONFIG_FEATURE_HUMAN_READABLE is not set
+
+#
+# Console Utilities
+#
+# CONFIG_CHVT is not set
+# CONFIG_CLEAR is not set
+# CONFIG_DEALLOCVT is not set
+# CONFIG_DUMPKMAP is not set
+# CONFIG_FGCONSOLE is not set
+# CONFIG_KBD_MODE is not set
+# CONFIG_LOADFONT is not set
+# CONFIG_SETFONT is not set
+# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
+CONFIG_DEFAULT_SETFONT_DIR=""
+# CONFIG_FEATURE_LOADFONT_PSF2 is not set
+# CONFIG_FEATURE_LOADFONT_RAW is not set
+# CONFIG_LOADKMAP is not set
+# CONFIG_OPENVT is not set
+# CONFIG_RESET is not set
+# CONFIG_RESIZE is not set
+# CONFIG_FEATURE_RESIZE_PRINT is not set
+# CONFIG_SETCONSOLE is not set
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
+# CONFIG_SETKEYCODES is not set
+# CONFIG_SETLOGCONS is not set
+# CONFIG_SHOWKEY is not set
+
+#
+# Debian Utilities
+#
+# CONFIG_PIPE_PROGRESS is not set
+# CONFIG_RUN_PARTS is not set
+# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
+# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
+# CONFIG_START_STOP_DAEMON is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
+# CONFIG_WHICH is not set
+
+#
+# klibc-utils
+#
+# CONFIG_MINIPS is not set
+# CONFIG_NUKE is not set
+# CONFIG_RESUME is not set
+# CONFIG_RUN_INIT is not set
+
+#
+# Editors
+#
+# CONFIG_AWK is not set
+# CONFIG_FEATURE_AWK_LIBM is not set
+# CONFIG_FEATURE_AWK_GNU_EXTENSIONS is not set
+# CONFIG_CMP is not set
+# CONFIG_DIFF is not set
+# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
+# CONFIG_FEATURE_DIFF_DIR is not set
+# CONFIG_ED is not set
+# CONFIG_PATCH is not set
+# CONFIG_SED is not set
+# CONFIG_VI is not set
+CONFIG_FEATURE_VI_MAX_LEN=0
+# CONFIG_FEATURE_VI_8BIT is not set
+# CONFIG_FEATURE_VI_COLON is not set
+# CONFIG_FEATURE_VI_YANKMARK is not set
+# CONFIG_FEATURE_VI_SEARCH is not set
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+# CONFIG_FEATURE_VI_USE_SIGNALS is not set
+# CONFIG_FEATURE_VI_DOT_CMD is not set
+# CONFIG_FEATURE_VI_READONLY is not set
+# CONFIG_FEATURE_VI_SETOPTS is not set
+# CONFIG_FEATURE_VI_SET is not set
+# CONFIG_FEATURE_VI_WIN_RESIZE is not set
+# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
+# CONFIG_FEATURE_VI_UNDO is not set
+# CONFIG_FEATURE_VI_UNDO_QUEUE is not set
+CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=0
+# CONFIG_FEATURE_ALLOW_EXEC is not set
+
+#
+# Finding Utilities
+#
+# CONFIG_FIND is not set
+# CONFIG_FEATURE_FIND_PRINT0 is not set
+# CONFIG_FEATURE_FIND_MTIME is not set
+# CONFIG_FEATURE_FIND_MMIN is not set
+# CONFIG_FEATURE_FIND_PERM is not set
+# CONFIG_FEATURE_FIND_TYPE is not set
+# CONFIG_FEATURE_FIND_EXECUTABLE is not set
+# CONFIG_FEATURE_FIND_XDEV is not set
+# CONFIG_FEATURE_FIND_MAXDEPTH is not set
+# CONFIG_FEATURE_FIND_NEWER is not set
+# CONFIG_FEATURE_FIND_INUM is not set
+# CONFIG_FEATURE_FIND_EXEC is not set
+# CONFIG_FEATURE_FIND_EXEC_PLUS is not set
+# CONFIG_FEATURE_FIND_USER is not set
+# CONFIG_FEATURE_FIND_GROUP is not set
+# CONFIG_FEATURE_FIND_NOT is not set
+# CONFIG_FEATURE_FIND_DEPTH is not set
+# CONFIG_FEATURE_FIND_PAREN is not set
+# CONFIG_FEATURE_FIND_SIZE is not set
+# CONFIG_FEATURE_FIND_PRUNE is not set
+# CONFIG_FEATURE_FIND_QUIT is not set
+# CONFIG_FEATURE_FIND_DELETE is not set
+# CONFIG_FEATURE_FIND_EMPTY is not set
+# CONFIG_FEATURE_FIND_PATH is not set
+# CONFIG_FEATURE_FIND_REGEX is not set
+# CONFIG_FEATURE_FIND_CONTEXT is not set
+# CONFIG_FEATURE_FIND_LINKS is not set
+# CONFIG_GREP is not set
+# CONFIG_EGREP is not set
+# CONFIG_FGREP is not set
+# CONFIG_FEATURE_GREP_CONTEXT is not set
+# CONFIG_XARGS is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE is not set
+
+#
+# Init Utilities
+#
+# CONFIG_BOOTCHARTD is not set
+# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
+# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
+# CONFIG_HALT is not set
+# CONFIG_POWEROFF is not set
+# CONFIG_REBOOT is not set
+# CONFIG_FEATURE_WAIT_FOR_INIT is not set
+# CONFIG_FEATURE_CALL_TELINIT is not set
+CONFIG_TELINIT_PATH=""
+# CONFIG_INIT is not set
+# CONFIG_LINUXRC is not set
+# CONFIG_FEATURE_USE_INITTAB is not set
+# CONFIG_FEATURE_KILL_REMOVED is not set
+CONFIG_FEATURE_KILL_DELAY=0
+# CONFIG_FEATURE_INIT_SCTTY is not set
+# CONFIG_FEATURE_INIT_SYSLOG is not set
+# CONFIG_FEATURE_INIT_QUIET is not set
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
+CONFIG_INIT_TERMINAL_TYPE=""
+# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
+
+#
+# Login/Password Management Utilities
+#
+# CONFIG_FEATURE_SHADOWPASSWDS is not set
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_USE_BB_SHADOW is not set
+# CONFIG_USE_BB_CRYPT is not set
+# CONFIG_USE_BB_CRYPT_SHA is not set
+# CONFIG_ADD_SHELL is not set
+# CONFIG_REMOVE_SHELL is not set
+# CONFIG_ADDGROUP is not set
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_FEATURE_CHECK_NAMES is not set
+CONFIG_LAST_ID=0
+CONFIG_FIRST_SYSTEM_ID=0
+CONFIG_LAST_SYSTEM_ID=0
+# CONFIG_CHPASSWD is not set
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512"
+CONFIG_CRYPTPW=y
+# CONFIG_MKPASSWD is not set
+# CONFIG_DELUSER is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
+# CONFIG_GETTY is not set
+# CONFIG_LOGIN is not set
+# CONFIG_LOGIN_SESSION_AS_CHILD is not set
+# CONFIG_LOGIN_SCRIPTS is not set
+# CONFIG_FEATURE_NOLOGIN is not set
+# CONFIG_FEATURE_SECURETTY is not set
+# CONFIG_PASSWD is not set
+# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
+# CONFIG_SU is not set
+# CONFIG_FEATURE_SU_SYSLOG is not set
+# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
+# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Linux Ext2 FS Progs
+#
+# CONFIG_CHATTR is not set
+# CONFIG_FSCK is not set
+# CONFIG_LSATTR is not set
+# CONFIG_TUNE2FS is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_MODPROBE_SMALL is not set
+# CONFIG_DEPMOD is not set
+# CONFIG_INSMOD is not set
+# CONFIG_LSMOD is not set
+# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
+# CONFIG_MODINFO is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
+# CONFIG_RMMOD is not set
+
+#
+# Options common to multiple modutils
+#
+# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
+# CONFIG_FEATURE_2_4_MODULES is not set
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
+# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
+# CONFIG_FEATURE_MODUTILS_ALIAS is not set
+# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
+CONFIG_DEFAULT_MODULES_DIR=""
+CONFIG_DEFAULT_DEPMOD_FILE=""
+
+#
+# Linux System Utilities
+#
+# CONFIG_ACPID is not set
+# CONFIG_FEATURE_ACPID_COMPAT is not set
+# CONFIG_BLKDISCARD is not set
+# CONFIG_BLKID is not set
+# CONFIG_FEATURE_BLKID_TYPE is not set
+# CONFIG_BLOCKDEV is not set
+# CONFIG_CAL is not set
+# CONFIG_CHRT is not set
+# CONFIG_DMESG is not set
+# CONFIG_FEATURE_DMESG_PRETTY is not set
+# CONFIG_EJECT is not set
+# CONFIG_FEATURE_EJECT_SCSI is not set
+# CONFIG_FALLOCATE is not set
+# CONFIG_FATATTR is not set
+# CONFIG_FBSET is not set
+# CONFIG_FEATURE_FBSET_FANCY is not set
+# CONFIG_FEATURE_FBSET_READMODE is not set
+# CONFIG_FDFORMAT is not set
+# CONFIG_FDISK is not set
+# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
+# CONFIG_FEATURE_FDISK_WRITABLE is not set
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+# CONFIG_FEATURE_GPT_LABEL is not set
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
+# CONFIG_FINDFS is not set
+# CONFIG_FLOCK is not set
+# CONFIG_FDFLUSH is not set
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_FSFREEZE is not set
+# CONFIG_FSTRIM is not set
+# CONFIG_GETOPT is not set
+# CONFIG_FEATURE_GETOPT_LONG is not set
+# CONFIG_HEXDUMP is not set
+# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
+# CONFIG_HD is not set
+# CONFIG_XXD is not set
+# CONFIG_HWCLOCK is not set
+# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
+# CONFIG_IONICE is not set
+# CONFIG_IPCRM is not set
+# CONFIG_IPCS is not set
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
+# CONFIG_LOSETUP is not set
+# CONFIG_LSPCI is not set
+# CONFIG_LSUSB is not set
+# CONFIG_MDEV is not set
+# CONFIG_FEATURE_MDEV_CONF is not set
+# CONFIG_FEATURE_MDEV_RENAME is not set
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
+# CONFIG_FEATURE_MDEV_EXEC is not set
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+# CONFIG_FEATURE_MDEV_DAEMON is not set
+# CONFIG_MESG is not set
+# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
+# CONFIG_MKE2FS is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+# CONFIG_MKDOSFS is not set
+# CONFIG_MKFS_VFAT is not set
+# CONFIG_MKSWAP is not set
+# CONFIG_FEATURE_MKSWAP_UUID is not set
+# CONFIG_MORE is not set
+# CONFIG_MOUNT is not set
+# CONFIG_FEATURE_MOUNT_FAKE is not set
+# CONFIG_FEATURE_MOUNT_VERBOSE is not set
+# CONFIG_FEATURE_MOUNT_HELPERS is not set
+# CONFIG_FEATURE_MOUNT_LABEL is not set
+# CONFIG_FEATURE_MOUNT_NFS is not set
+# CONFIG_FEATURE_MOUNT_CIFS is not set
+# CONFIG_FEATURE_MOUNT_FLAGS is not set
+# CONFIG_FEATURE_MOUNT_FSTAB is not set
+# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
+# CONFIG_MOUNTPOINT is not set
+# CONFIG_NOLOGIN is not set
+# CONFIG_NOLOGIN_DEPENDENCIES is not set
+# CONFIG_NSENTER is not set
+# CONFIG_PIVOT_ROOT is not set
+# CONFIG_RDATE is not set
+# CONFIG_RDEV is not set
+# CONFIG_READPROFILE is not set
+# CONFIG_RENICE is not set
+# CONFIG_REV is not set
+# CONFIG_RTCWAKE is not set
+# CONFIG_SCRIPT is not set
+# CONFIG_SCRIPTREPLAY is not set
+# CONFIG_SETARCH is not set
+# CONFIG_LINUX32 is not set
+# CONFIG_LINUX64 is not set
+# CONFIG_SETPRIV is not set
+# CONFIG_FEATURE_SETPRIV_DUMP is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
+# CONFIG_SETSID is not set
+# CONFIG_SWAPON is not set
+# CONFIG_FEATURE_SWAPON_DISCARD is not set
+# CONFIG_FEATURE_SWAPON_PRI is not set
+# CONFIG_SWAPOFF is not set
+# CONFIG_FEATURE_SWAPONOFF_LABEL is not set
+# CONFIG_SWITCH_ROOT is not set
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+# CONFIG_FEATURE_TASKSET_CPULIST is not set
+# CONFIG_UEVENT is not set
+# CONFIG_UMOUNT is not set
+# CONFIG_FEATURE_UMOUNT_ALL is not set
+# CONFIG_UNSHARE is not set
+# CONFIG_WALL is not set
+# CONFIG_FEATURE_MOUNT_LOOP is not set
+# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+# CONFIG_VOLUMEID is not set
+# CONFIG_FEATURE_VOLUMEID_BCACHE is not set
+# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
+# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
+# CONFIG_FEATURE_VOLUMEID_EXFAT is not set
+# CONFIG_FEATURE_VOLUMEID_EXT is not set
+# CONFIG_FEATURE_VOLUMEID_F2FS is not set
+# CONFIG_FEATURE_VOLUMEID_FAT is not set
+# CONFIG_FEATURE_VOLUMEID_HFS is not set
+# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
+# CONFIG_FEATURE_VOLUMEID_JFS is not set
+# CONFIG_FEATURE_VOLUMEID_LFS is not set
+# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
+# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
+# CONFIG_FEATURE_VOLUMEID_LUKS is not set
+# CONFIG_FEATURE_VOLUMEID_MINIX is not set
+# CONFIG_FEATURE_VOLUMEID_NILFS is not set
+# CONFIG_FEATURE_VOLUMEID_NTFS is not set
+# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
+# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
+# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
+# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
+# CONFIG_FEATURE_VOLUMEID_SYSV is not set
+# CONFIG_FEATURE_VOLUMEID_UBIFS is not set
+# CONFIG_FEATURE_VOLUMEID_UDF is not set
+# CONFIG_FEATURE_VOLUMEID_XFS is not set
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_ADJTIMEX is not set
+# CONFIG_BBCONFIG is not set
+# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
+# CONFIG_BC is not set
+# CONFIG_DC is not set
+# CONFIG_FEATURE_DC_BIG is not set
+# CONFIG_FEATURE_DC_LIBM is not set
+# CONFIG_FEATURE_BC_INTERACTIVE is not set
+# CONFIG_FEATURE_BC_LONG_OPTIONS is not set
+# CONFIG_BEEP is not set
+CONFIG_FEATURE_BEEP_FREQ=0
+CONFIG_FEATURE_BEEP_LENGTH_MS=0
+# CONFIG_CHAT is not set
+# CONFIG_FEATURE_CHAT_NOFAIL is not set
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
+# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
+# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
+# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
+# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
+# CONFIG_CONSPY is not set
+# CONFIG_CROND is not set
+# CONFIG_FEATURE_CROND_D is not set
+# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set
+CONFIG_FEATURE_CROND_DIR=""
+# CONFIG_CRONTAB is not set
+# CONFIG_DEVFSD is not set
+# CONFIG_DEVFSD_MODLOAD is not set
+# CONFIG_DEVFSD_FG_NP is not set
+# CONFIG_DEVFSD_VERBOSE is not set
+# CONFIG_FEATURE_DEVFS is not set
+# CONFIG_DEVMEM is not set
+# CONFIG_FBSPLASH is not set
+# CONFIG_FLASH_ERASEALL is not set
+# CONFIG_FLASH_LOCK is not set
+# CONFIG_FLASH_UNLOCK is not set
+# CONFIG_FLASHCP is not set
+# CONFIG_HDPARM is not set
+# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
+# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
+# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_HEXEDIT is not set
+# CONFIG_I2CGET is not set
+# CONFIG_I2CSET is not set
+# CONFIG_I2CDUMP is not set
+# CONFIG_I2CDETECT is not set
+# CONFIG_I2CTRANSFER is not set
+# CONFIG_INOTIFYD is not set
+# CONFIG_LESS is not set
+CONFIG_FEATURE_LESS_MAXLINES=0
+# CONFIG_FEATURE_LESS_BRACKETS is not set
+# CONFIG_FEATURE_LESS_FLAGS is not set
+# CONFIG_FEATURE_LESS_TRUNCATE is not set
+# CONFIG_FEATURE_LESS_MARKS is not set
+# CONFIG_FEATURE_LESS_REGEXP is not set
+# CONFIG_FEATURE_LESS_WINCH is not set
+# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set
+# CONFIG_FEATURE_LESS_DASHCMD is not set
+# CONFIG_FEATURE_LESS_LINENUMS is not set
+# CONFIG_FEATURE_LESS_RAW is not set
+# CONFIG_FEATURE_LESS_ENV is not set
+# CONFIG_LSSCSI is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
+# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
+# CONFIG_MAN is not set
+# CONFIG_MICROCOM is not set
+# CONFIG_MT is not set
+# CONFIG_NANDWRITE is not set
+# CONFIG_NANDDUMP is not set
+# CONFIG_PARTPROBE is not set
+# CONFIG_RAIDAUTORUN is not set
+# CONFIG_READAHEAD is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RUNLEVEL is not set
+# CONFIG_RX is not set
+# CONFIG_SETFATTR is not set
+# CONFIG_SETSERIAL is not set
+# CONFIG_STRINGS is not set
+# CONFIG_TIME is not set
+# CONFIG_TS is not set
+# CONFIG_TTYSIZE is not set
+# CONFIG_UBIATTACH is not set
+# CONFIG_UBIDETACH is not set
+# CONFIG_UBIMKVOL is not set
+# CONFIG_UBIRMVOL is not set
+# CONFIG_UBIRSVOL is not set
+# CONFIG_UBIUPDATEVOL is not set
+# CONFIG_UBIRENAME is not set
+# CONFIG_VOLNAME is not set
+# CONFIG_WATCHDOG is not set
+
+#
+# Networking Utilities
+#
+# CONFIG_FEATURE_IPV6 is not set
+# CONFIG_FEATURE_UNIX_LOCAL is not set
+# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
+# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+# CONFIG_FEATURE_TLS_SHA1 is not set
+# CONFIG_ARP is not set
+# CONFIG_ARPING is not set
+# CONFIG_BRCTL is not set
+# CONFIG_FEATURE_BRCTL_FANCY is not set
+# CONFIG_FEATURE_BRCTL_SHOW is not set
+# CONFIG_DNSD is not set
+# CONFIG_ETHER_WAKE is not set
+# CONFIG_FTPD is not set
+# CONFIG_FEATURE_FTPD_WRITE is not set
+# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
+# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
+# CONFIG_FTPGET is not set
+# CONFIG_FTPPUT is not set
+# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
+# CONFIG_HOSTNAME is not set
+# CONFIG_DNSDOMAINNAME is not set
+# CONFIG_HTTPD is not set
+# CONFIG_FEATURE_HTTPD_RANGES is not set
+# CONFIG_FEATURE_HTTPD_SETUID is not set
+# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
+# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
+# CONFIG_FEATURE_HTTPD_CGI is not set
+# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
+# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
+# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
+# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
+# CONFIG_FEATURE_HTTPD_PROXY is not set
+# CONFIG_FEATURE_HTTPD_GZIP is not set
+# CONFIG_IFCONFIG is not set
+# CONFIG_FEATURE_IFCONFIG_STATUS is not set
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
+# CONFIG_FEATURE_IFCONFIG_HW is not set
+# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
+# CONFIG_IFENSLAVE is not set
+# CONFIG_IFPLUGD is not set
+# CONFIG_IFUP is not set
+# CONFIG_IFDOWN is not set
+CONFIG_IFUPDOWN_IFSTATE_PATH=""
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
+# CONFIG_INETD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+# CONFIG_IP is not set
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_IPRULE is not set
+# CONFIG_IPNEIGH is not set
+# CONFIG_FEATURE_IP_ADDRESS is not set
+# CONFIG_FEATURE_IP_LINK is not set
+# CONFIG_FEATURE_IP_ROUTE is not set
+CONFIG_FEATURE_IP_ROUTE_DIR=""
+# CONFIG_FEATURE_IP_TUNNEL is not set
+# CONFIG_FEATURE_IP_RULE is not set
+# CONFIG_FEATURE_IP_NEIGH is not set
+# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
+# CONFIG_IPCALC is not set
+# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+# CONFIG_FEATURE_IPCALC_FANCY is not set
+# CONFIG_FAKEIDENTD is not set
+# CONFIG_NAMEIF is not set
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
+# CONFIG_NBDCLIENT is not set
+# CONFIG_NC is not set
+# CONFIG_NETCAT is not set
+# CONFIG_NC_SERVER is not set
+# CONFIG_NC_EXTRA is not set
+# CONFIG_NC_110_COMPAT is not set
+# CONFIG_NETSTAT is not set
+# CONFIG_FEATURE_NETSTAT_WIDE is not set
+# CONFIG_FEATURE_NETSTAT_PRG is not set
+# CONFIG_NSLOOKUP is not set
+# CONFIG_FEATURE_NSLOOKUP_BIG is not set
+# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
+# CONFIG_NTPD is not set
+# CONFIG_FEATURE_NTPD_SERVER is not set
+# CONFIG_FEATURE_NTPD_CONF is not set
+# CONFIG_FEATURE_NTP_AUTH is not set
+# CONFIG_PING is not set
+# CONFIG_PING6 is not set
+# CONFIG_FEATURE_FANCY_PING is not set
+# CONFIG_PSCAN is not set
+# CONFIG_ROUTE is not set
+# CONFIG_SLATTACH is not set
+# CONFIG_SSL_CLIENT is not set
+# CONFIG_TC is not set
+# CONFIG_FEATURE_TC_INGRESS is not set
+# CONFIG_TCPSVD is not set
+# CONFIG_UDPSVD is not set
+# CONFIG_TELNET is not set
+# CONFIG_FEATURE_TELNET_TTYPE is not set
+# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
+# CONFIG_FEATURE_TELNET_WIDTH is not set
+# CONFIG_TELNETD is not set
+# CONFIG_FEATURE_TELNETD_STANDALONE is not set
+# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
+# CONFIG_TFTP is not set
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set
+# CONFIG_TFTPD is not set
+# CONFIG_FEATURE_TFTP_GET is not set
+# CONFIG_FEATURE_TFTP_PUT is not set
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_TFTP_DEBUG is not set
+# CONFIG_TLS is not set
+# CONFIG_TRACEROUTE is not set
+# CONFIG_TRACEROUTE6 is not set
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
+# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
+# CONFIG_TUNCTL is not set
+# CONFIG_FEATURE_TUNCTL_UG is not set
+# CONFIG_VCONFIG is not set
+# CONFIG_WGET is not set
+# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
+# CONFIG_FEATURE_WGET_STATUSBAR is not set
+# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
+# CONFIG_FEATURE_WGET_TIMEOUT is not set
+# CONFIG_FEATURE_WGET_HTTPS is not set
+# CONFIG_FEATURE_WGET_OPENSSL is not set
+# CONFIG_WHOIS is not set
+# CONFIG_ZCIP is not set
+# CONFIG_UDHCPD is not set
+# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
+CONFIG_DHCPD_LEASES_FILE=""
+# CONFIG_DUMPLEASES is not set
+# CONFIG_DHCPRELAY is not set
+# CONFIG_UDHCPC is not set
+# CONFIG_FEATURE_UDHCPC_ARPING is not set
+# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
+CONFIG_UDHCPC_DEFAULT_SCRIPT=""
+# CONFIG_UDHCPC6 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
+# CONFIG_FEATURE_UDHCP_PORT is not set
+CONFIG_UDHCP_DEBUG=0
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
+# CONFIG_FEATURE_UDHCP_RFC3397 is not set
+# CONFIG_FEATURE_UDHCP_8021Q is not set
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
+
+#
+# Print Utilities
+#
+# CONFIG_LPD is not set
+# CONFIG_LPR is not set
+# CONFIG_LPQ is not set
+
+#
+# Mail Utilities
+#
+# CONFIG_MAKEMIME is not set
+# CONFIG_POPMAILDIR is not set
+# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
+# CONFIG_REFORMIME is not set
+# CONFIG_FEATURE_REFORMIME_COMPAT is not set
+# CONFIG_SENDMAIL is not set
+CONFIG_FEATURE_MIME_CHARSET=""
+
+#
+# Process Utilities
+#
+# CONFIG_FREE is not set
+# CONFIG_FUSER is not set
+# CONFIG_IOSTAT is not set
+# CONFIG_KILL is not set
+# CONFIG_KILLALL is not set
+# CONFIG_KILLALL5 is not set
+# CONFIG_LSOF is not set
+# CONFIG_MPSTAT is not set
+# CONFIG_NMETER is not set
+# CONFIG_PGREP is not set
+# CONFIG_PKILL is not set
+# CONFIG_PIDOF is not set
+# CONFIG_FEATURE_PIDOF_SINGLE is not set
+# CONFIG_FEATURE_PIDOF_OMIT is not set
+# CONFIG_PMAP is not set
+# CONFIG_POWERTOP is not set
+# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
+# CONFIG_PS is not set
+# CONFIG_FEATURE_PS_WIDE is not set
+# CONFIG_FEATURE_PS_LONG is not set
+# CONFIG_FEATURE_PS_TIME is not set
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
+# CONFIG_PSTREE is not set
+# CONFIG_PWDX is not set
+# CONFIG_SMEMCAP is not set
+# CONFIG_BB_SYSCTL is not set
+# CONFIG_TOP is not set
+# CONFIG_FEATURE_TOP_INTERACTIVE is not set
+# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set
+# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set
+# CONFIG_FEATURE_TOP_SMP_CPU is not set
+# CONFIG_FEATURE_TOP_DECIMALS is not set
+# CONFIG_FEATURE_TOP_SMP_PROCESS is not set
+# CONFIG_FEATURE_TOPMEM is not set
+# CONFIG_UPTIME is not set
+# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
+# CONFIG_WATCH is not set
+# CONFIG_FEATURE_SHOW_THREADS is not set
+
+#
+# Runit Utilities
+#
+# CONFIG_CHPST is not set
+# CONFIG_SETUIDGID is not set
+# CONFIG_ENVUIDGID is not set
+# CONFIG_ENVDIR is not set
+# CONFIG_SOFTLIMIT is not set
+# CONFIG_RUNSV is not set
+# CONFIG_RUNSVDIR is not set
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
+# CONFIG_SV is not set
+CONFIG_SV_DEFAULT_SERVICE_DIR=""
+# CONFIG_SVC is not set
+# CONFIG_SVOK is not set
+# CONFIG_SVLOGD is not set
+# CONFIG_CHCON is not set
+# CONFIG_GETENFORCE is not set
+# CONFIG_GETSEBOOL is not set
+# CONFIG_LOAD_POLICY is not set
+# CONFIG_MATCHPATHCON is not set
+# CONFIG_RUNCON is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_SESTATUS is not set
+# CONFIG_SETENFORCE is not set
+# CONFIG_SETFILES is not set
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_RESTORECON is not set
+# CONFIG_SETSEBOOL is not set
+
+#
+# Shells
+#
+# CONFIG_SH_IS_ASH is not set
+# CONFIG_SH_IS_HUSH is not set
+CONFIG_SH_IS_NONE=y
+# CONFIG_BASH_IS_ASH is not set
+# CONFIG_BASH_IS_HUSH is not set
+CONFIG_BASH_IS_NONE=y
+# CONFIG_ASH is not set
+# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set
+# CONFIG_ASH_INTERNAL_GLOB is not set
+# CONFIG_ASH_BASH_COMPAT is not set
+# CONFIG_ASH_BASH_SOURCE_CURDIR is not set
+# CONFIG_ASH_BASH_NOT_FOUND_HOOK is not set
+# CONFIG_ASH_JOB_CONTROL is not set
+# CONFIG_ASH_ALIAS is not set
+# CONFIG_ASH_RANDOM_SUPPORT is not set
+# CONFIG_ASH_EXPAND_PRMT is not set
+# CONFIG_ASH_IDLE_TIMEOUT is not set
+# CONFIG_ASH_MAIL is not set
+# CONFIG_ASH_ECHO is not set
+# CONFIG_ASH_PRINTF is not set
+# CONFIG_ASH_TEST is not set
+# CONFIG_ASH_HELP is not set
+# CONFIG_ASH_GETOPTS is not set
+# CONFIG_ASH_CMDCMD is not set
+# CONFIG_CTTYHACK is not set
+# CONFIG_HUSH is not set
+# CONFIG_HUSH_BASH_COMPAT is not set
+# CONFIG_HUSH_BRACE_EXPANSION is not set
+# CONFIG_HUSH_LINENO_VAR is not set
+# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
+# CONFIG_HUSH_INTERACTIVE is not set
+# CONFIG_HUSH_SAVEHISTORY is not set
+# CONFIG_HUSH_JOB is not set
+# CONFIG_HUSH_TICK is not set
+# CONFIG_HUSH_IF is not set
+# CONFIG_HUSH_LOOPS is not set
+# CONFIG_HUSH_CASE is not set
+# CONFIG_HUSH_FUNCTIONS is not set
+# CONFIG_HUSH_LOCAL is not set
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH_MODE_X is not set
+# CONFIG_HUSH_ECHO is not set
+# CONFIG_HUSH_PRINTF is not set
+# CONFIG_HUSH_TEST is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_EXPORT is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_READONLY is not set
+# CONFIG_HUSH_KILL is not set
+# CONFIG_HUSH_WAIT is not set
+# CONFIG_HUSH_COMMAND is not set
+# CONFIG_HUSH_TRAP is not set
+# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_TIMES is not set
+# CONFIG_HUSH_READ is not set
+# CONFIG_HUSH_SET is not set
+# CONFIG_HUSH_UNSET is not set
+# CONFIG_HUSH_ULIMIT is not set
+# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_GETOPTS is not set
+# CONFIG_HUSH_MEMLEAK is not set
+# CONFIG_SHELL_HUSH is not set
+
+#
+# Options common to all shells
+#
+# CONFIG_FEATURE_SH_MATH is not set
+# CONFIG_FEATURE_SH_MATH_64 is not set
+# CONFIG_FEATURE_SH_MATH_BASE is not set
+# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
+# CONFIG_FEATURE_SH_STANDALONE is not set
+# CONFIG_FEATURE_SH_NOFORK is not set
+# CONFIG_FEATURE_SH_READ_FRAC is not set
+# CONFIG_FEATURE_SH_HISTFILESIZE is not set
+# CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS is not set
+
+#
+# System Logging Utilities
+#
+# CONFIG_KLOGD is not set
+# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
+# CONFIG_LOGGER is not set
+# CONFIG_LOGREAD is not set
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+# CONFIG_SYSLOGD is not set
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+# CONFIG_FEATURE_REMOTE_LOG is not set
+# CONFIG_FEATURE_SYSLOGD_DUP is not set
+# CONFIG_FEATURE_SYSLOGD_CFG is not set
+# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
+# CONFIG_FEATURE_IPC_SYSLOG is not set
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
+# CONFIG_FEATURE_KMSG_SYSLOG is not set
diff --git a/projects/L4T/packages/busybox/config/busybox-init.conf b/projects/L4T/packages/busybox/config/busybox-init.conf
new file mode 100644
index 00000000000..3a9c8bd195f
--- /dev/null
+++ b/projects/L4T/packages/busybox/config/busybox-init.conf
@@ -0,0 +1,1188 @@
+#
+# Automatically generated make config: don't edit
+# Busybox version: 1.32.0.git
+# Sun Feb 2 19:50:06 2020
+#
+CONFIG_HAVE_DOT_CONFIG=y
+
+#
+# Settings
+#
+# CONFIG_DESKTOP is not set
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_FEDORA_COMPAT is not set
+# CONFIG_INCLUDE_SUSv2 is not set
+CONFIG_LONG_OPTS=y
+CONFIG_SHOW_USAGE=y
+CONFIG_FEATURE_VERBOSE_USAGE=y
+# CONFIG_FEATURE_COMPRESS_USAGE is not set
+CONFIG_LFS=y
+# CONFIG_PAM is not set
+CONFIG_FEATURE_DEVPTS=y
+# CONFIG_FEATURE_UTMP is not set
+# CONFIG_FEATURE_WTMP is not set
+# CONFIG_FEATURE_PIDFILE is not set
+CONFIG_PID_FILE_PATH=""
+CONFIG_BUSYBOX=y
+CONFIG_FEATURE_SHOW_SCRIPT=y
+# CONFIG_FEATURE_INSTALLER is not set
+CONFIG_INSTALL_NO_USR=y
+# CONFIG_FEATURE_SUID is not set
+# CONFIG_FEATURE_SUID_CONFIG is not set
+# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
+CONFIG_FEATURE_PREFER_APPLETS=y
+CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_CLEAN_UP is not set
+# CONFIG_FEATURE_SYSLOG_INFO is not set
+# CONFIG_FEATURE_SYSLOG is not set
+CONFIG_PLATFORM_LINUX=y
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+# CONFIG_PIE is not set
+# CONFIG_NOMMU is not set
+# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
+# CONFIG_FEATURE_INDIVIDUAL is not set
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
+CONFIG_CROSS_COMPILER_PREFIX=""
+CONFIG_SYSROOT=""
+CONFIG_EXTRA_CFLAGS=""
+CONFIG_EXTRA_LDFLAGS=""
+CONFIG_EXTRA_LDLIBS="-ltirpc -lpthread"
+# CONFIG_USE_PORTABLE_CODE is not set
+# CONFIG_STACK_OPTIMIZATION_386 is not set
+
+#
+# Installation Options ("make install" behavior)
+#
+# CONFIG_INSTALL_APPLET_SYMLINKS is not set
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
+CONFIG_INSTALL_APPLET_DONT=y
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
+CONFIG_PREFIX="./_install-initramfs"
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+# CONFIG_DEBUG_SANITIZE is not set
+# CONFIG_UNIT_TEST is not set
+# CONFIG_WERROR is not set
+# CONFIG_WARN_SIMPLE_MSG is not set
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Library Tuning
+#
+# CONFIG_FEATURE_USE_BSS_TAIL is not set
+CONFIG_FLOAT_DURATION=y
+# CONFIG_FEATURE_RTMINMAX is not set
+# CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS is not set
+# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
+CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_PASSWORD_MINLEN=6
+CONFIG_MD5_SMALL=0
+CONFIG_SHA3_SMALL=0
+CONFIG_FEATURE_FAST_TOP=y
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+# CONFIG_FEATURE_ETC_SERVICES is not set
+CONFIG_FEATURE_EDITING=y
+CONFIG_FEATURE_EDITING_MAX_LEN=1024
+# CONFIG_FEATURE_EDITING_VI is not set
+CONFIG_FEATURE_EDITING_HISTORY=15
+# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
+# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
+# CONFIG_FEATURE_REVERSE_SEARCH is not set
+CONFIG_FEATURE_TAB_COMPLETION=y
+# CONFIG_FEATURE_USERNAME_COMPLETION is not set
+# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set
+# CONFIG_FEATURE_EDITING_WINCH is not set
+# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
+# CONFIG_LOCALE_SUPPORT is not set
+CONFIG_UNICODE_SUPPORT=y
+# CONFIG_UNICODE_USING_LOCALE is not set
+# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
+CONFIG_SUBST_WCHAR=63
+CONFIG_LAST_SUPPORTED_WCHAR=767
+# CONFIG_UNICODE_COMBINING_WCHARS is not set
+# CONFIG_UNICODE_WIDE_WCHARS is not set
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
+# CONFIG_FEATURE_NON_POSIX_CP is not set
+CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
+CONFIG_FEATURE_USE_SENDFILE=y
+CONFIG_FEATURE_COPYBUF_KB=4
+CONFIG_FEATURE_SKIP_ROOTFS=y
+# CONFIG_MONOTONIC_SYSCALL is not set
+# CONFIG_IOCTL_HEX2STR_ERROR is not set
+# CONFIG_FEATURE_HWIB is not set
+
+#
+# Applets
+#
+
+#
+# Archival Utilities
+#
+CONFIG_FEATURE_SEAMLESS_XZ=y
+CONFIG_FEATURE_SEAMLESS_LZMA=y
+CONFIG_FEATURE_SEAMLESS_BZ2=y
+CONFIG_FEATURE_SEAMLESS_GZ=y
+# CONFIG_FEATURE_SEAMLESS_Z is not set
+# CONFIG_AR is not set
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
+# CONFIG_FEATURE_AR_CREATE is not set
+# CONFIG_UNCOMPRESS is not set
+CONFIG_GUNZIP=y
+# CONFIG_ZCAT is not set
+# CONFIG_FEATURE_GUNZIP_LONG_OPTIONS is not set
+# CONFIG_BUNZIP2 is not set
+# CONFIG_BZCAT is not set
+# CONFIG_UNLZMA is not set
+# CONFIG_LZCAT is not set
+# CONFIG_LZMA is not set
+# CONFIG_UNXZ is not set
+# CONFIG_XZCAT is not set
+# CONFIG_XZ is not set
+# CONFIG_BZIP2 is not set
+CONFIG_BZIP2_SMALL=0
+# CONFIG_FEATURE_BZIP2_DECOMPRESS is not set
+# CONFIG_CPIO is not set
+# CONFIG_FEATURE_CPIO_O is not set
+# CONFIG_FEATURE_CPIO_P is not set
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+CONFIG_GZIP=y
+# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
+CONFIG_GZIP_FAST=0
+CONFIG_FEATURE_GZIP_LEVELS=y
+CONFIG_FEATURE_GZIP_DECOMPRESS=y
+# CONFIG_LZOP is not set
+# CONFIG_UNLZOP is not set
+# CONFIG_LZOPCAT is not set
+# CONFIG_LZOP_COMPR_HIGH is not set
+# CONFIG_RPM is not set
+# CONFIG_RPM2CPIO is not set
+CONFIG_TAR=y
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+# CONFIG_FEATURE_TAR_CREATE is not set
+CONFIG_FEATURE_TAR_AUTODETECT=y
+# CONFIG_FEATURE_TAR_FROM is not set
+# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
+CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
+# CONFIG_FEATURE_TAR_TO_COMMAND is not set
+# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
+# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set
+# CONFIG_FEATURE_TAR_SELINUX is not set
+# CONFIG_UNZIP is not set
+# CONFIG_FEATURE_UNZIP_CDF is not set
+# CONFIG_FEATURE_UNZIP_BZIP2 is not set
+# CONFIG_FEATURE_UNZIP_LZMA is not set
+# CONFIG_FEATURE_UNZIP_XZ is not set
+# CONFIG_FEATURE_LZMA_FAST is not set
+
+#
+# Coreutils
+#
+CONFIG_BASENAME=y
+CONFIG_CAT=y
+CONFIG_FEATURE_CATN=y
+# CONFIG_FEATURE_CATV is not set
+# CONFIG_CHGRP is not set
+# CONFIG_CHMOD is not set
+# CONFIG_CHOWN is not set
+# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
+CONFIG_CHROOT=y
+# CONFIG_CKSUM is not set
+# CONFIG_COMM is not set
+CONFIG_CP=y
+# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
+# CONFIG_FEATURE_CP_REFLINK is not set
+# CONFIG_CUT is not set
+# CONFIG_DATE is not set
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+# CONFIG_FEATURE_DATE_NANO is not set
+# CONFIG_FEATURE_DATE_COMPAT is not set
+CONFIG_DD=y
+CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
+CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
+CONFIG_FEATURE_DD_IBS_OBS=y
+CONFIG_FEATURE_DD_STATUS=y
+CONFIG_DF=y
+# CONFIG_FEATURE_DF_FANCY is not set
+# CONFIG_DIRNAME is not set
+# CONFIG_DOS2UNIX is not set
+# CONFIG_UNIX2DOS is not set
+# CONFIG_DU is not set
+# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set
+# CONFIG_ECHO is not set
+CONFIG_FEATURE_FANCY_ECHO=y
+# CONFIG_ENV is not set
+# CONFIG_EXPAND is not set
+# CONFIG_UNEXPAND is not set
+# CONFIG_EXPR is not set
+# CONFIG_EXPR_MATH_SUPPORT_64 is not set
+# CONFIG_FACTOR is not set
+# CONFIG_FALSE is not set
+# CONFIG_FOLD is not set
+CONFIG_HEAD=y
+# CONFIG_FEATURE_FANCY_HEAD is not set
+# CONFIG_HOSTID is not set
+# CONFIG_ID is not set
+# CONFIG_GROUPS is not set
+# CONFIG_INSTALL is not set
+# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
+# CONFIG_LINK is not set
+# CONFIG_LN is not set
+# CONFIG_LOGNAME is not set
+CONFIG_LS=y
+# CONFIG_FEATURE_LS_FILETYPES is not set
+# CONFIG_FEATURE_LS_FOLLOWLINKS is not set
+# CONFIG_FEATURE_LS_RECURSIVE is not set
+# CONFIG_FEATURE_LS_WIDTH is not set
+# CONFIG_FEATURE_LS_SORTFILES is not set
+# CONFIG_FEATURE_LS_TIMESTAMPS is not set
+# CONFIG_FEATURE_LS_USERNAME is not set
+# CONFIG_FEATURE_LS_COLOR is not set
+# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
+CONFIG_MD5SUM=y
+# CONFIG_SHA1SUM is not set
+# CONFIG_SHA256SUM is not set
+# CONFIG_SHA512SUM is not set
+# CONFIG_SHA3SUM is not set
+
+#
+# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
+#
+CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
+CONFIG_MKDIR=y
+# CONFIG_MKFIFO is not set
+CONFIG_MKNOD=y
+# CONFIG_MKTEMP is not set
+CONFIG_MV=y
+CONFIG_NICE=y
+# CONFIG_NL is not set
+# CONFIG_NOHUP is not set
+# CONFIG_NPROC is not set
+# CONFIG_OD is not set
+# CONFIG_PASTE is not set
+# CONFIG_PRINTENV is not set
+# CONFIG_PRINTF is not set
+# CONFIG_PWD is not set
+# CONFIG_READLINK is not set
+# CONFIG_FEATURE_READLINK_FOLLOW is not set
+# CONFIG_REALPATH is not set
+CONFIG_RM=y
+# CONFIG_RMDIR is not set
+# CONFIG_SEQ is not set
+# CONFIG_SHRED is not set
+# CONFIG_SHUF is not set
+CONFIG_SLEEP=y
+# CONFIG_FEATURE_FANCY_SLEEP is not set
+# CONFIG_SORT is not set
+# CONFIG_FEATURE_SORT_BIG is not set
+# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
+# CONFIG_SPLIT is not set
+# CONFIG_FEATURE_SPLIT_FANCY is not set
+CONFIG_STAT=y
+# CONFIG_FEATURE_STAT_FORMAT is not set
+# CONFIG_FEATURE_STAT_FILESYSTEM is not set
+# CONFIG_STTY is not set
+# CONFIG_SUM is not set
+CONFIG_SYNC=y
+CONFIG_FEATURE_SYNC_FANCY=y
+# CONFIG_FSYNC is not set
+# CONFIG_TAC is not set
+CONFIG_TAIL=y
+CONFIG_FEATURE_FANCY_TAIL=y
+# CONFIG_TEE is not set
+# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
+# CONFIG_TEST is not set
+# CONFIG_TEST1 is not set
+# CONFIG_TEST2 is not set
+CONFIG_FEATURE_TEST_64=y
+# CONFIG_TIMEOUT is not set
+# CONFIG_TOUCH is not set
+# CONFIG_FEATURE_TOUCH_NODEREF is not set
+# CONFIG_FEATURE_TOUCH_SUSV3 is not set
+CONFIG_TR=y
+CONFIG_FEATURE_TR_CLASSES=y
+CONFIG_FEATURE_TR_EQUIV=y
+# CONFIG_TRUE is not set
+# CONFIG_TRUNCATE is not set
+# CONFIG_TTY is not set
+CONFIG_UNAME=y
+CONFIG_UNAME_OSNAME="GNU/Linux"
+# CONFIG_BB_ARCH is not set
+# CONFIG_UNIQ is not set
+# CONFIG_UNLINK is not set
+CONFIG_USLEEP=y
+# CONFIG_UUDECODE is not set
+# CONFIG_BASE64 is not set
+# CONFIG_UUENCODE is not set
+# CONFIG_WC is not set
+# CONFIG_FEATURE_WC_LARGE is not set
+# CONFIG_WHO is not set
+# CONFIG_W is not set
+# CONFIG_USERS is not set
+# CONFIG_WHOAMI is not set
+# CONFIG_YES is not set
+
+#
+# Common options
+#
+# CONFIG_FEATURE_VERBOSE is not set
+
+#
+# Common options for cp and mv
+#
+# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
+
+#
+# Common options for df, du, ls
+#
+# CONFIG_FEATURE_HUMAN_READABLE is not set
+
+#
+# Console Utilities
+#
+CONFIG_CHVT=y
+CONFIG_CLEAR=y
+# CONFIG_DEALLOCVT is not set
+# CONFIG_DUMPKMAP is not set
+# CONFIG_FGCONSOLE is not set
+# CONFIG_KBD_MODE is not set
+# CONFIG_LOADFONT is not set
+CONFIG_SETFONT=y
+# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
+CONFIG_DEFAULT_SETFONT_DIR="/usr/share"
+
+#
+# Common options for loadfont and setfont
+#
+CONFIG_FEATURE_LOADFONT_PSF2=y
+# CONFIG_FEATURE_LOADFONT_RAW is not set
+# CONFIG_LOADKMAP is not set
+# CONFIG_OPENVT is not set
+# CONFIG_RESET is not set
+# CONFIG_RESIZE is not set
+# CONFIG_FEATURE_RESIZE_PRINT is not set
+# CONFIG_SETCONSOLE is not set
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
+# CONFIG_SETKEYCODES is not set
+# CONFIG_SETLOGCONS is not set
+# CONFIG_SHOWKEY is not set
+
+#
+# Debian Utilities
+#
+# CONFIG_PIPE_PROGRESS is not set
+# CONFIG_RUN_PARTS is not set
+# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
+# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
+# CONFIG_START_STOP_DAEMON is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
+# CONFIG_WHICH is not set
+
+#
+# klibc-utils
+#
+# CONFIG_MINIPS is not set
+# CONFIG_NUKE is not set
+# CONFIG_RESUME is not set
+# CONFIG_RUN_INIT is not set
+
+#
+# Editors
+#
+CONFIG_AWK=y
+# CONFIG_FEATURE_AWK_LIBM is not set
+CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y
+# CONFIG_CMP is not set
+# CONFIG_DIFF is not set
+# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
+# CONFIG_FEATURE_DIFF_DIR is not set
+# CONFIG_ED is not set
+# CONFIG_PATCH is not set
+CONFIG_SED=y
+CONFIG_VI=y
+CONFIG_FEATURE_VI_MAX_LEN=4096
+# CONFIG_FEATURE_VI_8BIT is not set
+CONFIG_FEATURE_VI_COLON=y
+CONFIG_FEATURE_VI_YANKMARK=y
+CONFIG_FEATURE_VI_SEARCH=y
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+CONFIG_FEATURE_VI_USE_SIGNALS=y
+CONFIG_FEATURE_VI_DOT_CMD=y
+CONFIG_FEATURE_VI_READONLY=y
+CONFIG_FEATURE_VI_SETOPTS=y
+CONFIG_FEATURE_VI_SET=y
+CONFIG_FEATURE_VI_WIN_RESIZE=y
+CONFIG_FEATURE_VI_ASK_TERMINAL=y
+CONFIG_FEATURE_VI_UNDO=y
+CONFIG_FEATURE_VI_UNDO_QUEUE=y
+CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
+CONFIG_FEATURE_ALLOW_EXEC=y
+
+#
+# Finding Utilities
+#
+# CONFIG_FIND is not set
+# CONFIG_FEATURE_FIND_PRINT0 is not set
+# CONFIG_FEATURE_FIND_MTIME is not set
+# CONFIG_FEATURE_FIND_MMIN is not set
+# CONFIG_FEATURE_FIND_PERM is not set
+# CONFIG_FEATURE_FIND_TYPE is not set
+# CONFIG_FEATURE_FIND_EXECUTABLE is not set
+# CONFIG_FEATURE_FIND_XDEV is not set
+# CONFIG_FEATURE_FIND_MAXDEPTH is not set
+# CONFIG_FEATURE_FIND_NEWER is not set
+# CONFIG_FEATURE_FIND_INUM is not set
+# CONFIG_FEATURE_FIND_EXEC is not set
+# CONFIG_FEATURE_FIND_EXEC_PLUS is not set
+# CONFIG_FEATURE_FIND_USER is not set
+# CONFIG_FEATURE_FIND_GROUP is not set
+# CONFIG_FEATURE_FIND_NOT is not set
+# CONFIG_FEATURE_FIND_DEPTH is not set
+# CONFIG_FEATURE_FIND_PAREN is not set
+# CONFIG_FEATURE_FIND_SIZE is not set
+# CONFIG_FEATURE_FIND_PRUNE is not set
+# CONFIG_FEATURE_FIND_QUIT is not set
+# CONFIG_FEATURE_FIND_DELETE is not set
+# CONFIG_FEATURE_FIND_EMPTY is not set
+# CONFIG_FEATURE_FIND_PATH is not set
+# CONFIG_FEATURE_FIND_REGEX is not set
+# CONFIG_FEATURE_FIND_CONTEXT is not set
+# CONFIG_FEATURE_FIND_LINKS is not set
+CONFIG_GREP=y
+# CONFIG_EGREP is not set
+# CONFIG_FGREP is not set
+CONFIG_FEATURE_GREP_CONTEXT=y
+# CONFIG_XARGS is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE is not set
+
+#
+# Init Utilities
+#
+# CONFIG_BOOTCHARTD is not set
+# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
+# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
+CONFIG_HALT=y
+CONFIG_POWEROFF=y
+CONFIG_REBOOT=y
+CONFIG_FEATURE_WAIT_FOR_INIT=y
+# CONFIG_FEATURE_CALL_TELINIT is not set
+CONFIG_TELINIT_PATH=""
+# CONFIG_INIT is not set
+# CONFIG_LINUXRC is not set
+# CONFIG_FEATURE_USE_INITTAB is not set
+# CONFIG_FEATURE_KILL_REMOVED is not set
+CONFIG_FEATURE_KILL_DELAY=0
+# CONFIG_FEATURE_INIT_SCTTY is not set
+# CONFIG_FEATURE_INIT_SYSLOG is not set
+# CONFIG_FEATURE_INIT_QUIET is not set
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
+CONFIG_INIT_TERMINAL_TYPE=""
+# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
+
+#
+# Login/Password Management Utilities
+#
+# CONFIG_FEATURE_SHADOWPASSWDS is not set
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_USE_BB_SHADOW is not set
+# CONFIG_USE_BB_CRYPT is not set
+# CONFIG_USE_BB_CRYPT_SHA is not set
+# CONFIG_ADD_SHELL is not set
+# CONFIG_REMOVE_SHELL is not set
+# CONFIG_ADDGROUP is not set
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_FEATURE_CHECK_NAMES is not set
+CONFIG_LAST_ID=0
+CONFIG_FIRST_SYSTEM_ID=0
+CONFIG_LAST_SYSTEM_ID=0
+# CONFIG_CHPASSWD is not set
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
+# CONFIG_CRYPTPW is not set
+# CONFIG_MKPASSWD is not set
+# CONFIG_DELUSER is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
+# CONFIG_GETTY is not set
+# CONFIG_LOGIN is not set
+# CONFIG_LOGIN_SESSION_AS_CHILD is not set
+# CONFIG_LOGIN_SCRIPTS is not set
+# CONFIG_FEATURE_NOLOGIN is not set
+# CONFIG_FEATURE_SECURETTY is not set
+# CONFIG_PASSWD is not set
+# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
+# CONFIG_SU is not set
+# CONFIG_FEATURE_SU_SYSLOG is not set
+# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
+# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Linux Ext2 FS Progs
+#
+# CONFIG_CHATTR is not set
+# CONFIG_FSCK is not set
+# CONFIG_LSATTR is not set
+# CONFIG_TUNE2FS is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_MODPROBE_SMALL is not set
+# CONFIG_DEPMOD is not set
+CONFIG_INSMOD=y
+# CONFIG_LSMOD is not set
+# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
+# CONFIG_MODINFO is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
+# CONFIG_RMMOD is not set
+
+#
+# Options common to multiple modutils
+#
+# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
+# CONFIG_FEATURE_2_4_MODULES is not set
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
+# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
+# CONFIG_FEATURE_MODUTILS_ALIAS is not set
+# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
+CONFIG_DEFAULT_MODULES_DIR=""
+CONFIG_DEFAULT_DEPMOD_FILE=""
+
+#
+# Linux System Utilities
+#
+# CONFIG_ACPID is not set
+# CONFIG_FEATURE_ACPID_COMPAT is not set
+# CONFIG_BLKDISCARD is not set
+CONFIG_BLKID=y
+CONFIG_FEATURE_BLKID_TYPE=y
+# CONFIG_BLOCKDEV is not set
+# CONFIG_CAL is not set
+# CONFIG_CHRT is not set
+CONFIG_DMESG=y
+# CONFIG_FEATURE_DMESG_PRETTY is not set
+# CONFIG_EJECT is not set
+# CONFIG_FEATURE_EJECT_SCSI is not set
+# CONFIG_FALLOCATE is not set
+# CONFIG_FATATTR is not set
+CONFIG_FBSET=y
+CONFIG_FEATURE_FBSET_FANCY=y
+CONFIG_FEATURE_FBSET_READMODE=y
+# CONFIG_FDFORMAT is not set
+CONFIG_FDISK=y
+# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
+CONFIG_FEATURE_FDISK_WRITABLE=y
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+CONFIG_FEATURE_GPT_LABEL=y
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
+# CONFIG_FINDFS is not set
+# CONFIG_FLOCK is not set
+# CONFIG_FDFLUSH is not set
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_FSFREEZE is not set
+# CONFIG_FSTRIM is not set
+# CONFIG_GETOPT is not set
+# CONFIG_FEATURE_GETOPT_LONG is not set
+# CONFIG_HEXDUMP is not set
+# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
+# CONFIG_HD is not set
+# CONFIG_XXD is not set
+# CONFIG_HWCLOCK is not set
+# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
+CONFIG_IONICE=y
+# CONFIG_IPCRM is not set
+# CONFIG_IPCS is not set
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
+CONFIG_LOSETUP=y
+# CONFIG_LSPCI is not set
+# CONFIG_LSUSB is not set
+# CONFIG_MDEV is not set
+# CONFIG_FEATURE_MDEV_CONF is not set
+# CONFIG_FEATURE_MDEV_RENAME is not set
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
+# CONFIG_FEATURE_MDEV_EXEC is not set
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+# CONFIG_FEATURE_MDEV_DAEMON is not set
+# CONFIG_MESG is not set
+# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
+# CONFIG_MKE2FS is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+# CONFIG_MKDOSFS is not set
+# CONFIG_MKFS_VFAT is not set
+# CONFIG_MKSWAP is not set
+# CONFIG_FEATURE_MKSWAP_UUID is not set
+# CONFIG_MORE is not set
+CONFIG_MOUNT=y
+CONFIG_FEATURE_MOUNT_FAKE=y
+# CONFIG_FEATURE_MOUNT_VERBOSE is not set
+# CONFIG_FEATURE_MOUNT_HELPERS is not set
+CONFIG_FEATURE_MOUNT_LABEL=y
+# CONFIG_FEATURE_MOUNT_NFS is not set
+# CONFIG_FEATURE_MOUNT_CIFS is not set
+CONFIG_FEATURE_MOUNT_FLAGS=y
+# CONFIG_FEATURE_MOUNT_FSTAB is not set
+# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
+CONFIG_MOUNTPOINT=y
+# CONFIG_NOLOGIN is not set
+# CONFIG_NOLOGIN_DEPENDENCIES is not set
+# CONFIG_NSENTER is not set
+CONFIG_PIVOT_ROOT=y
+# CONFIG_RDATE is not set
+# CONFIG_RDEV is not set
+# CONFIG_READPROFILE is not set
+# CONFIG_RENICE is not set
+# CONFIG_REV is not set
+# CONFIG_RTCWAKE is not set
+# CONFIG_SCRIPT is not set
+# CONFIG_SCRIPTREPLAY is not set
+# CONFIG_SETARCH is not set
+# CONFIG_LINUX32 is not set
+# CONFIG_LINUX64 is not set
+# CONFIG_SETPRIV is not set
+# CONFIG_FEATURE_SETPRIV_DUMP is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
+CONFIG_SETSID=y
+# CONFIG_SWAPON is not set
+# CONFIG_FEATURE_SWAPON_DISCARD is not set
+# CONFIG_FEATURE_SWAPON_PRI is not set
+# CONFIG_SWAPOFF is not set
+# CONFIG_FEATURE_SWAPONOFF_LABEL is not set
+CONFIG_SWITCH_ROOT=y
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+# CONFIG_FEATURE_TASKSET_CPULIST is not set
+CONFIG_UEVENT=y
+CONFIG_UMOUNT=y
+CONFIG_FEATURE_UMOUNT_ALL=y
+# CONFIG_UNSHARE is not set
+# CONFIG_WALL is not set
+
+#
+# Common options for mount/umount
+#
+CONFIG_FEATURE_MOUNT_LOOP=y
+CONFIG_FEATURE_MOUNT_LOOP_CREATE=y
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+CONFIG_VOLUMEID=y
+
+#
+# Filesystem/Volume identification
+#
+# CONFIG_FEATURE_VOLUMEID_BCACHE is not set
+CONFIG_FEATURE_VOLUMEID_BTRFS=y
+CONFIG_FEATURE_VOLUMEID_CRAMFS=y
+CONFIG_FEATURE_VOLUMEID_EXFAT=y
+CONFIG_FEATURE_VOLUMEID_EXT=y
+CONFIG_FEATURE_VOLUMEID_F2FS=y
+CONFIG_FEATURE_VOLUMEID_FAT=y
+CONFIG_FEATURE_VOLUMEID_HFS=y
+CONFIG_FEATURE_VOLUMEID_ISO9660=y
+CONFIG_FEATURE_VOLUMEID_JFS=y
+# CONFIG_FEATURE_VOLUMEID_LFS is not set
+CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
+CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
+CONFIG_FEATURE_VOLUMEID_LUKS=y
+CONFIG_FEATURE_VOLUMEID_MINIX=y
+CONFIG_FEATURE_VOLUMEID_NILFS=y
+CONFIG_FEATURE_VOLUMEID_NTFS=y
+CONFIG_FEATURE_VOLUMEID_OCFS2=y
+CONFIG_FEATURE_VOLUMEID_REISERFS=y
+CONFIG_FEATURE_VOLUMEID_ROMFS=y
+CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
+CONFIG_FEATURE_VOLUMEID_SYSV=y
+CONFIG_FEATURE_VOLUMEID_UBIFS=y
+CONFIG_FEATURE_VOLUMEID_UDF=y
+CONFIG_FEATURE_VOLUMEID_XFS=y
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_ADJTIMEX is not set
+# CONFIG_BBCONFIG is not set
+# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
+# CONFIG_BC is not set
+# CONFIG_DC is not set
+# CONFIG_FEATURE_DC_BIG is not set
+# CONFIG_FEATURE_DC_LIBM is not set
+# CONFIG_FEATURE_BC_INTERACTIVE is not set
+# CONFIG_FEATURE_BC_LONG_OPTIONS is not set
+# CONFIG_BEEP is not set
+CONFIG_FEATURE_BEEP_FREQ=0
+CONFIG_FEATURE_BEEP_LENGTH_MS=0
+# CONFIG_CHAT is not set
+# CONFIG_FEATURE_CHAT_NOFAIL is not set
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
+# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
+# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
+# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
+# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
+# CONFIG_CONSPY is not set
+# CONFIG_CROND is not set
+# CONFIG_FEATURE_CROND_D is not set
+# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set
+CONFIG_FEATURE_CROND_DIR=""
+# CONFIG_CRONTAB is not set
+# CONFIG_DEVFSD is not set
+# CONFIG_DEVFSD_MODLOAD is not set
+# CONFIG_DEVFSD_FG_NP is not set
+# CONFIG_DEVFSD_VERBOSE is not set
+# CONFIG_FEATURE_DEVFS is not set
+# CONFIG_DEVMEM is not set
+# CONFIG_FBSPLASH is not set
+CONFIG_FLASH_ERASEALL=y
+# CONFIG_FLASH_LOCK is not set
+# CONFIG_FLASH_UNLOCK is not set
+# CONFIG_FLASHCP is not set
+# CONFIG_HDPARM is not set
+# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
+# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
+# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_HEXEDIT is not set
+# CONFIG_I2CGET is not set
+# CONFIG_I2CSET is not set
+# CONFIG_I2CDUMP is not set
+# CONFIG_I2CDETECT is not set
+# CONFIG_I2CTRANSFER is not set
+# CONFIG_INOTIFYD is not set
+CONFIG_LESS=y
+CONFIG_FEATURE_LESS_MAXLINES=9999999
+# CONFIG_FEATURE_LESS_BRACKETS is not set
+# CONFIG_FEATURE_LESS_FLAGS is not set
+# CONFIG_FEATURE_LESS_TRUNCATE is not set
+# CONFIG_FEATURE_LESS_MARKS is not set
+# CONFIG_FEATURE_LESS_REGEXP is not set
+# CONFIG_FEATURE_LESS_WINCH is not set
+# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set
+# CONFIG_FEATURE_LESS_DASHCMD is not set
+# CONFIG_FEATURE_LESS_LINENUMS is not set
+# CONFIG_FEATURE_LESS_RAW is not set
+# CONFIG_FEATURE_LESS_ENV is not set
+# CONFIG_LSSCSI is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
+# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
+# CONFIG_MAN is not set
+# CONFIG_MICROCOM is not set
+# CONFIG_MT is not set
+CONFIG_NANDWRITE=y
+# CONFIG_NANDDUMP is not set
+# CONFIG_PARTPROBE is not set
+# CONFIG_RAIDAUTORUN is not set
+# CONFIG_READAHEAD is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RUNLEVEL is not set
+# CONFIG_RX is not set
+# CONFIG_SETFATTR is not set
+# CONFIG_SETSERIAL is not set
+# CONFIG_STRINGS is not set
+# CONFIG_TIME is not set
+# CONFIG_TS is not set
+# CONFIG_TTYSIZE is not set
+# CONFIG_UBIATTACH is not set
+# CONFIG_UBIDETACH is not set
+# CONFIG_UBIMKVOL is not set
+# CONFIG_UBIRMVOL is not set
+# CONFIG_UBIRSVOL is not set
+# CONFIG_UBIUPDATEVOL is not set
+# CONFIG_UBIRENAME is not set
+# CONFIG_VOLNAME is not set
+# CONFIG_WATCHDOG is not set
+
+#
+# Networking Utilities
+#
+# CONFIG_FEATURE_IPV6 is not set
+# CONFIG_FEATURE_UNIX_LOCAL is not set
+# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
+# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+# CONFIG_FEATURE_TLS_SHA1 is not set
+# CONFIG_ARP is not set
+# CONFIG_ARPING is not set
+# CONFIG_BRCTL is not set
+# CONFIG_FEATURE_BRCTL_FANCY is not set
+# CONFIG_FEATURE_BRCTL_SHOW is not set
+# CONFIG_DNSD is not set
+CONFIG_ETHER_WAKE=y
+# CONFIG_FTPD is not set
+# CONFIG_FEATURE_FTPD_WRITE is not set
+# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
+# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
+# CONFIG_FTPGET is not set
+# CONFIG_FTPPUT is not set
+# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
+# CONFIG_HOSTNAME is not set
+# CONFIG_DNSDOMAINNAME is not set
+# CONFIG_HTTPD is not set
+# CONFIG_FEATURE_HTTPD_RANGES is not set
+# CONFIG_FEATURE_HTTPD_SETUID is not set
+# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
+# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
+# CONFIG_FEATURE_HTTPD_CGI is not set
+# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
+# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
+# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
+# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
+# CONFIG_FEATURE_HTTPD_PROXY is not set
+# CONFIG_FEATURE_HTTPD_GZIP is not set
+# CONFIG_IFCONFIG is not set
+# CONFIG_FEATURE_IFCONFIG_STATUS is not set
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
+# CONFIG_FEATURE_IFCONFIG_HW is not set
+# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
+# CONFIG_IFENSLAVE is not set
+# CONFIG_IFPLUGD is not set
+# CONFIG_IFUP is not set
+# CONFIG_IFDOWN is not set
+CONFIG_IFUPDOWN_IFSTATE_PATH=""
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
+# CONFIG_INETD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+# CONFIG_IP is not set
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_IPRULE is not set
+# CONFIG_IPNEIGH is not set
+# CONFIG_FEATURE_IP_ADDRESS is not set
+# CONFIG_FEATURE_IP_LINK is not set
+# CONFIG_FEATURE_IP_ROUTE is not set
+CONFIG_FEATURE_IP_ROUTE_DIR=""
+# CONFIG_FEATURE_IP_TUNNEL is not set
+# CONFIG_FEATURE_IP_RULE is not set
+# CONFIG_FEATURE_IP_NEIGH is not set
+# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
+# CONFIG_IPCALC is not set
+# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+# CONFIG_FEATURE_IPCALC_FANCY is not set
+# CONFIG_FAKEIDENTD is not set
+# CONFIG_NAMEIF is not set
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
+CONFIG_NBDCLIENT=y
+# CONFIG_NC is not set
+# CONFIG_NETCAT is not set
+# CONFIG_NC_SERVER is not set
+# CONFIG_NC_EXTRA is not set
+# CONFIG_NC_110_COMPAT is not set
+# CONFIG_NETSTAT is not set
+# CONFIG_FEATURE_NETSTAT_WIDE is not set
+# CONFIG_FEATURE_NETSTAT_PRG is not set
+# CONFIG_NSLOOKUP is not set
+# CONFIG_FEATURE_NSLOOKUP_BIG is not set
+# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
+# CONFIG_NTPD is not set
+# CONFIG_FEATURE_NTPD_SERVER is not set
+# CONFIG_FEATURE_NTPD_CONF is not set
+# CONFIG_FEATURE_NTP_AUTH is not set
+CONFIG_PING=y
+# CONFIG_PING6 is not set
+CONFIG_FEATURE_FANCY_PING=y
+# CONFIG_PSCAN is not set
+# CONFIG_ROUTE is not set
+# CONFIG_SLATTACH is not set
+# CONFIG_SSL_CLIENT is not set
+# CONFIG_TC is not set
+# CONFIG_FEATURE_TC_INGRESS is not set
+# CONFIG_TCPSVD is not set
+# CONFIG_UDPSVD is not set
+# CONFIG_TELNET is not set
+# CONFIG_FEATURE_TELNET_TTYPE is not set
+# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
+# CONFIG_FEATURE_TELNET_WIDTH is not set
+# CONFIG_TELNETD is not set
+# CONFIG_FEATURE_TELNETD_STANDALONE is not set
+# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
+# CONFIG_TFTP is not set
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set
+# CONFIG_TFTPD is not set
+# CONFIG_FEATURE_TFTP_GET is not set
+# CONFIG_FEATURE_TFTP_PUT is not set
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_TFTP_DEBUG is not set
+# CONFIG_TLS is not set
+# CONFIG_TRACEROUTE is not set
+# CONFIG_TRACEROUTE6 is not set
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
+# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
+# CONFIG_TUNCTL is not set
+# CONFIG_FEATURE_TUNCTL_UG is not set
+# CONFIG_VCONFIG is not set
+# CONFIG_WGET is not set
+# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
+# CONFIG_FEATURE_WGET_STATUSBAR is not set
+# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
+# CONFIG_FEATURE_WGET_TIMEOUT is not set
+# CONFIG_FEATURE_WGET_HTTPS is not set
+# CONFIG_FEATURE_WGET_OPENSSL is not set
+# CONFIG_WHOIS is not set
+# CONFIG_ZCIP is not set
+# CONFIG_UDHCPD is not set
+# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
+CONFIG_DHCPD_LEASES_FILE=""
+# CONFIG_DUMPLEASES is not set
+# CONFIG_DHCPRELAY is not set
+# CONFIG_UDHCPC is not set
+# CONFIG_FEATURE_UDHCPC_ARPING is not set
+# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
+CONFIG_UDHCPC_DEFAULT_SCRIPT=""
+# CONFIG_UDHCPC6 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
+# CONFIG_FEATURE_UDHCP_PORT is not set
+CONFIG_UDHCP_DEBUG=0
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
+# CONFIG_FEATURE_UDHCP_RFC3397 is not set
+# CONFIG_FEATURE_UDHCP_8021Q is not set
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
+
+#
+# Print Utilities
+#
+# CONFIG_LPD is not set
+# CONFIG_LPR is not set
+# CONFIG_LPQ is not set
+
+#
+# Mail Utilities
+#
+# CONFIG_MAKEMIME is not set
+# CONFIG_POPMAILDIR is not set
+# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
+# CONFIG_REFORMIME is not set
+# CONFIG_FEATURE_REFORMIME_COMPAT is not set
+# CONFIG_SENDMAIL is not set
+CONFIG_FEATURE_MIME_CHARSET=""
+
+#
+# Process Utilities
+#
+# CONFIG_FREE is not set
+# CONFIG_FUSER is not set
+# CONFIG_IOSTAT is not set
+# CONFIG_KILL is not set
+# CONFIG_KILLALL is not set
+# CONFIG_KILLALL5 is not set
+# CONFIG_LSOF is not set
+# CONFIG_MPSTAT is not set
+# CONFIG_NMETER is not set
+# CONFIG_PGREP is not set
+# CONFIG_PKILL is not set
+# CONFIG_PIDOF is not set
+# CONFIG_FEATURE_PIDOF_SINGLE is not set
+# CONFIG_FEATURE_PIDOF_OMIT is not set
+# CONFIG_PMAP is not set
+# CONFIG_POWERTOP is not set
+# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
+# CONFIG_PS is not set
+# CONFIG_FEATURE_PS_WIDE is not set
+# CONFIG_FEATURE_PS_LONG is not set
+# CONFIG_FEATURE_PS_TIME is not set
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
+# CONFIG_PSTREE is not set
+# CONFIG_PWDX is not set
+# CONFIG_SMEMCAP is not set
+# CONFIG_BB_SYSCTL is not set
+# CONFIG_TOP is not set
+# CONFIG_FEATURE_TOP_INTERACTIVE is not set
+# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set
+# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set
+# CONFIG_FEATURE_TOP_SMP_CPU is not set
+# CONFIG_FEATURE_TOP_DECIMALS is not set
+# CONFIG_FEATURE_TOP_SMP_PROCESS is not set
+# CONFIG_FEATURE_TOPMEM is not set
+# CONFIG_UPTIME is not set
+# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
+# CONFIG_WATCH is not set
+# CONFIG_FEATURE_SHOW_THREADS is not set
+
+#
+# Runit Utilities
+#
+# CONFIG_CHPST is not set
+# CONFIG_SETUIDGID is not set
+# CONFIG_ENVUIDGID is not set
+# CONFIG_ENVDIR is not set
+# CONFIG_SOFTLIMIT is not set
+# CONFIG_RUNSV is not set
+# CONFIG_RUNSVDIR is not set
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
+# CONFIG_SV is not set
+CONFIG_SV_DEFAULT_SERVICE_DIR=""
+# CONFIG_SVC is not set
+# CONFIG_SVOK is not set
+# CONFIG_SVLOGD is not set
+# CONFIG_CHCON is not set
+# CONFIG_GETENFORCE is not set
+# CONFIG_GETSEBOOL is not set
+# CONFIG_LOAD_POLICY is not set
+# CONFIG_MATCHPATHCON is not set
+# CONFIG_RUNCON is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_SESTATUS is not set
+# CONFIG_SETENFORCE is not set
+# CONFIG_SETFILES is not set
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_RESTORECON is not set
+# CONFIG_SETSEBOOL is not set
+
+#
+# Shells
+#
+CONFIG_SH_IS_ASH=y
+# CONFIG_SH_IS_HUSH is not set
+# CONFIG_SH_IS_NONE is not set
+# CONFIG_BASH_IS_ASH is not set
+# CONFIG_BASH_IS_HUSH is not set
+CONFIG_BASH_IS_NONE=y
+CONFIG_ASH=y
+# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set
+CONFIG_ASH_INTERNAL_GLOB=y
+CONFIG_ASH_BASH_COMPAT=y
+# CONFIG_ASH_BASH_SOURCE_CURDIR is not set
+# CONFIG_ASH_BASH_NOT_FOUND_HOOK is not set
+CONFIG_ASH_JOB_CONTROL=y
+# CONFIG_ASH_ALIAS is not set
+# CONFIG_ASH_RANDOM_SUPPORT is not set
+# CONFIG_ASH_EXPAND_PRMT is not set
+# CONFIG_ASH_IDLE_TIMEOUT is not set
+# CONFIG_ASH_MAIL is not set
+CONFIG_ASH_ECHO=y
+CONFIG_ASH_PRINTF=y
+CONFIG_ASH_TEST=y
+# CONFIG_ASH_HELP is not set
+CONFIG_ASH_GETOPTS=y
+# CONFIG_ASH_CMDCMD is not set
+CONFIG_CTTYHACK=y
+# CONFIG_HUSH is not set
+# CONFIG_HUSH_BASH_COMPAT is not set
+# CONFIG_HUSH_BRACE_EXPANSION is not set
+# CONFIG_HUSH_LINENO_VAR is not set
+# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
+# CONFIG_HUSH_INTERACTIVE is not set
+# CONFIG_HUSH_SAVEHISTORY is not set
+# CONFIG_HUSH_JOB is not set
+# CONFIG_HUSH_TICK is not set
+# CONFIG_HUSH_IF is not set
+# CONFIG_HUSH_LOOPS is not set
+# CONFIG_HUSH_CASE is not set
+# CONFIG_HUSH_FUNCTIONS is not set
+# CONFIG_HUSH_LOCAL is not set
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH_MODE_X is not set
+# CONFIG_HUSH_ECHO is not set
+# CONFIG_HUSH_PRINTF is not set
+# CONFIG_HUSH_TEST is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_EXPORT is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_READONLY is not set
+# CONFIG_HUSH_KILL is not set
+# CONFIG_HUSH_WAIT is not set
+# CONFIG_HUSH_COMMAND is not set
+# CONFIG_HUSH_TRAP is not set
+# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_TIMES is not set
+# CONFIG_HUSH_READ is not set
+# CONFIG_HUSH_SET is not set
+# CONFIG_HUSH_UNSET is not set
+# CONFIG_HUSH_ULIMIT is not set
+# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_GETOPTS is not set
+# CONFIG_HUSH_MEMLEAK is not set
+# CONFIG_SHELL_HUSH is not set
+
+#
+# Options common to all shells
+#
+CONFIG_FEATURE_SH_MATH=y
+CONFIG_FEATURE_SH_MATH_64=y
+CONFIG_FEATURE_SH_MATH_BASE=y
+CONFIG_FEATURE_SH_EXTRA_QUIET=y
+CONFIG_FEATURE_SH_STANDALONE=y
+# CONFIG_FEATURE_SH_NOFORK is not set
+CONFIG_FEATURE_SH_READ_FRAC=y
+# CONFIG_FEATURE_SH_HISTFILESIZE is not set
+# CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS is not set
+
+#
+# System Logging Utilities
+#
+# CONFIG_KLOGD is not set
+# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
+# CONFIG_LOGGER is not set
+# CONFIG_LOGREAD is not set
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+# CONFIG_SYSLOGD is not set
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+# CONFIG_FEATURE_REMOTE_LOG is not set
+# CONFIG_FEATURE_SYSLOGD_DUP is not set
+# CONFIG_FEATURE_SYSLOGD_CFG is not set
+# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
+# CONFIG_FEATURE_IPC_SYSLOG is not set
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
+# CONFIG_FEATURE_KMSG_SYSLOG is not set
diff --git a/projects/L4T/packages/busybox/config/busybox-target.conf b/projects/L4T/packages/busybox/config/busybox-target.conf
new file mode 100644
index 00000000000..6962957982a
--- /dev/null
+++ b/projects/L4T/packages/busybox/config/busybox-target.conf
@@ -0,0 +1,1184 @@
+#
+# Automatically generated make config: don't edit
+# Busybox version: 1.32.0.git
+# Fri Nov 13 18:57:19 2020
+#
+CONFIG_HAVE_DOT_CONFIG=y
+
+#
+# Settings
+#
+CONFIG_DESKTOP=y
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_FEDORA_COMPAT is not set
+# CONFIG_INCLUDE_SUSv2 is not set
+CONFIG_LONG_OPTS=y
+CONFIG_SHOW_USAGE=y
+CONFIG_FEATURE_VERBOSE_USAGE=y
+CONFIG_FEATURE_COMPRESS_USAGE=y
+CONFIG_LFS=y
+# CONFIG_PAM is not set
+CONFIG_FEATURE_DEVPTS=y
+# CONFIG_FEATURE_UTMP is not set
+# CONFIG_FEATURE_WTMP is not set
+CONFIG_FEATURE_PIDFILE=y
+CONFIG_PID_FILE_PATH="/run"
+CONFIG_BUSYBOX=y
+CONFIG_FEATURE_SHOW_SCRIPT=y
+CONFIG_FEATURE_INSTALLER=y
+CONFIG_INSTALL_NO_USR=y
+CONFIG_FEATURE_SUID=y
+# CONFIG_FEATURE_SUID_CONFIG is not set
+# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
+# CONFIG_FEATURE_PREFER_APPLETS is not set
+CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_CLEAN_UP is not set
+CONFIG_FEATURE_SYSLOG_INFO=y
+CONFIG_FEATURE_SYSLOG=y
+CONFIG_PLATFORM_LINUX=y
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+# CONFIG_PIE is not set
+# CONFIG_NOMMU is not set
+# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
+# CONFIG_FEATURE_INDIVIDUAL is not set
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
+CONFIG_CROSS_COMPILER_PREFIX=""
+CONFIG_SYSROOT=""
+CONFIG_EXTRA_CFLAGS=""
+CONFIG_EXTRA_LDFLAGS=""
+CONFIG_EXTRA_LDLIBS="-ltirpc -lpthread"
+# CONFIG_USE_PORTABLE_CODE is not set
+# CONFIG_STACK_OPTIMIZATION_386 is not set
+
+#
+# Installation Options ("make install" behavior)
+#
+CONFIG_INSTALL_APPLET_SYMLINKS=y
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
+# CONFIG_INSTALL_APPLET_DONT is not set
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
+CONFIG_PREFIX="./_install-system"
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+# CONFIG_DEBUG_SANITIZE is not set
+# CONFIG_UNIT_TEST is not set
+# CONFIG_WERROR is not set
+# CONFIG_WARN_SIMPLE_MSG is not set
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Library Tuning
+#
+# CONFIG_FEATURE_USE_BSS_TAIL is not set
+CONFIG_FLOAT_DURATION=y
+CONFIG_FEATURE_RTMINMAX=y
+CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=y
+# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
+CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_PASSWORD_MINLEN=6
+CONFIG_MD5_SMALL=0
+CONFIG_SHA3_SMALL=0
+CONFIG_FEATURE_FAST_TOP=y
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+# CONFIG_FEATURE_ETC_SERVICES is not set
+CONFIG_FEATURE_EDITING=y
+CONFIG_FEATURE_EDITING_MAX_LEN=1024
+# CONFIG_FEATURE_EDITING_VI is not set
+CONFIG_FEATURE_EDITING_HISTORY=9999
+CONFIG_FEATURE_EDITING_SAVEHISTORY=y
+CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y
+CONFIG_FEATURE_REVERSE_SEARCH=y
+CONFIG_FEATURE_TAB_COMPLETION=y
+CONFIG_FEATURE_USERNAME_COMPLETION=y
+CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
+# CONFIG_FEATURE_EDITING_WINCH is not set
+# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
+CONFIG_LOCALE_SUPPORT=y
+CONFIG_UNICODE_SUPPORT=y
+CONFIG_UNICODE_USING_LOCALE=y
+# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
+CONFIG_SUBST_WCHAR=63
+CONFIG_LAST_SUPPORTED_WCHAR=767
+# CONFIG_UNICODE_COMBINING_WCHARS is not set
+CONFIG_UNICODE_WIDE_WCHARS=y
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
+CONFIG_FEATURE_NON_POSIX_CP=y
+CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
+CONFIG_FEATURE_USE_SENDFILE=y
+CONFIG_FEATURE_COPYBUF_KB=4
+CONFIG_FEATURE_SKIP_ROOTFS=y
+CONFIG_MONOTONIC_SYSCALL=y
+# CONFIG_IOCTL_HEX2STR_ERROR is not set
+# CONFIG_FEATURE_HWIB is not set
+
+#
+# Applets
+#
+
+#
+# Archival Utilities
+#
+CONFIG_FEATURE_SEAMLESS_XZ=y
+CONFIG_FEATURE_SEAMLESS_LZMA=y
+CONFIG_FEATURE_SEAMLESS_BZ2=y
+CONFIG_FEATURE_SEAMLESS_GZ=y
+# CONFIG_FEATURE_SEAMLESS_Z is not set
+CONFIG_AR=y
+CONFIG_FEATURE_AR_LONG_FILENAMES=y
+CONFIG_FEATURE_AR_CREATE=y
+# CONFIG_UNCOMPRESS is not set
+CONFIG_GUNZIP=y
+CONFIG_ZCAT=y
+# CONFIG_FEATURE_GUNZIP_LONG_OPTIONS is not set
+CONFIG_BUNZIP2=y
+CONFIG_BZCAT=y
+# CONFIG_UNLZMA is not set
+# CONFIG_LZCAT is not set
+# CONFIG_LZMA is not set
+CONFIG_UNXZ=y
+CONFIG_XZCAT=y
+CONFIG_XZ=y
+CONFIG_BZIP2=y
+CONFIG_BZIP2_SMALL=8
+CONFIG_FEATURE_BZIP2_DECOMPRESS=y
+CONFIG_CPIO=y
+CONFIG_FEATURE_CPIO_O=y
+CONFIG_FEATURE_CPIO_P=y
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+CONFIG_GZIP=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_GZIP_FAST=0
+CONFIG_FEATURE_GZIP_LEVELS=y
+CONFIG_FEATURE_GZIP_DECOMPRESS=y
+# CONFIG_LZOP is not set
+# CONFIG_UNLZOP is not set
+# CONFIG_LZOPCAT is not set
+# CONFIG_LZOP_COMPR_HIGH is not set
+# CONFIG_RPM is not set
+CONFIG_RPM2CPIO=y
+CONFIG_TAR=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_CREATE=y
+CONFIG_FEATURE_TAR_AUTODETECT=y
+CONFIG_FEATURE_TAR_FROM=y
+# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
+CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
+CONFIG_FEATURE_TAR_TO_COMMAND=y
+CONFIG_FEATURE_TAR_UNAME_GNAME=y
+CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
+# CONFIG_FEATURE_TAR_SELINUX is not set
+CONFIG_UNZIP=y
+CONFIG_FEATURE_UNZIP_CDF=y
+# CONFIG_FEATURE_UNZIP_BZIP2 is not set
+# CONFIG_FEATURE_UNZIP_LZMA is not set
+# CONFIG_FEATURE_UNZIP_XZ is not set
+# CONFIG_FEATURE_LZMA_FAST is not set
+
+#
+# Coreutils
+#
+CONFIG_BASENAME=y
+CONFIG_CAT=y
+CONFIG_FEATURE_CATN=y
+# CONFIG_FEATURE_CATV is not set
+# CONFIG_CHGRP is not set
+CONFIG_CHMOD=y
+CONFIG_CHOWN=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_CHROOT=y
+# CONFIG_CKSUM is not set
+# CONFIG_COMM is not set
+CONFIG_CP=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_REFLINK=y
+CONFIG_CUT=y
+CONFIG_DATE=y
+CONFIG_FEATURE_DATE_ISOFMT=y
+CONFIG_FEATURE_DATE_NANO=y
+CONFIG_FEATURE_DATE_COMPAT=y
+CONFIG_DD=y
+CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
+CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
+CONFIG_FEATURE_DD_IBS_OBS=y
+CONFIG_FEATURE_DD_STATUS=y
+CONFIG_DF=y
+# CONFIG_FEATURE_DF_FANCY is not set
+CONFIG_DIRNAME=y
+CONFIG_DOS2UNIX=y
+CONFIG_UNIX2DOS=y
+CONFIG_DU=y
+# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set
+# CONFIG_ECHO is not set
+CONFIG_FEATURE_FANCY_ECHO=y
+CONFIG_ENV=y
+# CONFIG_EXPAND is not set
+# CONFIG_UNEXPAND is not set
+# CONFIG_EXPR is not set
+# CONFIG_EXPR_MATH_SUPPORT_64 is not set
+# CONFIG_FACTOR is not set
+# CONFIG_FALSE is not set
+# CONFIG_FOLD is not set
+CONFIG_HEAD=y
+CONFIG_FEATURE_FANCY_HEAD=y
+# CONFIG_HOSTID is not set
+CONFIG_ID=y
+CONFIG_GROUPS=y
+CONFIG_INSTALL=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+# CONFIG_LINK is not set
+CONFIG_LN=y
+# CONFIG_LOGNAME is not set
+CONFIG_LS=y
+CONFIG_FEATURE_LS_FILETYPES=y
+CONFIG_FEATURE_LS_FOLLOWLINKS=y
+CONFIG_FEATURE_LS_RECURSIVE=y
+# CONFIG_FEATURE_LS_WIDTH is not set
+CONFIG_FEATURE_LS_SORTFILES=y
+CONFIG_FEATURE_LS_TIMESTAMPS=y
+CONFIG_FEATURE_LS_USERNAME=y
+CONFIG_FEATURE_LS_COLOR=y
+CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
+CONFIG_MD5SUM=y
+CONFIG_SHA1SUM=y
+CONFIG_SHA256SUM=y
+CONFIG_SHA512SUM=y
+# CONFIG_SHA3SUM is not set
+
+#
+# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
+#
+CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
+CONFIG_MKDIR=y
+CONFIG_MKFIFO=y
+CONFIG_MKNOD=y
+CONFIG_MKTEMP=y
+CONFIG_MV=y
+CONFIG_NICE=y
+# CONFIG_NL is not set
+CONFIG_NOHUP=y
+# CONFIG_NPROC is not set
+CONFIG_OD=y
+# CONFIG_PASTE is not set
+CONFIG_PRINTENV=y
+# CONFIG_PRINTF is not set
+CONFIG_PWD=y
+CONFIG_READLINK=y
+CONFIG_FEATURE_READLINK_FOLLOW=y
+CONFIG_REALPATH=y
+CONFIG_RM=y
+CONFIG_RMDIR=y
+CONFIG_SEQ=y
+# CONFIG_SHRED is not set
+# CONFIG_SHUF is not set
+CONFIG_SLEEP=y
+CONFIG_FEATURE_FANCY_SLEEP=y
+CONFIG_SORT=y
+CONFIG_FEATURE_SORT_BIG=y
+# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
+# CONFIG_SPLIT is not set
+# CONFIG_FEATURE_SPLIT_FANCY is not set
+CONFIG_STAT=y
+# CONFIG_FEATURE_STAT_FORMAT is not set
+# CONFIG_FEATURE_STAT_FILESYSTEM is not set
+# CONFIG_STTY is not set
+# CONFIG_SUM is not set
+CONFIG_SYNC=y
+CONFIG_FEATURE_SYNC_FANCY=y
+# CONFIG_FSYNC is not set
+CONFIG_TAC=y
+CONFIG_TAIL=y
+CONFIG_FEATURE_FANCY_TAIL=y
+CONFIG_TEE=y
+CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
+# CONFIG_TEST is not set
+# CONFIG_TEST1 is not set
+# CONFIG_TEST2 is not set
+CONFIG_FEATURE_TEST_64=y
+# CONFIG_TIMEOUT is not set
+CONFIG_TOUCH=y
+CONFIG_FEATURE_TOUCH_NODEREF=y
+CONFIG_FEATURE_TOUCH_SUSV3=y
+CONFIG_TR=y
+CONFIG_FEATURE_TR_CLASSES=y
+CONFIG_FEATURE_TR_EQUIV=y
+CONFIG_TRUE=y
+# CONFIG_TRUNCATE is not set
+# CONFIG_TTY is not set
+CONFIG_UNAME=y
+CONFIG_UNAME_OSNAME="GNU/Linux"
+CONFIG_BB_ARCH=y
+CONFIG_UNIQ=y
+# CONFIG_UNLINK is not set
+CONFIG_USLEEP=y
+# CONFIG_UUDECODE is not set
+# CONFIG_BASE64 is not set
+# CONFIG_UUENCODE is not set
+CONFIG_WC=y
+CONFIG_FEATURE_WC_LARGE=y
+# CONFIG_WHO is not set
+# CONFIG_W is not set
+# CONFIG_USERS is not set
+CONFIG_WHOAMI=y
+# CONFIG_YES is not set
+
+#
+# Common options
+#
+CONFIG_FEATURE_VERBOSE=y
+
+#
+# Common options for cp and mv
+#
+# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
+
+#
+# Common options for df, du, ls
+#
+CONFIG_FEATURE_HUMAN_READABLE=y
+
+#
+# Console Utilities
+#
+CONFIG_CHVT=y
+CONFIG_CLEAR=y
+CONFIG_DEALLOCVT=y
+# CONFIG_DUMPKMAP is not set
+CONFIG_FGCONSOLE=y
+# CONFIG_KBD_MODE is not set
+# CONFIG_LOADFONT is not set
+# CONFIG_SETFONT is not set
+# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
+CONFIG_DEFAULT_SETFONT_DIR=""
+# CONFIG_FEATURE_LOADFONT_PSF2 is not set
+# CONFIG_FEATURE_LOADFONT_RAW is not set
+CONFIG_LOADKMAP=y
+# CONFIG_OPENVT is not set
+CONFIG_RESET=y
+# CONFIG_RESIZE is not set
+# CONFIG_FEATURE_RESIZE_PRINT is not set
+CONFIG_SETCONSOLE=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y
+# CONFIG_SETKEYCODES is not set
+# CONFIG_SETLOGCONS is not set
+# CONFIG_SHOWKEY is not set
+
+#
+# Debian Utilities
+#
+# CONFIG_PIPE_PROGRESS is not set
+# CONFIG_RUN_PARTS is not set
+# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
+# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
+# CONFIG_START_STOP_DAEMON is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
+CONFIG_WHICH=y
+
+#
+# klibc-utils
+#
+# CONFIG_MINIPS is not set
+# CONFIG_NUKE is not set
+# CONFIG_RESUME is not set
+# CONFIG_RUN_INIT is not set
+
+#
+# Editors
+#
+CONFIG_AWK=y
+CONFIG_FEATURE_AWK_LIBM=y
+CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y
+# CONFIG_CMP is not set
+# CONFIG_DIFF is not set
+# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
+# CONFIG_FEATURE_DIFF_DIR is not set
+# CONFIG_ED is not set
+# CONFIG_PATCH is not set
+CONFIG_SED=y
+CONFIG_VI=y
+CONFIG_FEATURE_VI_MAX_LEN=4096
+CONFIG_FEATURE_VI_8BIT=y
+CONFIG_FEATURE_VI_COLON=y
+CONFIG_FEATURE_VI_YANKMARK=y
+CONFIG_FEATURE_VI_SEARCH=y
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+CONFIG_FEATURE_VI_USE_SIGNALS=y
+CONFIG_FEATURE_VI_DOT_CMD=y
+CONFIG_FEATURE_VI_READONLY=y
+CONFIG_FEATURE_VI_SETOPTS=y
+CONFIG_FEATURE_VI_SET=y
+CONFIG_FEATURE_VI_WIN_RESIZE=y
+CONFIG_FEATURE_VI_ASK_TERMINAL=y
+CONFIG_FEATURE_VI_UNDO=y
+CONFIG_FEATURE_VI_UNDO_QUEUE=y
+CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
+CONFIG_FEATURE_ALLOW_EXEC=y
+
+#
+# Finding Utilities
+#
+CONFIG_FIND=y
+CONFIG_FEATURE_FIND_PRINT0=y
+CONFIG_FEATURE_FIND_MTIME=y
+CONFIG_FEATURE_FIND_MMIN=y
+CONFIG_FEATURE_FIND_PERM=y
+CONFIG_FEATURE_FIND_TYPE=y
+CONFIG_FEATURE_FIND_EXECUTABLE=y
+CONFIG_FEATURE_FIND_XDEV=y
+CONFIG_FEATURE_FIND_MAXDEPTH=y
+CONFIG_FEATURE_FIND_NEWER=y
+CONFIG_FEATURE_FIND_INUM=y
+CONFIG_FEATURE_FIND_EXEC=y
+CONFIG_FEATURE_FIND_EXEC_PLUS=y
+CONFIG_FEATURE_FIND_USER=y
+CONFIG_FEATURE_FIND_GROUP=y
+CONFIG_FEATURE_FIND_NOT=y
+CONFIG_FEATURE_FIND_DEPTH=y
+CONFIG_FEATURE_FIND_PAREN=y
+CONFIG_FEATURE_FIND_SIZE=y
+CONFIG_FEATURE_FIND_PRUNE=y
+CONFIG_FEATURE_FIND_QUIT=y
+CONFIG_FEATURE_FIND_DELETE=y
+CONFIG_FEATURE_FIND_EMPTY=y
+CONFIG_FEATURE_FIND_PATH=y
+CONFIG_FEATURE_FIND_REGEX=y
+# CONFIG_FEATURE_FIND_CONTEXT is not set
+CONFIG_FEATURE_FIND_LINKS=y
+CONFIG_GREP=y
+CONFIG_EGREP=y
+CONFIG_FGREP=y
+CONFIG_FEATURE_GREP_CONTEXT=y
+CONFIG_XARGS=y
+CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
+CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
+CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
+CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
+CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y
+CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y
+
+#
+# Init Utilities
+#
+# CONFIG_BOOTCHARTD is not set
+# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
+# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
+# CONFIG_HALT is not set
+# CONFIG_POWEROFF is not set
+# CONFIG_REBOOT is not set
+# CONFIG_FEATURE_WAIT_FOR_INIT is not set
+# CONFIG_FEATURE_CALL_TELINIT is not set
+CONFIG_TELINIT_PATH=""
+# CONFIG_INIT is not set
+# CONFIG_LINUXRC is not set
+# CONFIG_FEATURE_USE_INITTAB is not set
+# CONFIG_FEATURE_KILL_REMOVED is not set
+CONFIG_FEATURE_KILL_DELAY=0
+# CONFIG_FEATURE_INIT_SCTTY is not set
+# CONFIG_FEATURE_INIT_SYSLOG is not set
+# CONFIG_FEATURE_INIT_QUIET is not set
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
+CONFIG_INIT_TERMINAL_TYPE=""
+# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
+
+#
+# Login/Password Management Utilities
+#
+CONFIG_FEATURE_SHADOWPASSWDS=y
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_USE_BB_SHADOW is not set
+CONFIG_USE_BB_CRYPT=y
+CONFIG_USE_BB_CRYPT_SHA=y
+# CONFIG_ADD_SHELL is not set
+# CONFIG_REMOVE_SHELL is not set
+# CONFIG_ADDGROUP is not set
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_FEATURE_CHECK_NAMES is not set
+CONFIG_LAST_ID=0
+CONFIG_FIRST_SYSTEM_ID=0
+CONFIG_LAST_SYSTEM_ID=0
+# CONFIG_CHPASSWD is not set
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512"
+CONFIG_CRYPTPW=y
+# CONFIG_MKPASSWD is not set
+# CONFIG_DELUSER is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
+# CONFIG_GETTY is not set
+CONFIG_LOGIN=y
+# CONFIG_LOGIN_SESSION_AS_CHILD is not set
+CONFIG_LOGIN_SCRIPTS=y
+# CONFIG_FEATURE_NOLOGIN is not set
+# CONFIG_FEATURE_SECURETTY is not set
+CONFIG_PASSWD=y
+CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
+CONFIG_SU=y
+CONFIG_FEATURE_SU_SYSLOG=y
+CONFIG_FEATURE_SU_CHECKS_SHELLS=y
+# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Linux Ext2 FS Progs
+#
+# CONFIG_CHATTR is not set
+# CONFIG_FSCK is not set
+# CONFIG_LSATTR is not set
+# CONFIG_TUNE2FS is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_MODPROBE_SMALL is not set
+# CONFIG_DEPMOD is not set
+# CONFIG_INSMOD is not set
+# CONFIG_LSMOD is not set
+# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
+# CONFIG_MODINFO is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
+# CONFIG_RMMOD is not set
+
+#
+# Options common to multiple modutils
+#
+# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
+# CONFIG_FEATURE_2_4_MODULES is not set
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
+# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
+# CONFIG_FEATURE_MODUTILS_ALIAS is not set
+# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
+CONFIG_DEFAULT_MODULES_DIR=""
+CONFIG_DEFAULT_DEPMOD_FILE=""
+
+#
+# Linux System Utilities
+#
+# CONFIG_ACPID is not set
+# CONFIG_FEATURE_ACPID_COMPAT is not set
+# CONFIG_BLKDISCARD is not set
+# CONFIG_BLKID is not set
+# CONFIG_FEATURE_BLKID_TYPE is not set
+# CONFIG_BLOCKDEV is not set
+# CONFIG_CAL is not set
+# CONFIG_CHRT is not set
+CONFIG_DMESG=y
+CONFIG_FEATURE_DMESG_PRETTY=y
+CONFIG_EJECT=y
+CONFIG_FEATURE_EJECT_SCSI=y
+# CONFIG_FALLOCATE is not set
+# CONFIG_FATATTR is not set
+CONFIG_FBSET=y
+CONFIG_FEATURE_FBSET_FANCY=y
+CONFIG_FEATURE_FBSET_READMODE=y
+# CONFIG_FDFORMAT is not set
+# CONFIG_FDISK is not set
+# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
+# CONFIG_FEATURE_FDISK_WRITABLE is not set
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+# CONFIG_FEATURE_GPT_LABEL is not set
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
+CONFIG_FINDFS=y
+CONFIG_FLOCK=y
+# CONFIG_FDFLUSH is not set
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_FSFREEZE is not set
+# CONFIG_FSTRIM is not set
+CONFIG_GETOPT=y
+CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_HEXDUMP=y
+# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
+# CONFIG_HD is not set
+# CONFIG_XXD is not set
+CONFIG_HWCLOCK=y
+# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
+CONFIG_IONICE=y
+# CONFIG_IPCRM is not set
+# CONFIG_IPCS is not set
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
+# CONFIG_LOSETUP is not set
+# CONFIG_LSPCI is not set
+# CONFIG_LSUSB is not set
+# CONFIG_MDEV is not set
+# CONFIG_FEATURE_MDEV_CONF is not set
+# CONFIG_FEATURE_MDEV_RENAME is not set
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
+# CONFIG_FEATURE_MDEV_EXEC is not set
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+# CONFIG_FEATURE_MDEV_DAEMON is not set
+# CONFIG_MESG is not set
+# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
+# CONFIG_MKE2FS is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+# CONFIG_MKDOSFS is not set
+# CONFIG_MKFS_VFAT is not set
+CONFIG_MKSWAP=y
+CONFIG_FEATURE_MKSWAP_UUID=y
+CONFIG_MORE=y
+CONFIG_MOUNT=y
+CONFIG_FEATURE_MOUNT_FAKE=y
+CONFIG_FEATURE_MOUNT_VERBOSE=y
+CONFIG_FEATURE_MOUNT_HELPERS=y
+CONFIG_FEATURE_MOUNT_LABEL=y
+# CONFIG_FEATURE_MOUNT_NFS is not set
+CONFIG_FEATURE_MOUNT_CIFS=y
+CONFIG_FEATURE_MOUNT_FLAGS=y
+# CONFIG_FEATURE_MOUNT_FSTAB is not set
+# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
+CONFIG_MOUNTPOINT=y
+# CONFIG_NOLOGIN is not set
+# CONFIG_NOLOGIN_DEPENDENCIES is not set
+# CONFIG_NSENTER is not set
+# CONFIG_PIVOT_ROOT is not set
+CONFIG_RDATE=y
+# CONFIG_RDEV is not set
+# CONFIG_READPROFILE is not set
+CONFIG_RENICE=y
+# CONFIG_REV is not set
+# CONFIG_RTCWAKE is not set
+# CONFIG_SCRIPT is not set
+# CONFIG_SCRIPTREPLAY is not set
+# CONFIG_SETARCH is not set
+# CONFIG_LINUX32 is not set
+# CONFIG_LINUX64 is not set
+# CONFIG_SETPRIV is not set
+# CONFIG_FEATURE_SETPRIV_DUMP is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
+# CONFIG_SETSID is not set
+# CONFIG_SWAPON is not set
+# CONFIG_FEATURE_SWAPON_DISCARD is not set
+# CONFIG_FEATURE_SWAPON_PRI is not set
+# CONFIG_SWAPOFF is not set
+# CONFIG_FEATURE_SWAPONOFF_LABEL is not set
+CONFIG_SWITCH_ROOT=y
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+# CONFIG_FEATURE_TASKSET_CPULIST is not set
+CONFIG_UEVENT=y
+CONFIG_UMOUNT=y
+CONFIG_FEATURE_UMOUNT_ALL=y
+# CONFIG_UNSHARE is not set
+# CONFIG_WALL is not set
+
+#
+# Common options for mount/umount
+#
+CONFIG_FEATURE_MOUNT_LOOP=y
+CONFIG_FEATURE_MOUNT_LOOP_CREATE=y
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+CONFIG_VOLUMEID=y
+
+#
+# Filesystem/Volume identification
+#
+# CONFIG_FEATURE_VOLUMEID_BCACHE is not set
+CONFIG_FEATURE_VOLUMEID_BTRFS=y
+CONFIG_FEATURE_VOLUMEID_CRAMFS=y
+CONFIG_FEATURE_VOLUMEID_EXFAT=y
+CONFIG_FEATURE_VOLUMEID_EXT=y
+CONFIG_FEATURE_VOLUMEID_F2FS=y
+CONFIG_FEATURE_VOLUMEID_FAT=y
+CONFIG_FEATURE_VOLUMEID_HFS=y
+CONFIG_FEATURE_VOLUMEID_ISO9660=y
+CONFIG_FEATURE_VOLUMEID_JFS=y
+# CONFIG_FEATURE_VOLUMEID_LFS is not set
+CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
+CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
+CONFIG_FEATURE_VOLUMEID_LUKS=y
+CONFIG_FEATURE_VOLUMEID_MINIX=y
+CONFIG_FEATURE_VOLUMEID_NILFS=y
+CONFIG_FEATURE_VOLUMEID_NTFS=y
+CONFIG_FEATURE_VOLUMEID_OCFS2=y
+CONFIG_FEATURE_VOLUMEID_REISERFS=y
+CONFIG_FEATURE_VOLUMEID_ROMFS=y
+# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
+CONFIG_FEATURE_VOLUMEID_SYSV=y
+CONFIG_FEATURE_VOLUMEID_UBIFS=y
+CONFIG_FEATURE_VOLUMEID_UDF=y
+CONFIG_FEATURE_VOLUMEID_XFS=y
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_ADJTIMEX is not set
+# CONFIG_BBCONFIG is not set
+# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
+# CONFIG_BC is not set
+# CONFIG_DC is not set
+# CONFIG_FEATURE_DC_BIG is not set
+# CONFIG_FEATURE_DC_LIBM is not set
+# CONFIG_FEATURE_BC_INTERACTIVE is not set
+# CONFIG_FEATURE_BC_LONG_OPTIONS is not set
+# CONFIG_BEEP is not set
+CONFIG_FEATURE_BEEP_FREQ=0
+CONFIG_FEATURE_BEEP_LENGTH_MS=0
+# CONFIG_CHAT is not set
+# CONFIG_FEATURE_CHAT_NOFAIL is not set
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
+# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
+# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
+# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
+# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
+# CONFIG_CONSPY is not set
+CONFIG_CROND=y
+CONFIG_FEATURE_CROND_D=y
+# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set
+CONFIG_FEATURE_CROND_DIR="/storage/.cache/cron"
+CONFIG_CRONTAB=y
+# CONFIG_DEVFSD is not set
+# CONFIG_DEVFSD_MODLOAD is not set
+# CONFIG_DEVFSD_FG_NP is not set
+# CONFIG_DEVFSD_VERBOSE is not set
+# CONFIG_FEATURE_DEVFS is not set
+CONFIG_DEVMEM=y
+# CONFIG_FBSPLASH is not set
+CONFIG_FLASH_ERASEALL=y
+# CONFIG_FLASH_LOCK is not set
+# CONFIG_FLASH_UNLOCK is not set
+# CONFIG_FLASHCP is not set
+# CONFIG_HDPARM is not set
+# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
+# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
+# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_HEXEDIT is not set
+# CONFIG_I2CGET is not set
+# CONFIG_I2CSET is not set
+# CONFIG_I2CDUMP is not set
+# CONFIG_I2CDETECT is not set
+# CONFIG_I2CTRANSFER is not set
+# CONFIG_INOTIFYD is not set
+CONFIG_LESS=y
+CONFIG_FEATURE_LESS_MAXLINES=9999999
+CONFIG_FEATURE_LESS_BRACKETS=y
+CONFIG_FEATURE_LESS_FLAGS=y
+CONFIG_FEATURE_LESS_TRUNCATE=y
+CONFIG_FEATURE_LESS_MARKS=y
+CONFIG_FEATURE_LESS_REGEXP=y
+CONFIG_FEATURE_LESS_WINCH=y
+CONFIG_FEATURE_LESS_ASK_TERMINAL=y
+CONFIG_FEATURE_LESS_DASHCMD=y
+CONFIG_FEATURE_LESS_LINENUMS=y
+CONFIG_FEATURE_LESS_RAW=y
+CONFIG_FEATURE_LESS_ENV=y
+# CONFIG_LSSCSI is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
+# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
+# CONFIG_MAN is not set
+# CONFIG_MICROCOM is not set
+# CONFIG_MT is not set
+CONFIG_NANDWRITE=y
+# CONFIG_NANDDUMP is not set
+# CONFIG_PARTPROBE is not set
+# CONFIG_RAIDAUTORUN is not set
+# CONFIG_READAHEAD is not set
+CONFIG_RFKILL=y
+# CONFIG_RUNLEVEL is not set
+# CONFIG_RX is not set
+# CONFIG_SETFATTR is not set
+CONFIG_SETSERIAL=y
+# CONFIG_STRINGS is not set
+CONFIG_TIME=y
+# CONFIG_TS is not set
+CONFIG_TTYSIZE=y
+# CONFIG_UBIATTACH is not set
+# CONFIG_UBIDETACH is not set
+# CONFIG_UBIMKVOL is not set
+# CONFIG_UBIRMVOL is not set
+# CONFIG_UBIRSVOL is not set
+# CONFIG_UBIUPDATEVOL is not set
+# CONFIG_UBIRENAME is not set
+# CONFIG_VOLNAME is not set
+# CONFIG_WATCHDOG is not set
+
+#
+# Networking Utilities
+#
+CONFIG_FEATURE_IPV6=y
+# CONFIG_FEATURE_UNIX_LOCAL is not set
+CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
+# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+# CONFIG_FEATURE_TLS_SHA1 is not set
+CONFIG_ARP=y
+CONFIG_ARPING=y
+CONFIG_BRCTL=y
+CONFIG_FEATURE_BRCTL_FANCY=y
+CONFIG_FEATURE_BRCTL_SHOW=y
+# CONFIG_DNSD is not set
+CONFIG_ETHER_WAKE=y
+# CONFIG_FTPD is not set
+# CONFIG_FEATURE_FTPD_WRITE is not set
+# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
+# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
+CONFIG_FTPGET=y
+CONFIG_FTPPUT=y
+CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y
+CONFIG_HOSTNAME=y
+CONFIG_DNSDOMAINNAME=y
+# CONFIG_HTTPD is not set
+# CONFIG_FEATURE_HTTPD_RANGES is not set
+# CONFIG_FEATURE_HTTPD_SETUID is not set
+# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
+# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
+# CONFIG_FEATURE_HTTPD_CGI is not set
+# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
+# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
+# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
+# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
+# CONFIG_FEATURE_HTTPD_PROXY is not set
+# CONFIG_FEATURE_HTTPD_GZIP is not set
+CONFIG_IFCONFIG=y
+CONFIG_FEATURE_IFCONFIG_STATUS=y
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
+CONFIG_FEATURE_IFCONFIG_HW=y
+CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
+# CONFIG_IFENSLAVE is not set
+CONFIG_IFPLUGD=y
+# CONFIG_IFUP is not set
+# CONFIG_IFDOWN is not set
+CONFIG_IFUPDOWN_IFSTATE_PATH=""
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
+# CONFIG_INETD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+CONFIG_IP=y
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_IPRULE is not set
+# CONFIG_IPNEIGH is not set
+CONFIG_FEATURE_IP_ADDRESS=y
+CONFIG_FEATURE_IP_LINK=y
+CONFIG_FEATURE_IP_ROUTE=y
+CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
+CONFIG_FEATURE_IP_TUNNEL=y
+CONFIG_FEATURE_IP_RULE=y
+# CONFIG_FEATURE_IP_NEIGH is not set
+# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
+# CONFIG_IPCALC is not set
+# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+# CONFIG_FEATURE_IPCALC_FANCY is not set
+# CONFIG_FAKEIDENTD is not set
+# CONFIG_NAMEIF is not set
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
+CONFIG_NBDCLIENT=y
+CONFIG_NC=y
+# CONFIG_NETCAT is not set
+CONFIG_NC_SERVER=y
+CONFIG_NC_EXTRA=y
+CONFIG_NC_110_COMPAT=y
+CONFIG_NETSTAT=y
+# CONFIG_FEATURE_NETSTAT_WIDE is not set
+CONFIG_FEATURE_NETSTAT_PRG=y
+CONFIG_NSLOOKUP=y
+# CONFIG_FEATURE_NSLOOKUP_BIG is not set
+# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
+CONFIG_NTPD=y
+# CONFIG_FEATURE_NTPD_SERVER is not set
+CONFIG_FEATURE_NTPD_CONF=y
+CONFIG_FEATURE_NTP_AUTH=y
+CONFIG_PING=y
+CONFIG_PING6=y
+CONFIG_FEATURE_FANCY_PING=y
+# CONFIG_PSCAN is not set
+CONFIG_ROUTE=y
+# CONFIG_SLATTACH is not set
+# CONFIG_SSL_CLIENT is not set
+# CONFIG_TC is not set
+# CONFIG_FEATURE_TC_INGRESS is not set
+# CONFIG_TCPSVD is not set
+# CONFIG_UDPSVD is not set
+CONFIG_TELNET=y
+CONFIG_FEATURE_TELNET_TTYPE=y
+CONFIG_FEATURE_TELNET_AUTOLOGIN=y
+# CONFIG_FEATURE_TELNET_WIDTH is not set
+# CONFIG_TELNETD is not set
+# CONFIG_FEATURE_TELNETD_STANDALONE is not set
+# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
+# CONFIG_TFTP is not set
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set
+# CONFIG_TFTPD is not set
+# CONFIG_FEATURE_TFTP_GET is not set
+# CONFIG_FEATURE_TFTP_PUT is not set
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_TFTP_DEBUG is not set
+# CONFIG_TLS is not set
+CONFIG_TRACEROUTE=y
+CONFIG_TRACEROUTE6=y
+CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
+# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
+# CONFIG_TUNCTL is not set
+# CONFIG_FEATURE_TUNCTL_UG is not set
+CONFIG_VCONFIG=y
+CONFIG_WGET=y
+CONFIG_FEATURE_WGET_LONG_OPTIONS=y
+CONFIG_FEATURE_WGET_STATUSBAR=y
+CONFIG_FEATURE_WGET_AUTHENTICATION=y
+CONFIG_FEATURE_WGET_TIMEOUT=y
+# CONFIG_FEATURE_WGET_HTTPS is not set
+CONFIG_FEATURE_WGET_OPENSSL=y
+CONFIG_WHOIS=y
+# CONFIG_ZCIP is not set
+# CONFIG_UDHCPD is not set
+# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
+CONFIG_DHCPD_LEASES_FILE=""
+# CONFIG_DUMPLEASES is not set
+# CONFIG_DHCPRELAY is not set
+# CONFIG_UDHCPC is not set
+# CONFIG_FEATURE_UDHCPC_ARPING is not set
+# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
+CONFIG_UDHCPC_DEFAULT_SCRIPT=""
+# CONFIG_UDHCPC6 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
+# CONFIG_FEATURE_UDHCP_PORT is not set
+CONFIG_UDHCP_DEBUG=0
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
+# CONFIG_FEATURE_UDHCP_RFC3397 is not set
+# CONFIG_FEATURE_UDHCP_8021Q is not set
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
+
+#
+# Print Utilities
+#
+# CONFIG_LPD is not set
+# CONFIG_LPR is not set
+# CONFIG_LPQ is not set
+
+#
+# Mail Utilities
+#
+# CONFIG_MAKEMIME is not set
+# CONFIG_POPMAILDIR is not set
+# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
+# CONFIG_REFORMIME is not set
+# CONFIG_FEATURE_REFORMIME_COMPAT is not set
+# CONFIG_SENDMAIL is not set
+CONFIG_FEATURE_MIME_CHARSET=""
+
+#
+# Process Utilities
+#
+# CONFIG_FREE is not set
+CONFIG_FUSER=y
+CONFIG_IOSTAT=y
+CONFIG_KILL=y
+CONFIG_KILLALL=y
+CONFIG_KILLALL5=y
+CONFIG_LSOF=y
+CONFIG_MPSTAT=y
+# CONFIG_NMETER is not set
+CONFIG_PGREP=y
+CONFIG_PKILL=y
+CONFIG_PIDOF=y
+CONFIG_FEATURE_PIDOF_SINGLE=y
+CONFIG_FEATURE_PIDOF_OMIT=y
+CONFIG_PMAP=y
+# CONFIG_POWERTOP is not set
+# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
+CONFIG_PS=y
+# CONFIG_FEATURE_PS_WIDE is not set
+# CONFIG_FEATURE_PS_LONG is not set
+CONFIG_FEATURE_PS_TIME=y
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
+CONFIG_PSTREE=y
+CONFIG_PWDX=y
+CONFIG_SMEMCAP=y
+CONFIG_BB_SYSCTL=y
+# CONFIG_TOP is not set
+# CONFIG_FEATURE_TOP_INTERACTIVE is not set
+# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set
+# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set
+# CONFIG_FEATURE_TOP_SMP_CPU is not set
+# CONFIG_FEATURE_TOP_DECIMALS is not set
+# CONFIG_FEATURE_TOP_SMP_PROCESS is not set
+# CONFIG_FEATURE_TOPMEM is not set
+CONFIG_UPTIME=y
+# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
+CONFIG_WATCH=y
+CONFIG_FEATURE_SHOW_THREADS=y
+
+#
+# Runit Utilities
+#
+# CONFIG_CHPST is not set
+# CONFIG_SETUIDGID is not set
+# CONFIG_ENVUIDGID is not set
+# CONFIG_ENVDIR is not set
+# CONFIG_SOFTLIMIT is not set
+# CONFIG_RUNSV is not set
+# CONFIG_RUNSVDIR is not set
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
+# CONFIG_SV is not set
+CONFIG_SV_DEFAULT_SERVICE_DIR=""
+# CONFIG_SVC is not set
+# CONFIG_SVOK is not set
+# CONFIG_SVLOGD is not set
+# CONFIG_CHCON is not set
+# CONFIG_GETENFORCE is not set
+# CONFIG_GETSEBOOL is not set
+# CONFIG_LOAD_POLICY is not set
+# CONFIG_MATCHPATHCON is not set
+# CONFIG_RUNCON is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_SESTATUS is not set
+# CONFIG_SETENFORCE is not set
+# CONFIG_SETFILES is not set
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_RESTORECON is not set
+# CONFIG_SETSEBOOL is not set
+
+#
+# Shells
+#
+CONFIG_SH_IS_ASH=y
+# CONFIG_SH_IS_HUSH is not set
+# CONFIG_SH_IS_NONE is not set
+CONFIG_BASH_IS_ASH=y
+# CONFIG_BASH_IS_HUSH is not set
+# CONFIG_BASH_IS_NONE is not set
+CONFIG_ASH=y
+# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set
+# CONFIG_ASH_INTERNAL_GLOB is not set
+CONFIG_ASH_BASH_COMPAT=y
+# CONFIG_ASH_BASH_SOURCE_CURDIR is not set
+# CONFIG_ASH_BASH_NOT_FOUND_HOOK is not set
+CONFIG_ASH_JOB_CONTROL=y
+CONFIG_ASH_ALIAS=y
+CONFIG_ASH_RANDOM_SUPPORT=y
+CONFIG_ASH_EXPAND_PRMT=y
+# CONFIG_ASH_IDLE_TIMEOUT is not set
+# CONFIG_ASH_MAIL is not set
+CONFIG_ASH_ECHO=y
+CONFIG_ASH_PRINTF=y
+CONFIG_ASH_TEST=y
+CONFIG_ASH_HELP=y
+CONFIG_ASH_GETOPTS=y
+CONFIG_ASH_CMDCMD=y
+# CONFIG_CTTYHACK is not set
+# CONFIG_HUSH is not set
+# CONFIG_HUSH_BASH_COMPAT is not set
+# CONFIG_HUSH_BRACE_EXPANSION is not set
+# CONFIG_HUSH_LINENO_VAR is not set
+# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
+# CONFIG_HUSH_INTERACTIVE is not set
+# CONFIG_HUSH_SAVEHISTORY is not set
+# CONFIG_HUSH_JOB is not set
+# CONFIG_HUSH_TICK is not set
+# CONFIG_HUSH_IF is not set
+# CONFIG_HUSH_LOOPS is not set
+# CONFIG_HUSH_CASE is not set
+# CONFIG_HUSH_FUNCTIONS is not set
+# CONFIG_HUSH_LOCAL is not set
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH_MODE_X is not set
+# CONFIG_HUSH_ECHO is not set
+# CONFIG_HUSH_PRINTF is not set
+# CONFIG_HUSH_TEST is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_EXPORT is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_READONLY is not set
+# CONFIG_HUSH_KILL is not set
+# CONFIG_HUSH_WAIT is not set
+# CONFIG_HUSH_COMMAND is not set
+# CONFIG_HUSH_TRAP is not set
+# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_TIMES is not set
+# CONFIG_HUSH_READ is not set
+# CONFIG_HUSH_SET is not set
+# CONFIG_HUSH_UNSET is not set
+# CONFIG_HUSH_ULIMIT is not set
+# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_GETOPTS is not set
+# CONFIG_HUSH_MEMLEAK is not set
+# CONFIG_SHELL_HUSH is not set
+
+#
+# Options common to all shells
+#
+CONFIG_FEATURE_SH_MATH=y
+CONFIG_FEATURE_SH_MATH_64=y
+CONFIG_FEATURE_SH_MATH_BASE=y
+CONFIG_FEATURE_SH_EXTRA_QUIET=y
+# CONFIG_FEATURE_SH_STANDALONE is not set
+# CONFIG_FEATURE_SH_NOFORK is not set
+CONFIG_FEATURE_SH_READ_FRAC=y
+CONFIG_FEATURE_SH_HISTFILESIZE=y
+# CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS is not set
+
+#
+# System Logging Utilities
+#
+# CONFIG_KLOGD is not set
+# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
+CONFIG_LOGGER=y
+# CONFIG_LOGREAD is not set
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+# CONFIG_SYSLOGD is not set
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+# CONFIG_FEATURE_REMOTE_LOG is not set
+# CONFIG_FEATURE_SYSLOGD_DUP is not set
+# CONFIG_FEATURE_SYSLOGD_CFG is not set
+# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
+# CONFIG_FEATURE_IPC_SYSLOG is not set
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
+# CONFIG_FEATURE_KMSG_SYSLOG is not set
diff --git a/projects/L4T/packages/busybox/config/inputrc b/projects/L4T/packages/busybox/config/inputrc
new file mode 100644
index 00000000000..5253889c399
--- /dev/null
+++ b/projects/L4T/packages/busybox/config/inputrc
@@ -0,0 +1,66 @@
+# /etc/inputrc - global inputrc for libreadline
+# See readline(3readline) and `info rluserman' for more information.
+
+# Be 8 bit clean.
+set input-meta on
+set output-meta on
+
+# To allow the use of 8bit-characters like the german umlauts, uncomment
+# the line below. However this makes the meta key not work as a meta key,
+# which is annoying to those which don't need to type in 8-bit characters.
+
+# set convert-meta off
+
+# try to enable the application keypad when it is called. Some systems
+# need this to enable the arrow keys.
+# set enable-keypad on
+
+# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys
+
+# do not bell on tab-completion
+# set bell-style none
+# set bell-style visible
+
+# some defaults / modifications for the emacs mode
+$if mode=emacs
+
+# allow the use of the Home/End keys
+"\e[1~": beginning-of-line
+"\e[4~": end-of-line
+
+# allow the use of the Delete/Insert keys
+"\e[3~": delete-char
+"\e[2~": quoted-insert
+
+# mappings for "page up" and "page down" to step to the beginning/end
+# of the history
+# "\e[5~": beginning-of-history
+# "\e[6~": end-of-history
+
+# alternate mappings for "page up" and "page down" to search the history
+# "\e[5~": history-search-backward
+# "\e[6~": history-search-forward
+
+# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
+"\e[1;5C": forward-word
+"\e[1;5D": backward-word
+"\e[5C": forward-word
+"\e[5D": backward-word
+"\e\e[C": forward-word
+"\e\e[D": backward-word
+
+$if term=rxvt
+"\e[8~": end-of-line
+"\eOc": forward-word
+"\eOd": backward-word
+$endif
+
+# for non RH/Debian xterm, can't hurt for RH/Debian xterm
+# "\eOH": beginning-of-line
+# "\eOF": end-of-line
+
+# for freebsd console
+# "\e[H": beginning-of-line
+# "\e[F": end-of-line
+
+$endif
diff --git a/projects/L4T/packages/busybox/config/profile b/projects/L4T/packages/busybox/config/profile
new file mode 100644
index 00000000000..79cce3c76aa
--- /dev/null
+++ b/projects/L4T/packages/busybox/config/profile
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+# parse command line arguments
+ for arg in $(cat /proc/cmdline); do
+ case $arg in
+ debugging)
+ export DEBUG=yes
+ ;;
+ progress)
+ PROGRESS=yes
+ ;;
+ esac
+ done
+
+ if [ -e /storage/.cache/debug.libreelec ] ; then
+ export DEBUG=yes
+ fi
+
+# functions
+ progress() {
+ if test "$PROGRESS" = yes; then
+ logger -s -t Boot "### $1 ###"
+ else
+ logger -t Boot "### $1 ###"
+ fi
+ }
+
+# read config files
+ for config in /etc/profile.d/*; do
+ if [ -f "$config" ] ; then
+ . $config
+ fi
+ done
diff --git a/projects/L4T/packages/busybox/config/suspend-modules.conf b/projects/L4T/packages/busybox/config/suspend-modules.conf
new file mode 100644
index 00000000000..10d1db19be3
--- /dev/null
+++ b/projects/L4T/packages/busybox/config/suspend-modules.conf
@@ -0,0 +1 @@
+SUSPEND_MODULES="jme asix anysee rtl8192se imon r8712u cx23885 cdc_acm ddbridge brcmfmac 8812au xpad"
diff --git a/projects/L4T/packages/busybox/default.d/crond.conf b/projects/L4T/packages/busybox/default.d/crond.conf
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/projects/L4T/packages/busybox/package.mk b/projects/L4T/packages/busybox/package.mk
new file mode 100644
index 00000000000..efc75d36291
--- /dev/null
+++ b/projects/L4T/packages/busybox/package.mk
@@ -0,0 +1,253 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
+
+PKG_NAME="busybox"
+PKG_VERSION="1.32.1"
+PKG_SHA256="9d57c4bd33974140fd4111260468af22856f12f5b5ef7c70c8d9b75c712a0dee"
+PKG_LICENSE="GPL"
+PKG_SITE="http://www.busybox.net"
+PKG_URL="https://busybox.net/downloads/${PKG_NAME}-${PKG_VERSION}.tar.bz2"
+PKG_DEPENDS_HOST="toolchain:host"
+PKG_DEPENDS_TARGET="toolchain busybox:host hdparm dosfstools e2fsprogs zip usbutils parted procps-ng gptfdisk libtirpc"
+PKG_DEPENDS_INIT="toolchain libtirpc"
+PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable."
+# busybox fails to build with GOLD support enabled with binutils-2.25
+PKG_BUILD_FLAGS="-parallel -gold"
+
+# nano text editor
+if [ "${NANO_EDITOR}" = "yes" ]; then
+ PKG_DEPENDS_TARGET+=" nano"
+fi
+
+# nfs support
+if [ "${NFS_SUPPORT}" = yes ]; then
+ PKG_DEPENDS_TARGET+=" rpcbind"
+fi
+
+if [ "${TARGET_ARCH}" = "x86_64" -o "${TARGET_ARCH}" = "i386" ]; then
+ PKG_DEPENDS_TARGET+=" pciutils"
+fi
+
+pre_build_target() {
+ PKG_MAKE_OPTS_TARGET="ARCH=${TARGET_ARCH} \
+ HOSTCC=${HOST_CC} \
+ CROSS_COMPILE=${TARGET_PREFIX} \
+ KBUILD_VERBOSE=1 \
+ install"
+
+ mkdir -p ${PKG_BUILD}/.${TARGET_NAME}
+ cp -RP ${PKG_BUILD}/* ${PKG_BUILD}/.${TARGET_NAME}
+}
+
+pre_build_host() {
+ PKG_MAKE_OPTS_HOST="ARCH=${TARGET_ARCH} CROSS_COMPILE= KBUILD_VERBOSE=1 install"
+
+ mkdir -p ${PKG_BUILD}/.${HOST_NAME}
+ cp -RP ${PKG_BUILD}/* ${PKG_BUILD}/.${HOST_NAME}
+}
+
+pre_build_init() {
+ PKG_MAKE_OPTS_INIT="ARCH=${TARGET_ARCH} \
+ HOSTCC=${HOST_CC} \
+ CROSS_COMPILE=${TARGET_PREFIX} \
+ KBUILD_VERBOSE=1 \
+ install"
+
+ mkdir -p ${PKG_BUILD}/.${TARGET_NAME}-init
+ cp -RP ${PKG_BUILD}/* ${PKG_BUILD}/.${TARGET_NAME}-init
+}
+
+configure_host() {
+ cd ${PKG_BUILD}/.${HOST_NAME}
+ cp ${PKG_DIR}/config/busybox-host.conf .config
+
+ # set install dir
+ sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"${PKG_BUILD}/.install_host\"|" .config
+
+ make oldconfig
+}
+
+configure_target() {
+ cd ${PKG_BUILD}/.${TARGET_NAME}
+ find_file_path config/busybox-target.conf
+ cp ${FOUND_PATH} .config
+
+ # set install dir
+ sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"${INSTALL}/usr\"|" .config
+
+ if [ ! "${CRON_SUPPORT}" = "yes" ]; then
+ sed -i -e "s|^CONFIG_CROND=.*$|# CONFIG_CROND is not set|" .config
+ sed -i -e "s|^CONFIG_FEATURE_CROND_D=.*$|# CONFIG_FEATURE_CROND_D is not set|" .config
+ sed -i -e "s|^CONFIG_CRONTAB=.*$|# CONFIG_CRONTAB is not set|" .config
+ sed -i -e "s|^CONFIG_FEATURE_CROND_SPECIAL_TIMES=.*$|# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set|" .config
+ fi
+
+ if [ ! "${SAMBA_SUPPORT}" = yes ]; then
+ sed -i -e "s|^CONFIG_FEATURE_MOUNT_CIFS=.*$|# CONFIG_FEATURE_MOUNT_CIFS is not set|" .config
+ fi
+
+ # optimize for size
+ CFLAGS=$(echo ${CFLAGS} | sed -e "s|-Ofast|-Os|")
+ CFLAGS=$(echo ${CFLAGS} | sed -e "s|-O.|-Os|")
+ CFLAGS+=" -I${SYSROOT_PREFIX}/usr/include/tirpc"
+
+ LDFLAGS+=" -fwhole-program"
+
+ make oldconfig
+}
+
+configure_init() {
+ cd ${PKG_BUILD}/.${TARGET_NAME}-init
+ find_file_path config/busybox-init.conf
+ cp ${FOUND_PATH} .config
+
+ # set install dir
+ sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"${INSTALL}/usr\"|" .config
+
+ # optimize for size
+ CFLAGS=$(echo ${CFLAGS} | sed -e "s|-Ofast|-Os|")
+ CFLAGS=$(echo ${CFLAGS} | sed -e "s|-O.|-Os|")
+ CFLAGS+=" -I${SYSROOT_PREFIX}/usr/include/tirpc"
+
+ LDFLAGS+=" -fwhole-program"
+
+ make oldconfig
+}
+
+makeinstall_host() {
+ mkdir -p ${TOOLCHAIN}/bin
+ cp -R ${PKG_BUILD}/.install_host/bin/* ${TOOLCHAIN}/bin
+}
+
+makeinstall_target() {
+ mkdir -p ${INSTALL}/usr/bin
+ if [ ${TARGET_ARCH} = x86_64 -o ${TARGET_ARCH} = i386 ]; then
+ cp ${PKG_DIR}/scripts/getedid ${INSTALL}/usr/bin
+ else
+ cp ${PKG_DIR}/scripts/dump-active-edids-drm ${INSTALL}/usr/bin/dump-active-edids
+ fi
+ cp ${PKG_DIR}/scripts/create-edid-cpio ${INSTALL}/usr/bin/
+ if [ "${PROJECT}" = "RPi" ]; then
+ cp ${PKG_DIR}/scripts/update-bootloader-edid-rpi ${INSTALL}/usr/bin/update-bootloader-edid
+ cp ${PKG_DIR}/scripts/getedid-drm ${INSTALL}/usr/bin/getedid
+ fi
+ cp ${PKG_DIR}/scripts/createlog ${INSTALL}/usr/bin/
+ if [ "${DISTRO}" = "Lakka" ]; then
+ cp ${PKG_DIR}/scripts/createlog-lakka ${INSTALL}/usr/bin/createlog
+ fi
+ cp ${PKG_DIR}/scripts/dthelper ${INSTALL}/usr/bin
+ ln -sf dthelper ${INSTALL}/usr/bin/dtfile
+ ln -sf dthelper ${INSTALL}/usr/bin/dtflag
+ ln -sf dthelper ${INSTALL}/usr/bin/dtname
+ ln -sf dthelper ${INSTALL}/usr/bin/dtsoc
+ cp ${PKG_DIR}/scripts/ledfix ${INSTALL}/usr/bin
+ cp ${PKG_DIR}/scripts/lsb_release ${INSTALL}/usr/bin/
+ cp ${PKG_DIR}/scripts/apt-get ${INSTALL}/usr/bin/
+ cp ${PKG_DIR}/scripts/sudo ${INSTALL}/usr/bin/
+ cp ${PKG_DIR}/scripts/pastebinit ${INSTALL}/usr/bin/
+ ln -sf pastebinit ${INSTALL}/usr/bin/paste
+
+ mkdir -p ${INSTALL}/usr/sbin
+ cp ${PKG_DIR}/scripts/kernel-overlays-setup ${INSTALL}/usr/sbin
+
+ mkdir -p ${INSTALL}/usr/lib/libreelec
+ cp ${PKG_DIR}/scripts/functions ${INSTALL}/usr/lib/libreelec
+ cp ${PKG_DIR}/scripts/fs-resize ${INSTALL}/usr/lib/libreelec
+ sed -e "s/@DISTRONAME@/${DISTRONAME}/g" \
+ -i ${INSTALL}/usr/lib/libreelec/fs-resize
+
+ if listcontains "${FIRMWARE}" "rpi-eeprom"; then
+ cp ${PKG_DIR}/scripts/rpi-flash-firmware ${INSTALL}/usr/lib/libreelec
+ fi
+
+ mkdir -p ${INSTALL}/usr/lib/systemd/system-generators/
+ cp ${PKG_DIR}/scripts/libreelec-target-generator ${INSTALL}/usr/lib/systemd/system-generators/
+
+ mkdir -p ${INSTALL}/etc
+ cp ${PKG_DIR}/config/profile ${INSTALL}/etc
+ cp ${PKG_DIR}/config/inputrc ${INSTALL}/etc
+ cp ${PKG_DIR}/config/suspend-modules.conf ${INSTALL}/etc
+
+ if [ "${DEVICE}" = "Switch" ]; then
+ sed -i 's/brcmfmac//' ${INSTALL}/etc/suspend-modules.conf
+ fi
+
+ # /etc/fstab is needed by...
+ touch ${INSTALL}/etc/fstab
+
+ # /etc/machine-id, needed by systemd and dbus
+ ln -sf /storage/.cache/systemd-machine-id ${INSTALL}/etc/machine-id
+
+ # /etc/mtab is needed by udisks etc...
+ ln -sf /proc/self/mounts ${INSTALL}/etc/mtab
+
+ # create /etc/hostname
+ ln -sf /proc/sys/kernel/hostname ${INSTALL}/etc/hostname
+}
+
+post_install() {
+ echo "chmod 4755 ${INSTALL}/usr/bin/busybox" >> ${FAKEROOT_SCRIPT}
+ echo "chmod 000 ${INSTALL}/usr/cache/shadow" >> ${FAKEROOT_SCRIPT}
+
+ add_user root "${ROOT_PASSWORD}" 0 0 "Root User" "/storage" "/bin/sh"
+ add_group root 0
+ add_group users 100
+ if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ add_user "${DISTRO}" "${DISTRO}" 1000 1000 "${DISTRO} User" "/storage" "/sbin/nologin"
+ add_group "${DISTRO}" 1000 ${DISTRO}
+ fi
+
+ add_user nobody x 65534 65534 "Nobody" "/" "/bin/sh"
+ add_group nogroup 65534
+
+ enable_service fs-resize.service
+ enable_service ledfix.service
+ enable_service shell.service
+ enable_service show-version.service
+ enable_service var.mount
+ listcontains "${FIRMWARE}" "rpi-eeprom" && enable_service rpi-flash-firmware.service
+
+ # cron support
+ if [ "${CRON_SUPPORT}" = "yes" ]; then
+ mkdir -p ${INSTALL}/usr/lib/systemd/system
+ cp ${PKG_DIR}/system.d.opt/cron.service ${INSTALL}/usr/lib/systemd/system
+ enable_service cron.service
+ mkdir -p ${INSTALL}/usr/share/services
+ cp -P ${PKG_DIR}/default.d/*.conf ${INSTALL}/usr/share/services
+ cp ${PKG_DIR}/system.d.opt/cron-defaults.service ${INSTALL}/usr/lib/systemd/system
+ enable_service cron-defaults.service
+ fi
+
+ # Lakka - make some folders world writable
+ if [ "${DISTRO}" = "Lakka" ]; then
+ sed -i ${INSTALL}/usr/lib/tmpfiles.d/z_01_busybox.conf \
+ -e 's|0755|0777|g'
+ fi
+}
+
+makeinstall_init() {
+ mkdir -p ${INSTALL}/bin
+ ln -sf busybox ${INSTALL}/usr/bin/sh
+ chmod 4755 ${INSTALL}/usr/bin/busybox
+
+ mkdir -p ${INSTALL}/etc
+ touch ${INSTALL}/etc/fstab
+ ln -sf /proc/self/mounts ${INSTALL}/etc/mtab
+
+ if find_file_path initramfs/platform_init; then
+ cp ${FOUND_PATH} ${INSTALL}
+ sed -e "s/@BOOT_LABEL@/${DISTRO_BOOTLABEL}/g" \
+ -e "s/@DISK_LABEL@/${DISTRO_DISKLABEL}/g" \
+ -i ${INSTALL}/platform_init
+ chmod 755 ${INSTALL}/platform_init
+ fi
+
+ cp ${PKG_DIR}/scripts/functions ${INSTALL}
+ cp ${PKG_DIR}/scripts/init ${INSTALL}
+
+ sed -e "s/@DISTRONAME@/${DISTRONAME}/g" \
+ -e "s/@KERNEL_NAME@/${KERNEL_NAME}/g" \
+ -i ${INSTALL}/init
+ chmod 755 ${INSTALL}/init
+}
diff --git a/projects/L4T/packages/busybox/patches/busybox-00_halt_no_init.patch b/projects/L4T/packages/busybox/patches/busybox-00_halt_no_init.patch
new file mode 100644
index 00000000000..ce454f4c07b
--- /dev/null
+++ b/projects/L4T/packages/busybox/patches/busybox-00_halt_no_init.patch
@@ -0,0 +1,12 @@
+diff -Naur busybox-1.13.2/init/halt.c busybox-1.13.2a/init/halt.c
+--- busybox-1.13.2/init/halt.c 2008-11-09 18:28:19.000000000 +0100
++++ busybox-1.13.2a/init/halt.c 2009-02-01 16:38:37.000000000 +0100
+@@ -79,7 +79,7 @@
+
+ /* Perform action. */
+ rc = 1;
+- if (!(flags & 4)) { /* no -f */
++ if (ENABLE_INIT && !(flags & 4)) { /* no -f */
+ //TODO: I tend to think that signalling linuxrc is wrong
+ // pity original author didn't comment on it...
+ if (ENABLE_FEATURE_INITRD) {
diff --git a/projects/L4T/packages/busybox/patches/busybox-02_silence-crond-startup-logging.patch b/projects/L4T/packages/busybox/patches/busybox-02_silence-crond-startup-logging.patch
new file mode 100644
index 00000000000..30105bdb185
--- /dev/null
+++ b/projects/L4T/packages/busybox/patches/busybox-02_silence-crond-startup-logging.patch
@@ -0,0 +1,20 @@
+From 5f4085ddb16c206b1dc36d481c2aa6684ba392ee Mon Sep 17 00:00:00 2001
+From: Stefan Saraev
+Date: Thu, 18 Jul 2013 19:26:21 +0300
+Subject: [PATCH] silence crond startup logging
+
+---
+ miscutils/crond.c | 1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+diff -Naur busybox-1.23.0/miscutils/crond.c busybox-1.23.0.patch/miscutils/crond.c
+--- busybox-1.23.0/miscutils/crond.c 2014-10-04 22:35:59.000000000 +0200
++++ busybox-1.23.0.patch/miscutils/crond.c 2014-12-26 23:07:53.386118290 +0100
+@@ -1054,7 +1054,6 @@
+ /* Useful on Android where DEFAULT_SHELL /bin/sh may not exist */
+ G.default_shell = xstrdup(get_shell_name());
+
+- log8("crond (busybox "BB_VER") started, log level %d", G.log_level);
+ rescan_crontab_dir();
+ write_pidfile(CONFIG_PID_FILE_PATH "/crond.pid");
+ #if ENABLE_FEATURE_CROND_SPECIAL_TIMES
diff --git a/projects/L4T/packages/busybox/patches/busybox-03-make_unicode_printable.patch b/projects/L4T/packages/busybox/patches/busybox-03-make_unicode_printable.patch
new file mode 100644
index 00000000000..ec7354f6d41
--- /dev/null
+++ b/projects/L4T/packages/busybox/patches/busybox-03-make_unicode_printable.patch
@@ -0,0 +1,26 @@
+#
+# stolen from OpenWRT
+#
+# https://dev.openwrt.org/attachment/ticket/7993/701-make_unicode_printable.patch
+#
+
+--- a/libbb/printable_string.c 2013-01-13 20:06:04.210089516 +0800
++++ b/libbb/printable_string.c 2013-01-13 20:00:27.917211167 +0800
+@@ -31,8 +31,6 @@
+ }
+ if (c < ' ')
+ break;
+- if (c >= 0x7f)
+- break;
+ s++;
+ }
+
+@@ -45,7 +43,7 @@
+ unsigned char c = *d;
+ if (c == '\0')
+ break;
+- if (c < ' ' || c >= 0x7f)
++ if (c < ' ')
+ *d = '?';
+ d++;
+ }
diff --git a/projects/L4T/packages/busybox/patches/busybox-04-revert-dd-fsync-change.patch b/projects/L4T/packages/busybox/patches/busybox-04-revert-dd-fsync-change.patch
new file mode 100644
index 00000000000..e5dabec86a4
--- /dev/null
+++ b/projects/L4T/packages/busybox/patches/busybox-04-revert-dd-fsync-change.patch
@@ -0,0 +1,34 @@
+From 0a61b6174d86fd0300be7cd4fa0b47ff12735958 Mon Sep 17 00:00:00 2001
+From: MilhouseVH
+Date: Tue, 8 Aug 2017 22:25:03 +0100
+Subject: [PATCH] Revert "dd: call fsync() only once before exiting if
+ conv=fsync is specified"
+
+This reverts commit dba0dc1999bb1e8bfe64607e2a9385cda361fcb7.
+---
+ coreutils/dd.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/coreutils/dd.c b/coreutils/dd.c
+index d302f35..bf0c4ab 100644
+--- a/coreutils/dd.c
++++ b/coreutils/dd.c
+@@ -531,11 +531,11 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
+ if (write_and_stats(ibuf, n, obs, outfile))
+ goto out_status;
+ }
+- }
+
+- if (G.flags & FLAG_FSYNC) {
+- if (fsync(ofd) < 0)
+- goto die_outfile;
++ if (G.flags & FLAG_FSYNC) {
++ if (fsync(ofd) < 0)
++ goto die_outfile;
++ }
+ }
+
+ if (ENABLE_FEATURE_DD_IBS_OBS && oc) {
+--
+2.7.4
+
diff --git a/projects/L4T/packages/busybox/patches/busybox-05-update-shadow-or-passwd-not-both.patch b/projects/L4T/packages/busybox/patches/busybox-05-update-shadow-or-passwd-not-both.patch
new file mode 100644
index 00000000000..b2698c9808c
--- /dev/null
+++ b/projects/L4T/packages/busybox/patches/busybox-05-update-shadow-or-passwd-not-both.patch
@@ -0,0 +1,12 @@
+diff -Naur a/loginutils/passwd.c b/loginutils/passwd.c
+--- a/loginutils/passwd.c 2017-07-06 08:14:57.000000000 -0700
++++ b/loginutils/passwd.c 2017-09-11 17:06:07.572805135 -0700
+@@ -220,7 +220,7 @@
+ if (rc > 0)
+ /* password in /etc/shadow was updated */
+ newp = (char*) "x";
+- if (rc >= 0)
++ if (rc == 0)
+ /* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */
+ #endif
+ {
diff --git a/projects/L4T/packages/busybox/patches/busybox-06-prevent-root-weak-passwd.patch b/projects/L4T/packages/busybox/patches/busybox-06-prevent-root-weak-passwd.patch
new file mode 100644
index 00000000000..a8e5c706cff
--- /dev/null
+++ b/projects/L4T/packages/busybox/patches/busybox-06-prevent-root-weak-passwd.patch
@@ -0,0 +1,12 @@
+diff --git a/loginutils/passwd.c b/loginutils/passwd.c
+index 6c643d3..df8859d 100644
+--- a/loginutils/passwd.c
++++ b/loginutils/passwd.c
+@@ -69,7 +69,6 @@ static char* new_password(const struct passwd *pw, uid_t myuid, const char *algo
+ goto err_ret;
+ if (ENABLE_FEATURE_PASSWD_WEAK_CHECK
+ && obscure(orig, newp, pw) /* NB: passing NULL orig is ok */
+- && myuid != 0
+ ) {
+ goto err_ret; /* non-root is not allowed to have weak passwd */
+ }
diff --git a/projects/L4T/packages/busybox/patches/busybox-07-hwclock_fix_settimeofday.patch b/projects/L4T/packages/busybox/patches/busybox-07-hwclock_fix_settimeofday.patch
new file mode 100644
index 00000000000..89ce4e68e76
--- /dev/null
+++ b/projects/L4T/packages/busybox/patches/busybox-07-hwclock_fix_settimeofday.patch
@@ -0,0 +1,58 @@
+From 1a5d6fcbb5e606ab4acdf22afa26361a25f1d43b Mon Sep 17 00:00:00 2001
+From: Eddie James
+Date: Mon, 10 Aug 2020 09:59:02 -0500
+Subject: hwclock: Fix settimeofday for glibc v2.31+
+
+The glibc implementation changed for settimeofday, resulting in "invalid
+argument" error when attempting to set both timezone and time with a single
+call. Fix this by calling settimeofday twice
+
+Signed-off-by: Eddie James
+Signed-off-by: Denys Vlasenko
+---
+ util-linux/hwclock.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
+index 357906cca..e85bca2b2 100644
+--- a/util-linux/hwclock.c
++++ b/util-linux/hwclock.c
+@@ -121,16 +121,20 @@ static void to_sys_clock(const char **pp_rtcname, int utc)
+ struct timeval tv;
+ struct timezone tz;
+
+- tz.tz_minuteswest = timezone/60;
++ tz.tz_minuteswest = timezone / 60;
+ /* ^^^ used to also subtract 60*daylight, but it's wrong:
+ * daylight!=0 means "this timezone has some DST
+ * during the year", not "DST is in effect now".
+ */
+ tz.tz_dsttime = 0;
+
++ /* glibc v2.31+ returns an error if both args are non-NULL */
++ if (settimeofday(NULL, &tz))
++ bb_simple_perror_msg_and_die("settimeofday");
++
+ tv.tv_sec = read_rtc(pp_rtcname, NULL, utc);
+ tv.tv_usec = 0;
+- if (settimeofday(&tv, &tz))
++ if (settimeofday(&tv, NULL))
+ bb_simple_perror_msg_and_die("settimeofday");
+ }
+
+@@ -282,7 +286,11 @@ static void set_system_clock_timezone(int utc)
+ gettimeofday(&tv, NULL);
+ if (!utc)
+ tv.tv_sec += tz.tz_minuteswest * 60;
+- if (settimeofday(&tv, &tz))
++
++ /* glibc v2.31+ returns an error if both args are non-NULL */
++ if (settimeofday(NULL, &tz))
++ bb_simple_perror_msg_and_die("settimeofday");
++ if (settimeofday(&tv, NULL))
+ bb_simple_perror_msg_and_die("settimeofday");
+ }
+
+--
+cgit v1.2.3
+
diff --git a/projects/L4T/packages/busybox/profile.d/98-busybox.conf b/projects/L4T/packages/busybox/profile.d/98-busybox.conf
new file mode 100644
index 00000000000..4fe823992c5
--- /dev/null
+++ b/projects/L4T/packages/busybox/profile.d/98-busybox.conf
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+export HOME="/storage"
+export PATH="/usr/bin:/usr/sbin"
+export LD_LIBRARY_PATH="/usr/lib"
+export HOSTNAME=`cat /etc/hostname`
+export PS1="\[\e[1;32m\]\h\[\e[1;32m\]:\[\e[1;34m\]\w \[\e[0m\]\\$ "
+export HISTFILESIZE=200
+# k0p
+case "$TERM" in
+ linux|nxterm|screen|xterm|xterm-color|st-256color)
+ ;;
+ "")
+ export TERM="linux"
+ ;;
+ *)
+ export TERM="xterm"
+ ;;
+esac
diff --git a/projects/L4T/packages/busybox/scripts/apt-get b/projects/L4T/packages/busybox/scripts/apt-get
new file mode 100755
index 00000000000..bac29e72eb6
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/apt-get
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
+
+message="$message\n There is no working 'apt-get'."
+message="$message\n "
+message="$message\n 'apt-get' is a command to install, update and remove software which"
+message="$message\n is stored in a non local repo. 'apt-get' does nothing then connecting to such"
+message="$message\n repo, downloads the software, unpacks the software, updates a big"
+message="$message\n local database with all filepaths and other informations about the"
+message="$message\n installed software or removes or updates installed Software."
+message="$message\n "
+message="$message\n With LibreELEC it is not possible to change the system for security and"
+message="$message\n stability reasons so even 'apt-get' would not be able to do this."
+message="$message\n We also dont have and want to maintain such a repo for various other"
+message="$message\n great reasons."
+message="$message\n "
+message="$message\n Also Ubuntu or Debian packages are often outdated and not compatible"
+message="$message\n with LibreELEC"
+message="$message\n "
+message="$message\n TIP: use Kodi's addon browser to enhance your LibreELEC system"
+
+echo -e $message
+exit 1
diff --git a/projects/L4T/packages/busybox/scripts/create-edid-cpio b/projects/L4T/packages/busybox/scripts/create-edid-cpio
new file mode 100755
index 00000000000..d98362886e7
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/create-edid-cpio
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
+
+EDID_DIR="/storage/.config/firmware/edid"
+EDID_CPIO="/flash/edid.cpio"
+TMPDIR="/tmp/edid-cpio"
+
+if [ "$1" = "-q" ]; then
+ VERBOSE=0
+else
+ VERBOSE=1
+fi
+
+if [ ! -d "${EDID_DIR}" ]; then
+ echo "error: ${EDID_DIR} does not exist"
+ exit 1
+fi
+
+set -e
+
+rm -rf "${TMPDIR}"
+mkdir -p "${TMPDIR}/usr/lib/firmware"
+cp -r "${EDID_DIR}" "${TMPDIR}/usr/lib/firmware"
+cd "${TMPDIR}"
+mount -o remount,rw /flash
+find usr -print | cpio -ov -H newc > "${EDID_CPIO}"
+sync
+mount -o remount,ro /flash
+cd /storage
+rm -rf "${TMPDIR}"
+
+if [ "${VERBOSE}" = "1" ]; then
+ echo "successfully created ${EDID_CPIO}"
+fi
diff --git a/projects/L4T/packages/busybox/scripts/createlog b/projects/L4T/packages/busybox/scripts/createlog
new file mode 100755
index 00000000000..bff5982a564
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/createlog
@@ -0,0 +1,180 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+# create logfile
+
+DATE=`date -u +%Y-%m-%d-%H.%M.%S`
+BASEDIR="/tmp"
+LOGDIR="log-$DATE"
+RELEASE="`cat /etc/release`"
+GIT="`cat /etc/issue | grep git`"
+
+getlog_cmd() {
+ if command -v $1 >/dev/null; then
+ echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "# ... output of $@" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "# LibreELEC release: $RELEASE" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "# $GIT" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
+ $@ >> $BASEDIR/$LOGDIR/$LOGFILE 2>/dev/null
+ echo "" >> $BASEDIR/$LOGDIR/$LOGFILE
+ fi
+}
+
+get_governor_details() {
+ (
+ cat_all_files /sys/devices/system/cpu
+ cat_all_files /sys/devices/system/cpu/cpufreq
+ for cpun in /sys/devices/system/cpu/cpu[0-9]*; do
+ cat_all_files ${cpun}/cpufreq
+ done
+ )
+}
+
+cat_all_files() {
+ local adir=$1
+ local afile var
+
+ [ -d ${adir} ] || return 0
+
+ echo "${adir}"
+
+ cd ${adir}
+ for afile in $(find . -maxdepth 1 -print | sort); do
+ afile=${afile:2}
+ if [ -n "${afile}" ]; then
+ if [ -d ${afile} ]; then
+ var=""
+ else
+ var="$(cat ${afile} 2>/dev/null)"
+ fi
+ [ -n "${var}" ] && printf " %-30s : %s\n" "${afile}" "${var}"
+ fi
+ done
+}
+
+rm -rf $BASEDIR/$LOGDIR
+mkdir -p $BASEDIR/$LOGDIR
+
+# kodi.log
+ KODI_LOG_DIR=/storage/.kodi/temp
+
+ LOGFILE="01_KODI.log"
+ for i in kodi.log kodi.old.log; do
+ [ -f ${KODI_LOG_DIR}/${i} ] && getlog_cmd cat ${KODI_LOG_DIR}/$i
+ done
+
+ LOGFILE="01_KODI_CRASH.log"
+ for i in `find ${KODI_LOG_DIR} -type f -name "kodi_crashlog_*.log" | sort -r`; do
+ getlog_cmd cat $i
+ done
+
+ LOGFILE="01_KODI_OTHER.log"
+ for i in `find ${KODI_LOG_DIR} -type f -name "*.log" | sort`; do
+ iname="${i#${KODI_LOG_DIR}/}"
+ [ ${iname} == kodi.log ] && continue
+ [ ${iname} == kodi.old.log ] && continue
+ [ "${iname#kodi_crashlog_}" != "${iname}" ] && continue
+ getlog_cmd cat $i
+ done
+
+# System.log
+ LOGFILE="02_System.log"
+ getlog_cmd dmesg
+ getlog_cmd lsmod
+ getlog_cmd ps xa
+ for i in /storage/.config/hwdb.d/*.hwdb \
+ /storage/.config/modprobe.d/*.conf \
+ /storage/.config/modules-load.d/*.conf \
+ /storage/.config/sleep.d/*.power \
+ /storage/.config/sysctl.d/*.conf \
+ /storage/.config/udev.rules.d/*.rules \
+ ; do
+ if [ -f "$i" ] ; then
+ getlog_cmd cat $i
+ fi
+ done
+ if [ -f "/storage/.config/autostart.sh" ] ; then
+ getlog_cmd cat /storage/.config/autostart.sh
+ fi
+ if [ -f "/storage/.config/shutdown.sh" ] ; then
+ getlog_cmd cat /storage/.config/shutdown.sh
+ fi
+ getlog_cmd ls -laR /storage/.config/system.d
+ # note: we dont add .mount units here as they may contan
+ # login credentials
+ for i in /storage/.config/system.d/*.service ; do
+ if [ -f "$i" -a ! -L "$i" ] ; then
+ getlog_cmd cat $i
+ fi
+ done
+
+# Hardware.log
+ LOGFILE="03_Hardware.log"
+ getlog_cmd lspci -vvvvnn
+ getlog_cmd lsusb -vvv
+ getlog_cmd lsusb -t
+ getlog_cmd cat /proc/cpuinfo
+ getlog_cmd get_governor_details
+ getlog_cmd cat /proc/meminfo
+
+# Audio.log
+ LOGFILE="04_Audio.log"
+ getlog_cmd aplay -l
+ getlog_cmd aplay -L
+ getlog_cmd amixer
+
+# Network.log
+ LOGFILE="05_Network.log"
+ getlog_cmd ifconfig -a
+ getlog_cmd netstat -rn
+ getlog_cmd netstat -nalp
+ getlog_cmd connmanctl services
+ getlog_cmd cat /etc/resolv.conf
+
+# varlog.log
+ LOGFILE="06_varlog.log"
+ for i in `find /var/log -type f`; do
+ getlog_cmd cat $i
+ done
+
+# Input.log
+ LOGFILE="07_input.log"
+ getlog_cmd cat /proc/bus/input/devices
+ # make RPi users happy
+ if [ -e /proc/acpi/wakeup ] ; then
+ getlog_cmd cat /proc/acpi/wakeup
+ fi
+
+# Filesystem.log
+ LOGFILE="08_Filesystem.log"
+ getlog_cmd cat /proc/mounts
+ getlog_cmd df -h
+ getlog_cmd blkid
+
+# Journal (current)
+ LOGFILE="09_Journal-cur.log"
+ getlog_cmd journalctl --no-pager -b -0
+
+# Journal (prev)
+ LOGFILE="10_Journal-prev.log"
+ getlog_cmd journalctl --no-pager -b -1
+
+# addons
+ LOGFILE="11_Addons.log"
+ for i in /storage/.kodi/userdata/addon_data/*/*.log \
+ /storage/.kodi/userdata/addon_data/*/log/* \
+ ; do
+ if [ -f "$i" ] ; then
+ getlog_cmd cat $i
+ fi
+ done
+
+# pack logfiles
+ mkdir -p /storage/logfiles
+ zip -jq /storage/logfiles/log-$DATE.zip $BASEDIR/$LOGDIR/*
+
+# remove logdir
+ rm -rf $BASEDIR/$LOGDIR
diff --git a/projects/L4T/packages/busybox/scripts/createlog-lakka b/projects/L4T/packages/busybox/scripts/createlog-lakka
new file mode 100755
index 00000000000..72321cbedcb
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/createlog-lakka
@@ -0,0 +1,195 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+# create logfile
+
+DATE=`date -u +%Y-%m-%d-%H.%M.%S`
+BASEDIR="/tmp"
+LOGDIR="log-$DATE"
+RELEASE="`cat /etc/release`"
+GIT="`cat /etc/issue | grep git`"
+
+getlog_cmd() {
+ if command -v $1 >/dev/null; then
+ echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "# ... output of $@" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "# Lakka release: $RELEASE" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "# $GIT" >> $BASEDIR/$LOGDIR/$LOGFILE
+ echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
+ $@ >> $BASEDIR/$LOGDIR/$LOGFILE 2>&1
+ echo "" >> $BASEDIR/$LOGDIR/$LOGFILE
+ fi
+}
+
+get_governor_details() {
+ (
+ cat_all_files /sys/devices/system/cpu
+ cat_all_files /sys/devices/system/cpu/cpufreq
+ for cpun in /sys/devices/system/cpu/cpu[0-9]*; do
+ cat_all_files ${cpun}/cpufreq
+ done
+ )
+}
+
+cat_all_files() {
+ local adir=$1
+ local afile var
+
+ [ -d ${adir} ] || return 0
+
+ echo "${adir}"
+
+ cd ${adir}
+ for afile in $(find . -maxdepth 1 -print | sort); do
+ afile=${afile:2}
+ if [ -n "${afile}" ]; then
+ if [ -d ${afile} ]; then
+ var=""
+ else
+ var="$(cat ${afile} 2>/dev/null)"
+ fi
+ [ -n "${var}" ] && printf " %-30s : %s\n" "${afile}" "${var}"
+ fi
+ done
+}
+
+rm -rf $BASEDIR/$LOGDIR
+mkdir -p $BASEDIR/$LOGDIR
+
+# RetroArch.log
+ LOGFILE="01_RetroArch.log"
+ echo "The retroarch.service will be stopped and separate RetroArch process will be started to acquire log. Perform actions that lead to the bug/issue. In case the issue does not end with a segmentation fault / RetroArch crashing, exit RetroArch via 'Restart RetroArch'."
+ read -p "Press ENTER to continue..."
+ systemctl stop retroarch.service
+ export LIBGL_DEBUG=verbose
+ getlog_cmd retroarch -v
+
+# System.log
+ LOGFILE="02_System.log"
+ getlog_cmd dmesg
+ getlog_cmd lsmod
+ getlog_cmd ps xa
+ for i in /storage/.config/hwdb.d/*.hwdb \
+ /storage/.config/modprobe.d/*.conf \
+ /storage/.config/modules-load.d/*.conf \
+ /storage/.config/sleep.d/*.power \
+ /storage/.config/sysctl.d/*.conf \
+ /storage/.config/udev.rules.d/.rules \
+ ; do
+ if [ -f "$i" ] ; then
+ getlog_cmd cat $i
+ fi
+ done
+ if [ -f "/storage/.config/autostart.sh" ] ; then
+ getlog_cmd cat /storage/.config/autostart.sh
+ fi
+ if [ -f "/storage/.config/shutdown.sh" ] ; then
+ getlog_cmd cat /storage/.config/shutdown.sh
+ fi
+ getlog_cmd ls -laR /storage/.config/system.d
+ # note: we dont add .mount units here as they may contan
+ # login credentials
+ for i in /storage/.config/system.d/*.service ; do
+ if [ -f "$i" -a ! -L "$i" ] ; then
+ getlog_cmd cat $i
+ fi
+ done
+
+# Hardware.log
+ LOGFILE="03_Hardware.log"
+ getlog_cmd lspci -vvvvnn
+ getlog_cmd lsusb -vvv
+ getlog_cmd lsusb -t
+ getlog_cmd cat /proc/cpuinfo
+ getlog_cmd get_governor_details
+ getlog_cmd cat /proc/meminfo
+
+# Audio.log
+ LOGFILE="04_Audio.log"
+ getlog_cmd aplay -l
+ getlog_cmd aplay -L
+ getlog_cmd amixer
+
+# Network.log
+ LOGFILE="05_Network.log"
+ getlog_cmd ifconfig -a
+ getlog_cmd netstat -rn
+ getlog_cmd netstat -nalp
+ getlog_cmd connmanctl services
+ getlog_cmd cat /etc/resolv.conf
+
+# varlog.log
+ LOGFILE="06_varlog.log"
+ for i in `find /var/log -type f`; do
+ getlog_cmd cat $i
+ done
+
+# Input.log
+ LOGFILE="07_input.log"
+ getlog_cmd cat /proc/bus/input/devices
+ # make RPi users happy
+ if [ -e /proc/acpi/wakeup ] ; then
+ getlog_cmd cat /proc/acpi/wakeup
+ fi
+
+# Filesystem.log
+ LOGFILE="08_Filesystem.log"
+ getlog_cmd cat /proc/mounts
+ getlog_cmd df -h
+ getlog_cmd blkid
+
+# Journal (current)
+ LOGFILE="09_Journal-cur.log"
+ getlog_cmd journalctl --no-pager -b -0
+
+# Journal (prev)
+ LOGFILE="10_Journal-prev.log"
+ getlog_cmd journalctl --no-pager -b -1
+
+# pack logfiles
+ mkdir -p /storage/logfiles
+ zip -jq /storage/logfiles/log-$DATE.zip $BASEDIR/$LOGDIR/*
+
+# remove logdir
+ rm -rf $BASEDIR/$LOGDIR
+
+# upload / move to /flash
+ echo "Archive with logs 'log-$DATE.zip' was created and stored in the samba share 'Logs' (/storage/logfiles)."
+ echo " 1) Leave the archive only in the samba share (requires working access to the Lakka shared folders)"
+ echo " 2) Copy the archive to the FAT32 partition (requires a computer where you can read your SD/USB)"
+ echo " 3) Upload the archive to https://transfer.sh (requires working internet connection on the Lakka device)"
+ echo ""
+ while true ; do
+ read -rsn1 -p "Your choice? (1-3) " choice
+ if [ $choice -eq 1 -o $choice -eq 2 -o $choice -eq 3 ]; then
+ break
+ else
+ echo "Invalid choice: $choice"
+ fi
+ done
+ case $choice in
+ 1)
+ echo "The archive is prepared in the 'Logs' share."
+ break
+ ;;
+ 2)
+ echo "Remounting /flash (FAT32) partition for write access..."
+ mount -o remount,rw /flash
+ echo "Copying archive to /flash partition..."
+ cp /storage/logfiles/log-$DATE.zip /flash
+ echo "Remounting /flash (FAT32) partition for read-only access..."
+ mount -o remount,ro /flash
+ echo "The archive was copied to the root of the FAT32 partition."
+ break
+ ;;
+ 3)
+ echo "Uploading archive to https://transfer.sh:"
+ curl --upload-file /storage/logfiles/log-$DATE.zip https://transfer.sh/log-$DATE.zip
+ echo " <- provide this URL in your bug/issue report."
+ break
+ ;;
+ esac
+ echo ""
+ echo "Finished. You may now start RetroArch (systemctl start retroarch.service) or poweroff / reboot your Lakka device."
diff --git a/projects/L4T/packages/busybox/scripts/dthelper b/projects/L4T/packages/busybox/scripts/dthelper
new file mode 100755
index 00000000000..a60e6b95f49
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/dthelper
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
+
+COMPATIBLE=$(cat /proc/device-tree/compatible 2>/dev/null | tr -d '\000' | sed -n -e 's/.*\(allwinner\|amlogic\|fsl\|nxp\|qcom\|raspberrypi\|rockchip\|samsung\).*/\1/p')
+
+do_dtfile(){
+ if [ -e /flash/extlinux/extlinux.conf ]; then
+ DTFILE=$(grep FDT /flash/extlinux/extlinux.conf | sed 's,^ *FDT /,,g')
+ elif [ -e /flash/boot.ini ]; then
+ DTFILE=$(grep -m 1 dtb_name /flash/boot.ini | cut -d \" -f2 | sed 's,/dtb/,,g')
+ elif [ -e /flash/uEnv.ini ]; then
+ DTFILE=$(grep dtb_name /flash/uEnv.ini | sed 's,dtb_name=/dtb/,,g')
+ else
+ do_unknown
+ fi
+ echo "${DTFILE}"
+}
+
+do_dtflag(){
+ if [ "${COMPATIBLE}" = "raspberrypi" ]; then
+ DTFLAG=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | head -n 1)
+ PIREV=$(awk '/^Revision/ {sub($3,-6, "", $3); print $3}' /proc/cpuinfo) # truncate to 6-chars
+ case "${PIREV}" in
+ d*)
+ MEMSIZE="-8g"
+ ;;
+ c*)
+ MEMSIZE="-4g"
+ ;;
+ b*)
+ MEMSIZE="-2g"
+ ;;
+ a*)
+ MEMSIZE="-1g"
+ ;;
+ *0002|*0003|*0004|*0005|*0006|*0007|*0008|*0009|*0012)
+ MEMSIZE="-256"
+ ;;
+ 0*|9*)
+ MEMSIZE="-512"
+ ;;
+ *)
+ MEMSIZE=""
+ ;;
+ esac
+ else
+ DTFLAG=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | head -n 1)
+ MEMSIZE=$(awk -F " " '/MemTotal:/ {print $2}' /proc/meminfo)
+ if [ "${MEMSIZE}" -lt "524288" ]; then
+ MEMSIZE="-512"
+ else
+ MEMSIZE=""
+ fi
+ fi
+ echo "${DTFLAG}${MEMSIZE}"
+}
+
+do_dtname(){
+ DTNAME=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | head -n 1)
+ echo "${DTNAME}"
+}
+
+do_dtsoc(){
+ DTSOC=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | tail -n 1)
+ echo "${DTSOC}"
+}
+
+do_unknown(){
+ echo "unknown"
+ exit 1
+}
+
+if [ -n "${COMPATIBLE}" ]; then
+ case $(basename "${0}") in
+ dtfile)
+ do_dtfile
+ ;;
+ dtflag)
+ do_dtflag
+ ;;
+ dtname)
+ do_dtname
+ ;;
+ dtsoc)
+ do_dtsoc
+ ;;
+ esac
+else
+ do_unknown
+fi
diff --git a/projects/L4T/packages/busybox/scripts/dump-active-edids-drm b/projects/L4T/packages/busybox/scripts/dump-active-edids-drm
new file mode 100755
index 00000000000..2dd4af57c1c
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/dump-active-edids-drm
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
+
+EDID_DIR="/storage/.config/firmware/edid"
+CONNECTORS=""
+
+if [ "$1" = "-q" ]; then
+ VERBOSE=0
+else
+ VERBOSE=1
+fi
+
+info() {
+ [ "${VERBOSE}" = "1" ] && echo "$@"
+}
+
+mkdir -p "${EDID_DIR}"
+
+for c in /sys/class/drm/card?-* ; do
+ [ ! -d "$c" ] && continue
+ [ ! -e "$c/status" ] && continue
+
+ if [ $(cat $c/status 2>/dev/null) = "connected" ]; then
+ CONNECTOR=$(basename $c | cut -c 7-)
+ EDID_NAME="edid-${CONNECTOR}.bin"
+ cat $c/edid > "${EDID_DIR}/${EDID_NAME}" 2>/dev/null
+ if [ $? -eq 0 ]; then
+ [ -n "${CONNECTORS}" ] && CONNECTORS="${CONNECTORS} "
+ CONNECTORS="${CONNECTORS}${CONNECTOR}"
+ fi
+ fi
+done
+
+if [ -z "${CONNECTORS}" ]; then
+ info "error: no active connectors found"
+ exit 1
+else
+ info "found active connector(s) ${CONNECTORS}"
+ [ "${VERBOSE}" = "0" ] && echo "${CONNECTORS}"
+fi
diff --git a/projects/L4T/packages/busybox/scripts/fs-resize b/projects/L4T/packages/busybox/scripts/fs-resize
new file mode 100755
index 00000000000..6be1d3e6efb
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/fs-resize
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+if [ -e /storage/.please_resize_me ] ; then
+ . /usr/lib/libreelec/functions
+
+ hidecursor
+
+ # this sh** was never intended to be used
+ # on already installed and runing system
+ if [ -d /storage/.kodi -o -d /storage/.config -o -d /storage/.cache ] ; then
+ rm -f /storage/.please_resize_me
+ sync
+ echo "Resizing is not permitted - the system has already been initialised."
+ StartProgress countdown "Rebooting in 15s... " 15 "NOW"
+ reboot -f
+ fi
+
+ # get the disk. /storage on 2nd partition
+ PART=$(grep "/storage " /proc/mounts | cut -d" " -f1 | grep '2$')
+
+ # get disk: /dev/sdx2 -> /dev/sdx, /dev/mmcblkxp2 -> /dev/mmcblkx
+ case $PART in
+ "/dev/mmcblk"*)
+ DISK=$(echo $PART | sed s/p2$//g)
+ ;;
+ *)
+ DISK=$(echo $PART | sed s/2$//g)
+ ;;
+ esac
+
+ rm -f /storage/.please_resize_me
+ sync
+
+ # just in case
+ if [ ! -z "$DISK" -a ! -z "$PART" ] ; then
+ umount $PART
+
+ echo "PARTITION RESIZING IN PROGRESS"
+ echo ""
+ echo "Please do not reboot or turn off your @DISTRONAME@ device!"
+ echo ""
+
+ # identify the partition scheme, and if gpt fix minor issues such as gpt header not at end of disk
+ SCHEME=$(blkid -s PTTYPE -o value $DISK)
+ if [ "$SCHEME" = "gpt" ]; then
+ StartProgress spinner "Checking layout... " "sgdisk -e $DISK &>/dev/null"
+ fi
+
+ StartProgress spinner "Resizing partition... " "parted -s -m $DISK resizepart 2 100% &>/dev/null"
+ StartProgress spinner "Checking file system... " "e2fsck -f -p $PART &>/dev/null"
+ StartProgress spinner "Resizing file system... " "resize2fs $PART &>/dev/null"
+ StartProgress countdown "Rebooting in 15s... " 15 "NOW"
+ fi
+fi
+reboot -f &>/dev/null
diff --git a/projects/L4T/packages/busybox/scripts/functions b/projects/L4T/packages/busybox/scripts/functions
new file mode 100755
index 00000000000..216c6fb99bb
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/functions
@@ -0,0 +1,156 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
+
+# Need a read/write location, as tmp may not always be available
+mkdir -p /dev/.progress
+rm -f /dev/.progress/*
+
+# Show frame-buffer cursor
+showcursor() {
+ echo -en "\033[?25h"
+
+ # show cursor
+ if [ -f /sys/devices/virtual/graphics/fbcon/cursor_blink ] ; then
+ echo 1 > /sys/devices/virtual/graphics/fbcon/cursor_blink
+ fi
+}
+
+# Hide frame-buffer cursor
+hidecursor() {
+ echo -en "\033[?25l"
+
+ if [ -f /sys/devices/virtual/graphics/fbcon/cursor_blink ] ; then
+ echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink
+ fi
+}
+
+# Start a progress meter
+# $1: spinner, percent, countdown
+# $2: message to display
+# [spinner]
+# $3: optional command to execute
+# $4: optional success completion message (nothing if not specified)
+# $5: optional failure completion message ($4 if not specified)
+# [percent]
+# $3: name of filename to be progress monitored
+# $4: terminal size (in bytes) of $3 when progress is complete
+# $5: optional command to execute
+# $6: optional success message (100% if not specified)
+# $7: optional failure message ($6 if not specified)
+# [countdown]
+# $3: number of seconds to start counting down from
+# $4: optional completion message, default is nothing
+StartProgress() {
+ local cmdresult=0
+
+ # Use files for inter-process communication.
+ # This file is used to indicate a metter is running/active
+
+ echo > /dev/.progress/run
+
+ case "$1" in
+ spinner)
+ ProgressTask_Spinner "$2" &
+ if [ -n "$3" ]; then
+ eval "$3"
+ cmdresult=$?
+ [ $cmdresult -eq 0 ] && StopProgress "${4}" || StopProgress "${5:-$4}"
+ fi
+ ;;
+ percent)
+ ProgressTask_Percent "$2" "$3" $4 &
+ if [ -n "$5" ]; then
+ eval "$5"
+ cmdresult=$?
+ [ $cmdresult -eq 0 ] && StopProgress "${6}" || StopProgress "${7:-$6}"
+ fi
+ ;;
+ countdown)
+ ProgressTask_Countdown "$2" $3 "$4"
+ ;;
+ *)
+ echo "Unknown spinner type: $1"
+ return 1
+ ;;
+ esac
+
+ return $cmdresult
+}
+
+# Stop a progress meter, displaying optional completion message
+# $1: optional completion message (appropriate default used if not specified)
+StopProgress() {
+ # Instruct running progress meter to end, showing specified completion message
+ echo "${1}" > /dev/.progress/stop
+
+ # Wait for progress meter to stop running
+ while [ -f /dev/.progress/run ]; do
+ usleep 250000
+ done
+
+ # Clean up
+ rm -f /dev/.progress/stop
+ return 0
+}
+
+# Use this task for processes of indeterminate duration
+ProgressTask_Spinner() {
+ local msg="$1"
+ local spinner="|/-\\|/-\\"
+ local count=0 donemsg
+
+ echo -n "${msg} "
+
+ while [ ! -f /dev/.progress/stop ]; do
+ echo -en "\b${spinner:$count:1}"
+ usleep 500000
+ count=$(((count + 1) % 8))
+ done
+
+ donemsg="$(cat /dev/.progress/stop)"
+ echo -e "\b${donemsg:-done}"
+
+ rm -f /dev/.progress/run
+
+ exit 0
+}
+
+# Use this task when transferring a file of known size
+ProgressTask_Percent() {
+ local msg="$1" filename="$2" fsize=$3 csize donemsg
+
+ echo -n "${msg} "
+
+ while [ ! -f /dev/.progress/stop ]; do
+ [ -f ${filename} ] && csize=$(stat -t "${filename}" | awk '{print $2}') || csize=0
+ echo $csize $fsize | awk '{ printf "\b\b\b\b%3d%%", ($1 * 100 / $2) }'
+ usleep 250000
+ done
+
+ donemsg="$(cat /dev/.progress/stop)"
+ echo -e "\b\b\b\b${donemsg:-100%}"
+
+ rm -f /dev/.progress/run
+
+ exit 0
+}
+
+# Use this task to countdown a number of seconds
+# (needs more work for durations > 99 seconds)
+ProgressTask_Countdown() {
+ local msg="$1" countfrom=$2 donemsg="$3"
+
+ echo -n "${msg} "
+
+ while [ ${countfrom} -gt 0 ]; do
+ echo ${countfrom} | awk '{ printf "\b\b%2d", $1 }'
+ read -r -s -t1 && break
+ countfrom=$((countfrom - 1))
+ done
+
+ echo -e "\b\b${donemsg:- }"
+
+ rm -f /dev/.progress/run
+
+ return 0
+}
diff --git a/projects/L4T/packages/busybox/scripts/getedid b/projects/L4T/packages/busybox/scripts/getedid
new file mode 100755
index 00000000000..4cf91b2435f
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/getedid
@@ -0,0 +1,247 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
+#
+# exit 1 = unsupported GPU
+# exit 2 = dual boot system
+# exit 3 = no backup for syslinux.cfg or extlinux.conf
+# exit 4 = extlinux.conf and syslinux.cfg are available
+# exit 5 = changes are already made either to extlinux.conf or syslinux.cfg
+# exit 6 = xorg.conf already exists in /storage/.config
+# exit 7 = more than a single device detected
+
+# Help message and usage explanation
+help() {
+ echo "This script generates a custom EDID depending on your GPU"
+ echo ""
+ echo "To check which GPU you are using, use: getedid gpu"
+ echo ""
+ echo "To create a custom EDID, just use this script like: getedid create"
+ echo ""
+ echo "If you don't want to use the created EDID file anymore use: getedid delete"
+ echo ""
+ echo "If your hardware or kernel has changed and you want to have a custom EDID again, then you have to delete the old EDID first."
+ echo "For this use: getedid delete "
+ echo "And then use: getedid create"
+}
+
+
+# check for GPU and store string
+check_gpu() {
+ if lspci | grep -i vga | grep -i -q -E 'intel|amd' ; then
+ gpu="intel/amd"
+ elif lspci | grep -i vga | grep -i -q nvidia; then
+ gpu="nvidia"
+ else
+ echo "GPU is not supported"
+ exit 1
+ fi
+}
+
+
+# run this first if the user already has a custom EDID but want to create a new one (TV or AVR change)
+del_edid() {
+ if [ "$gpu" = "intel/amd" ]; then
+ check_file
+ if [ -f "$file".old ]; then
+ mount_rw
+ rm "$file"
+ mv "$file".old "$file"
+ rm -f /flash/edid.cpio
+ mount_ro
+ sys_reboot
+ else
+ echo "You don't have a backup file for $file. You did not use this script to create the custom EDID"
+ echo "Therefore we can't be sure the script is working properly. Exiting"
+ exit 3
+ fi
+ else
+ rm -f /storage/.config/xorg.conf
+ rm -f /storage/.config/xorg.le.backup
+ systemctl restart xorg.service
+ fi
+}
+
+
+# run main script depending on the GPU
+run() {
+ if [ "$gpu" = "intel/amd" ]; then
+ intel_amd
+ elif [ "$gpu" = "nvidia" ]; then
+ nvidia
+ fi
+}
+
+
+# mounting /flash to rw
+mount_rw() {
+ mount -o remount,rw /flash
+}
+
+
+# mounting /flash to ro
+mount_ro() {
+ mount -o remount,ro /flash
+}
+
+
+# remount /flash to ro and reboot
+sys_reboot() {
+ mount_ro
+ echo "The system is rebooting in 15 seconds"
+ sleep 15
+ reboot
+}
+
+
+# check syslinux.cfg and/or extlinux.conf
+check_file() {
+ # check boot system
+ if [ -d /sys/firmware/efi -a -f /flash/EFI/BOOT/syslinux.cfg ] ; then
+ sys_boot="UEFI"
+ sys_path="/flash/EFI/BOOT"
+ else
+ sys_boot="BIOS"
+ sys_path="/flash"
+ fi
+
+ # check which file is available
+ if [ -f "$sys_path/syslinux.cfg" -a -f "$sys_path/extlinux.conf" ]; then
+ echo "Your system contains both a /flash/syslinux.cfg and a /flash/extlinux.conf file"
+ echo "Something is wrong on your system. Exiting"
+ exit 4
+ elif [ -f "$sys_path/extlinux.conf" ]; then
+ file="$sys_path/extlinux.conf"
+ elif [ -f "$sys_path/syslinux.cfg" ]; then
+ file="$sys_path/syslinux.cfg"
+ else
+ echo "You neither have a extlinux.conf nor do you have a syslinux.cfg."
+ echo "Dual boot systems aren't supported"
+ exit 2
+ fi
+}
+
+
+check_content() {
+ # check if changes are already made to $file and exit if yes
+ if grep -q "initrd=/edid.cpio" $file ; then
+ echo "$file has been modified. Please run 'getedid delete' first if you want to modify it again. Exiting."
+ exit 5
+ fi
+}
+
+
+create_edid() {
+ # create edid
+ mkdir -p /tmp/cpio/lib/firmware/edid
+ cat "/sys/class/drm/$card/edid" > /tmp/cpio/lib/firmware/edid/edid.bin
+ mkdir -p /storage/.config/firmware/edid
+ cp /tmp/cpio/lib/firmware/edid/edid.bin /storage/.config/firmware/edid
+
+
+ # create cpio archive
+ cd /tmp/cpio/
+ find . -print | cpio -ov -H newc > /storage/edid.cpio
+}
+
+
+intel_amd() {
+ # check which output is connnected:
+ counter=0
+ for i in /sys/class/drm/*; do
+ if [ "$(cat "$i"/status 2>/dev/null)" = "connected" ]; then
+ counter=$((counter + 1))
+ if [ $counter -gt 0 -a $counter -lt 2 ]; then
+ card="$(echo "$i" | cut -d / -f 5)"
+ hdmi="$(echo "$i" | cut -d / -f 5 | sed 's/card[0-9]-//g')"
+ else
+ echo "More than a single device connected. Probably enable \"Disable all other monitors\" at Kodi settings. Aborting!"
+ exit 7
+ fi
+ fi
+ done
+
+ # create the edid
+ create_edid
+
+ # check extlinux.conf and syslinux.cfg
+ check_file
+ check_content
+
+ # remount /flash to rw
+ mount_rw
+ mv /storage/edid.cpio /flash
+
+ # make a backup of $file
+ cp "$file" "$file".old
+
+ # add boot parameters to $file
+ sed -i "/ APPEND/s/$/ initrd=\/edid.cpio drm.edid_firmware=edid\/edid.bin video=$hdmi:D/" "$file"
+
+ # reboot
+ sys_reboot
+}
+
+
+nvidia() {
+ # check if xorg.conf already exists
+ if [ -f /storage/.config/xorg.conf -o -f /storage/.config/xorg-nvidia.conf ]; then
+ echo "Existing /storage/.config/xorg.conf detected. Aborting!"
+ exit 6
+ fi
+
+
+ # check for multi-montior setup
+ monitors="$(grep -i -w "connected" /var/log/Xorg.0.log | grep -i -o "dfp-[0-9]" | sort -u | wc -l)"
+ if [ "$monitors" -gt "1" ]; then
+ echo "You have more than a single monitor connected. The script doesn't support a multi-monitor setup. Aborting!"
+ exit 7
+ fi
+
+
+ # set debug and restart Xorg
+ cp /etc/X11/xorg-nvidia.conf /storage/.config/xorg.conf
+ sed -i 's/"ModeDebug" "false"/"ModeDebug" "true"/g' /storage/.config/xorg.conf
+ systemctl restart xorg.service
+
+
+ # get port
+ nv_port="$(grep -i -w connected /var/log/Xorg.0.log | grep -i -o "dfp-[0-9]" | sort -u)"
+ nvidia-xconfig --extract-edids-from-file=/var/log/Xorg.0.log --extract-edids-output-file=/storage/.config/edid.bin 1>/dev/null
+
+ # set mode debug back to false
+ sed -i 's/"ModeDebug" "true"/"ModeDebug" "false"/g' /storage/.config/xorg.conf
+
+ # set port and uncomment lines
+ sed -i "s/# Option \"ConnectedMonitor\" \"DFP-0\"/ Option \"ConnectedMonitor\" \"$nv_port\"/g" /storage/.config/xorg.conf
+ sed -i "s/# Option \"CustomEDID\" \"DFP-0:\/storage\/.config\/edid.bin\"/ Option \"CustomEDID\" \"$nv_port:\/storage\/.config\/edid.bin\"/g" /storage/.config/xorg.conf
+ sed -i "s/# Option \"IgnoreEDID\" \"false\"/ Option \"IgnoreEDID\" \"false\"/g" /storage/.config/xorg.conf
+ sed -i "s/# Option \"UseEDID\" \"true\"/ Option \"UseEDID\" \"true\"/g" /storage/.config/xorg.conf
+
+ # restart xorg.service
+ systemctl restart xorg.service
+}
+
+
+# start script from here
+case "$1" in
+ 'create')
+ check_gpu
+ run
+ ;;
+ 'gpu')
+ check_gpu
+ echo "$gpu"
+ ;;
+ 'delete')
+ check_gpu
+ del_edid
+ ;;
+ 'help')
+ help
+ ;;
+ *)
+ echo "Usage $0 { create | gpu | delete | help }"
+ ;;
+esac
diff --git a/projects/L4T/packages/busybox/scripts/getedid-drm b/projects/L4T/packages/busybox/scripts/getedid-drm
new file mode 100755
index 00000000000..2b8d7d36275
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/getedid-drm
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
+
+usage() {
+ echo "$0 create|delete|help"
+}
+
+delete_edid() {
+ update-bootloader-edid delete
+ if [ $? -eq 0 ]; then
+ echo "successfully removed edid override"
+ else
+ echo "error removing bootloader edid-override options"
+ exit 1
+ fi
+}
+
+create_edid() {
+ CONNECTORS=$(dump-active-edids -q)
+ if [ $? -ne 0 -o -z "${CONNECTORS}" ]; then
+ echo "error: cannot detemine active connectors"
+ exit 1
+ fi
+ create-edid-cpio -q
+ if [ $? -ne 0 ]; then
+ echo "error creating edid.cpio"
+ exit 1
+ fi
+ update-bootloader-edid set ${CONNECTORS}
+ if [ $? -eq 0 ]; then
+ echo "successfully installed edid override for ${CONNECTORS}"
+ else
+ echo "error setting bootloader edid-override options"
+ exit 1
+ fi
+}
+
+case $1 in
+ create)
+ shift
+ create_edid "$@"
+ ;;
+ delete)
+ delete_edid
+ ;;
+ help)
+ usage
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+esac
diff --git a/projects/L4T/packages/busybox/scripts/init b/projects/L4T/packages/busybox/scripts/init
new file mode 100755
index 00000000000..ecf56972e19
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/init
@@ -0,0 +1,1177 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv)
+# Copyright (C) 2012 Yann Cézard (eesprit@free.fr)
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
+
+# create directories
+/usr/bin/busybox mkdir -p /dev
+/usr/bin/busybox mkdir -p /proc
+/usr/bin/busybox mkdir -p /sys
+/usr/bin/busybox mkdir -p /tmp
+/usr/bin/busybox mkdir -p /flash
+/usr/bin/busybox mkdir -p /sysroot
+/usr/bin/busybox mkdir -p /storage
+/usr/bin/busybox mkdir -p /run
+
+# temp mountpoint for updates
+/usr/bin/busybox mkdir -p /update
+
+# mount all needed special filesystems
+/usr/bin/busybox mount -t devtmpfs devtmpfs /dev
+/usr/bin/busybox mount -t proc proc /proc
+/usr/bin/busybox mount -t sysfs sysfs /sys
+# /run options have to match what systemd uses by default
+/usr/bin/busybox mount -t tmpfs -o mode=777,size=20%,nr_inodes=800k,nosuid,nodev,strictatime tmpfs /run
+
+UPDATE_ROOT=/storage/.update
+UPDATE_DIR="$UPDATE_ROOT"
+
+UPDATE_KERNEL="KERNEL"
+UPDATE_SYSTEM="SYSTEM"
+IMAGE_KERNEL="@KERNEL_NAME@"
+IMAGE_SYSTEM="SYSTEM"
+
+BOOT_STEP="start"
+MD5_FAILED="0"
+RUN_FSCK="yes"
+RUN_FSCK_DISKS=""
+SYSLINUX_DEFAULT=""
+GRUB_DEFAULT=""
+
+NBD_DEVS="0"
+FLASH_FREE_MIN="5"
+
+LIVE="no"
+
+BREAK_TRIPPED="no"
+
+BIGFONT="1080"
+
+# Get a serial number if present (eg. RPi) otherwise use MAC address from eth0
+MACHINE_UID="$(awk '/^Serial/{s='0000000' $3; print substr(s, length(s) - 7)}' /proc/cpuinfo)"
+[ -z "$MACHINE_UID" ] && MACHINE_UID="$(cat /sys/class/net/eth0/address 2>/dev/null | tr -d :)"
+
+# common functions
+. /functions
+
+# script functions
+progress() {
+ if test "$PROGRESS" = "yes"; then
+ echo "### $1 ###" >&2
+ fi
+}
+
+debug_msg() {
+ echo "$1" >&$SILENT_OUT
+}
+
+debug_shell() {
+ echo "### Starting debugging shell for boot step: $BOOT_STEP... type exit to quit ###"
+
+ showcursor
+
+ setsid cttyhack sh
+}
+
+error() {
+ # Display fatal error message
+ # $1:action which caused error, $2:message
+ # Send debug_shell output to stderr, in case caller is redirecting/consuming stdout
+ # Return exitcode=1 so that called may detect when an error has occurred
+ echo "*** Error in $BOOT_STEP: $1: $2 ***" >&2
+ debug_shell >&2
+ return 1
+}
+
+break_after() {
+ # Start debug shell after boot step $1, and all subsequent steps
+ if [ $BREAK_TRIPPED == yes ]; then
+ debug_shell
+ else
+ case $BREAK in
+ all|*$1*)
+ BREAK_TRIPPED=yes
+ debug_shell
+ ;;
+ esac
+ fi
+}
+
+# Mount handlers
+# All handlers take the following parameters:
+# $1:target, $2:mountpoint, $3:mount options, [$4:fs type]
+mount_common() {
+ # Common mount handler, handles block devices and filesystem images
+ MOUNT_OPTIONS="-o $3"
+ [ -n "$4" ] && MOUNT_OPTIONS="-t $4 $MOUNT_OPTIONS"
+
+ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
+ ERR_ENV=1
+
+ mount $MOUNT_OPTIONS $1 $2 >&$SILENT_OUT 2>&1
+ [ "$?" -eq "0" ] && ERR_ENV=0 && break
+
+ usleep 1000000
+ done
+ [ "$ERR_ENV" -eq "0" ] && return 0
+ error "mount_common" "Could not mount $1"
+}
+
+get_iscsistart_options() {
+ # Convert kernel commandline ISCSI= options to iscsistart options
+ IFS_SAVE="$IFS"
+ IFS=,
+
+ for arg in $1; do
+ val="${arg#*=}"
+ case "$arg" in
+ iscsi_initiator=*)
+ option="-i"
+ ;;
+ iscsi_target_name=*)
+ option="-t"
+ ;;
+ iscsi_target_ip=*)
+ option="-a"
+ ;;
+ iscsi_target_port=*)
+ option="-p"
+ ;;
+ iscsi_target_group=*)
+ option="-g"
+ ;;
+ iscsi_username=*)
+ option="-u"
+ ;;
+ iscsi_password=*)
+ option="-w"
+ ;;
+ iscsi_in_username=*)
+ option="-U"
+ ;;
+ iscsi_in_password=*)
+ option="-W"
+ ;;
+ esac
+ echo "$option $val"
+ done
+
+ IFS="$IFS_SAVE"
+}
+
+mount_iscsi() {
+ # Mount iSCSI target
+ ISCSI_DEV="${1##*,}"
+ ISCSI_OPTIONS="${1%,*}"
+
+ if [ ! -f "/usr/sbin/iscsistart" ]; then
+ error "iscsistart" "iSCSI support not available"
+ fi
+
+ if [ "$ISCSI_OPTIONS" = "auto" ]; then
+ progress "Network configuration based on iBFT"
+ /usr/sbin/iscsistart -N >&$SILENT_OUT 2>&1 || error "iscsistart" "Unable to configure network"
+ progress "iSCSI auto connect based on iBFT"
+ /usr/sbin/iscsistart -b >&$SILENT_OUT 2>&1 || error "iscsistart" "Unable to auto connect"
+ else
+ /usr/sbin/iscsistart $(get_iscsistart_options "$ISCSI_OPTIONS") >&$SILENT_OUT 2>&1 || error "iscsistart" "Unable to connect to ISCSI target"
+ fi
+
+ mount_common "$ISCSI_DEV" "$2" "$3" "$4"
+}
+
+mount_nbd() {
+# Mount NBD device
+ NBD_SERVER="${1%%:*}"
+ NBD_PORT="${1#*:}"
+ NBD_DEV="/dev/nbd$NBD_DEVS"
+
+ nbd-client $NBD_SERVER $NBD_PORT $NBD_DEV >&$SILENT_OUT 2>&1 || error "nbd-client" "Could not connect to NBD server $1"
+
+ mount_common "$NBD_DEV" "$2" "$3" "$4"
+
+ NBD_DEVS=$(( NBD_DEVS + 1 ))
+}
+
+mount_nfs() {
+ # Mount NFS export
+ NFS_EXPORT="${1%%,*}"
+ NFS_OPTIONS="${1#*,}"
+
+ [ "$NFS_OPTIONS" = "$1" ] && NFS_OPTIONS=
+
+ mount_common "$NFS_EXPORT" "$2" "$3,nolock,rsize=32768,wsize=32768,$NFS_OPTIONS" "nfs"
+}
+
+mount_ubifs() {
+ mount_common "$1" "$2" "$3" "ubifs"
+}
+
+mount_part() {
+ # Mount a local or network filesystem
+ # $1:[TYPE=]target, $2:mountpoint, $3:mount options, [$4:fs type]
+ progress "mount filesystem $1 ..."
+
+ MOUNT_TARGET="${1#*=}"
+ case $1 in
+ /dev/ubi*)
+ MOUNT_CMD="mount_ubifs"
+ MOUNT_TARGET="$1"
+ RUN_FSCK="no"
+ ;;
+ LABEL=*|UUID=*|/*)
+ MOUNT_CMD="mount_common"
+ MOUNT_TARGET="$1"
+ ;;
+ ISCSI=*)
+ MOUNT_CMD="mount_iscsi"
+ ;;
+ NBD=*)
+ MOUNT_CMD="mount_nbd"
+ ;;
+ NFS=*)
+ MOUNT_CMD="mount_nfs"
+ ;;
+ *)
+ error "mount_part" "Unknown filesystem $1"
+ ;;
+ esac
+
+ # Substitute unique identifier if available or remove placeholder
+ MOUNT_TARGET="${MOUNT_TARGET//@UID@/$MACHINE_UID}"
+
+ $MOUNT_CMD "$MOUNT_TARGET" "$2" "$3" "$4"
+}
+
+mount_sysroot() {
+ if [ "$SYSTEM_TORAM" = "yes" ]; then
+ cp /flash/$IMAGE_SYSTEM /dev/$IMAGE_SYSTEM
+ mount_part "/dev/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
+ else
+ mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
+ fi
+
+ if [ -f /flash/post-sysroot.sh ]; then
+ . /flash/post-sysroot.sh
+ fi
+}
+
+# mount the specified SYSTEM file and output arch from /etc/os-release
+get_project_arch() {
+ if [ -f ${1}/etc/os-release ]; then
+ . ${1}/etc/os-release
+ echo "${OPENELEC_ARCH:-${LIBREELEC_ARCH}}"
+ fi
+}
+
+# If the project/arch of current matches the update, then it is considered compatible.
+# Otherwise, mount the update SYSTEM partition and, if canupdate.sh is available,
+# call the script to determine if the current update file can be applied on to the
+# current system - 0 means it is compatible, non-zero that it is not compatible.
+is_compatible() {
+ local result=1
+
+ if [ "${1}" = "${2}" ]; then
+ result=0
+ else
+ if [ -f /update/usr/share/bootloader/canupdate.sh ]; then
+ sh /update/usr/share/bootloader/canupdate.sh "${1}" "${2}" && result=0
+ fi
+ fi
+
+ return ${result}
+}
+
+# determine if the new SYSTEM file is compatible with the current SYSTEM file
+check_is_compatible() {
+ local update_filename="${1}"
+ local old_project_arch new_project_arch
+
+ old_project_arch="$(get_project_arch "/sysroot")" || return
+ new_project_arch="$(get_project_arch "/update")" || return
+
+ # If old or new project/arch isn't available then could be very old (pre-/etc/os-release) build - have to trust it
+ if [ -n "${old_project_arch}" -a -n "${new_project_arch}" ]; then
+ # If the old project/arch is not compatible with the new project/arch then abort...
+ if ! is_compatible "${old_project_arch}" "${new_project_arch}"; then
+ echo ""
+ echo "ERROR: $(basename "${update_filename}") is not compatible with ${old_project_arch} hardware - update cancelled."
+ echo ""
+ echo "Current system: ${old_project_arch}"
+ echo "Update system: ${new_project_arch}"
+ echo ""
+ echo "Create $UPDATE_ROOT/.nocompat to disable compatibility checks and risk a non-booting system."
+ echo ""
+ return 1
+ fi
+ fi
+
+ return 0
+}
+
+update_file() {
+ if [ -f "$UPDATE_DIR/$2" -a -f "$3" ]; then
+ if [ ! "$FAT32_BOOT" = "yes" ]; then
+ mount -o remount,rw /flash
+ fi
+ rm -f "$3"
+ StartProgress percent "Updating $1... " "$3" $(stat -t "$UPDATE_DIR/$2" | awk '{print $2}')
+ # use dd here with conv=fsync so that all writes are non-buffered
+ # ensuring accurate progress - take the sync hit during the
+ # transfer, rather than when flushing file buffers after the progress
+ # meter declares the transfer already complete
+ dd if=$UPDATE_DIR/$2 of=$3 bs=1M conv=fsync 2>/dev/null
+ StopProgress
+
+ # loopback file needs writable /flash all the time
+ if [ ! "$FAT32_BOOT" = "yes" ]; then
+ if [ "${disk%%=*}" != "FILE" ]; then
+ mount -o remount,ro /flash
+ fi
+ fi
+ sync
+ fi
+}
+
+update_partition() {
+ local result
+
+ if [ -f "$UPDATE_DIR/$2" -a -b "$3" ]; then
+ StartProgress spinner "Updating $1... "
+ result="$(dd if="$UPDATE_DIR/$2" of="$3" 2>&1)"
+ StopProgress "done"
+ echo "${result}"
+ fi
+}
+
+update_bootloader() {
+ local result
+
+ export BOOT_ROOT="/flash"
+ export SYSTEM_ROOT="/update"
+
+ if [ -f $SYSTEM_ROOT/usr/share/bootloader/update.sh ]; then
+ StartProgress spinner "Updating Boot Files... "
+ result="$(sh $SYSTEM_ROOT/usr/share/bootloader/update.sh 2>&1)"
+ sync
+ StopProgress "done"
+ [ -n "${result}" ] && echo "${result}"
+ fi
+}
+
+set_consolefont() {
+ local vres
+
+ progress "Set console font"
+ if [ -e /dev/fb0 ]; then
+ vres="$(fbset 2>/dev/null | awk '/geometry/ { print $3 }')"
+ if [ $vres -gt "$BIGFONT" ]; then
+ setfont -C /dev/tty0 ter-v32b.psf
+ fi
+ fi
+}
+
+load_splash() {
+ local set_default_res=no
+ local vres
+
+ if [ ! "$SPLASH" = "no" ]; then
+ progress "Loading bootsplash"
+
+ if [ -e /dev/fb0 ]; then
+ # Set framebuffer to a custom resolution and/or fallback to default resolution (1024x768-32), if required.
+ if [ ! "$SWITCH_FRAMEBUFFER" = "no" ]; then
+ if [ "$SWITCH_FRAMEBUFFER" = "1080" ]; then
+ SWITCH_FRAMEBUFFER="1920 1080 1920 1080 32"
+ elif [ "$SWITCH_FRAMEBUFFER" = "720" ]; then
+ SWITCH_FRAMEBUFFER="1280 720 1280 720 32"
+ fi
+
+ # Try setting a custom framebuffer resolution
+ if [ ! "${SWITCH_FRAMEBUFFER:-yes}" = "yes" ]; then
+ fbset -g $SWITCH_FRAMEBUFFER 2>/dev/null && set_default_res=no
+ fi
+
+ # Set a default resolution if required
+ if [ "$set_default_res" = "yes" ]; then
+ fbset -g 1024 768 1024 768 32
+ fi
+ fi
+
+ # load splash
+ if [ -f /splash/splash.conf ]; then
+ . /splash/splash.conf
+ fi
+
+ # Select splash image based on current native resolution
+ if [ -z "$SPLASHIMAGE" ]; then
+ vres="$(fbset 2>/dev/null | awk '/geometry/ { print $3 }')"
+
+ for s in /flash/oemsplash-${vres}.png \
+ /flash/oemsplash-1080.png \
+ /flash/oemsplash.png \
+ /splash/splash-${vres}.png \
+ /splash/splash-1080.png \
+ ; do
+ if [ -f "${s}" ]; then
+ SPLASHIMAGE="${s}"
+ break
+ fi
+ done
+ fi
+
+ if [ -n "$SPLASHIMAGE" -a -f "$SPLASHIMAGE" ]; then
+ ply-image $SPLASHIMAGE > /dev/null 2>&1
+ fi
+
+ debug_msg "Framebuffer vertical res: $vres"
+ debug_msg "Framebuffer splash image: $SPLASHIMAGE"
+ fi
+ fi
+}
+
+do_reboot() {
+ echo "System reboots now..."
+
+ # syncing filesystem
+ sync
+
+ # unmount filesystems
+ if /usr/bin/busybox mountpoint -q /flash ; then
+ /usr/bin/busybox umount /flash
+ fi
+
+ if /usr/bin/busybox mountpoint -q /storage ; then
+ /usr/bin/busybox umount /storage
+ fi
+
+ usleep 2000000
+ /usr/bin/busybox reboot
+}
+
+force_fsck() {
+ echo "Filesystem corruption has been detected!"
+ echo "To prevent an automatic repair attempt continuing,"
+ echo "press any key or power off your system within the next 120 seconds"
+ echo ""
+ read -t120 -n1
+ # The exit status is 0 if input is available
+ # The exit status is greater than 128 if the timeout is exceeded
+ if [ $? -ne 0 -o $? -gt 128 ]; then
+ echo "Repairing filesystem..."
+ echo ""
+ /usr/sbin/fsck -T -M -y $RUN_FSCK_DISKS
+ FSCK_RET=$?
+ if [ $(( $FSCK_RET & 8 )) -eq 8 ]; then
+ # fubar
+ echo "Forced fsck failed. Your system is broken beyond repair"
+ echo "Please re-install @DISTRONAME@"
+ echo ""
+ echo "Press enter to shutdown now"
+ echo ""
+ read fubar
+ poweroff
+ fi
+ do_reboot
+ else
+ echo "Shutting down..."
+ sleep 5
+ sync
+ poweroff
+ fi
+}
+
+check_disks() {
+ if [ "$RUN_FSCK" = "yes" -a -n "$RUN_FSCK_DISKS" ]; then
+ progress "Checking disk(s): $RUN_FSCK_DISKS"
+ echo "Checking disk(s): $RUN_FSCK_DISKS" >/dev/kmsg
+ for i in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0; do
+ /usr/sbin/fsck -T -M -p -a $RUN_FSCK_DISKS >/dev/fsck.latest 2>&1
+ FSCK_RET=$?
+ cat /dev/fsck.latest >>/dev/fsck.log
+
+ # FSCK_RET is the bit-wise OR of the exit codes for each filesystem that is checked.
+ if [ $FSCK_RET -ge 16 ]; then
+ progress "General error, continuing..."
+ break
+ elif [ $(( $FSCK_RET & 8 )) -eq 8 ]; then
+ # device not found
+ if [ $i -eq 0 ]; then
+ progress "Device not found, continuing..."
+ else
+ usleep 500000
+ fi
+ elif [ $(( $FSCK_RET & 4 )) -eq 4 ]; then
+ # errors left
+ force_fsck
+ elif [ $(( $FSCK_RET & 2 )) -eq 2 ]; then
+ # reboot needed
+ echo "Filesystem repaired, reboot needed..."
+ do_reboot
+ elif [ $(( $FSCK_RET & 1 )) -eq 1 ]; then
+ # filesystem errors corrected
+ progress "Filesystem errors corrected , continuing..."
+ break
+ elif [ $FSCK_RET -eq 0 ]; then
+ # no errors found
+ progress "No filesystem errors found, continuing..."
+ break
+ fi
+ done
+ while read line; do
+ [ -n "$line" ] && echo "fsck: ${line::160}" >/dev/kmsg
+ done /dev/null; then
+ ether-wake "$wol_mac"
+ StartProgress countdown "WOL magic packet sent to $wol_ip, waiting $wol_wait seconds... " $wol_wait "done"
+ fi
+ fi
+}
+
+mount_flash() {
+ progress "Mounting flash"
+
+ wakeonlan
+
+ if [ ! "$FAT32_BOOT" = "yes" ]; then
+ mount_part "$boot" "/flash" "ro,noatime"
+ else
+ mount_part "$boot" "/flash" "rw,noatime,umask=0000"
+ fi
+
+ if [ -f /flash/post-flash.sh ]; then
+ . /flash/post-flash.sh
+ fi
+}
+
+cleanup_flash() {
+ progress "Cleaning up flash (if required)"
+
+ if [ -f /flash/pieeprom.bin -o -f /flash/pieeprom.upd -o -f /flash/vl805.bin ]; then
+ mount -o remount,rw /flash
+
+ rm -f /flash/pieeprom.bin /flash/pieeprom.upd /flash/pieeprom.sig
+ rm -f /flash/vl805.bin /flash/vl805.sig
+ rm -f /flash/recovery.bin /flash/recovery.[0-9][0-9][0-9] /flash/RECOVERY.[0-9][0-9][0-9]
+
+ mount -o remount,ro /flash
+ fi
+}
+
+mount_storage() {
+ progress "Mounting storage"
+
+ if [ "$LIVE" = "yes" ]; then
+ # mount tmpfs and exit early. disk=xx is not allowed in live mode
+ mount -t tmpfs none /storage
+ return
+ fi
+
+ wakeonlan
+
+ if [ "$FAT32_BOOT" = "yes" ]; then
+ DISTRO=${IMAGE_SYSTEM%'/'*}
+ mkdir -p /flash/$DISTRO/storage
+ mount --bind /flash/$DISTRO/storage /storage
+ elif [ -n "$disk" ]; then
+ if [ -n "$OVERLAY" ]; then
+ OVERLAY_DIR=$(cat /sys/class/net/eth0/address | tr -d :)
+
+ mount_part "$disk" "/storage" "rw,noatime"
+ mkdir -p /storage/$OVERLAY_DIR
+ umount /storage
+
+ # split $disk into $target,$options so we can append $OVERLAY_DIR
+ options="${disk#*,}"
+ target="${disk%%,*}"
+ if [ "$options" = "$disk" ]; then
+ disk="$target/$OVERLAY_DIR"
+ else
+ disk="$target/$OVERLAY_DIR,$options"
+ fi
+ fi
+
+ if [ -f /flash/mount-storage.sh ]; then
+ . /flash/mount-storage.sh
+ else
+ mount_part "$disk" "/storage" "rw,noatime"
+ fi
+ else
+ # /storage should always be writable
+ mount -t tmpfs none /storage
+ fi
+}
+
+# Make last bootloader label (installer, live, run etc.) as the new default
+update_bootmenu() {
+ local crnt_default
+
+ if [ -n "$SYSLINUX_DEFAULT" -a -f /flash/syslinux.cfg ]; then
+ if grep -q "^LABEL $SYSLINUX_DEFAULT\$" /flash/syslinux.cfg; then
+ crnt_default="$(awk '/^DEFAULT/ {print $2}' /flash/syslinux.cfg)"
+ if [ ! "$crnt_default" = "$SYSLINUX_DEFAULT" ]; then
+ progress "Updating /flash/syslinux.cfg [$crnt_default -> $SYSLINUX_DEFAULT]"
+
+ mount -o remount,rw /flash
+ sed -e "s/^SAY Wait for .* mode/SAY Wait for ${SYSLINUX_DEFAULT} mode/" -i /flash/syslinux.cfg
+ sed -e "s/^DEFAULT .*/DEFAULT $SYSLINUX_DEFAULT/" -i /flash/syslinux.cfg
+ rm -f /flash/EFI/BOOT/syslinux.cfg
+ mount -o remount,ro /flash
+ fi
+ fi
+ fi
+
+ if [ -n "$GRUB_DEFAULT" -a -f /flash/EFI/BOOT/grub.cfg ]; then
+ if grep -q "^menuentry \"$GRUB_DEFAULT\"" /flash/EFI/BOOT/grub.cfg; then
+ crnt_default="$(awk '/^set default/ {print substr($2,9,19)}' /flash/EFI/BOOT/grub.cfg)"
+ if [ ! "$crnt_default" = "\"$GRUB_DEFAULT\"" ]; then
+ progress "Updating /flash/EFI/BOOT/grub.cfg [$crnt_default -> \"$GRUB_DEFAULT\"]"
+
+ mount -o remount,rw /flash
+ sed -e "s/^set default=.*/set default=\"$GRUB_DEFAULT\"/" -i /flash/EFI/BOOT/grub.cfg
+ rm -f /flash/grub.cfg
+ mount -o remount,ro /flash
+ fi
+ fi
+ fi
+}
+
+check_out_of_space() {
+ if [ "$(df /storage | awk '/[0-9]%/{print $4}')" -eq "0" ]; then
+ echo ""
+ echo "The $1 is corrupt, or there is not enough"
+ echo "free space on /storage to complete the update!"
+ echo ""
+ echo "Please free up space on your /storage partition"
+ echo "by deleting unecessary files, then try again."
+ echo ""
+ return 0
+ else
+ echo ""
+ echo "The $1 is corrupt/invalid!"
+ echo ""
+ return 1
+ fi
+}
+
+do_cleanup() {
+ StartProgress spinner "Cleaning up... "
+
+ if mountpoint -q /update; then
+ umount /update
+ fi
+
+ if [ -d $UPDATE_ROOT/.tmp/mnt ]; then
+ if mountpoint -q $UPDATE_ROOT/.tmp/mnt ; then
+ # busybox umount deletes loop device automatically
+ umount $UPDATE_ROOT/.tmp/mnt
+ fi
+
+ [ -n $LOOP ] && losetup -d $LOOP &>/dev/null
+ fi
+
+ [ -f "$UPDATE_TAR" ] && rm -f "$UPDATE_TAR" &>/dev/null
+ [ -f "$UPDATE_IMG_GZ" ] && rm -f "$UPDATE_IMG_GZ" &>/dev/null
+ [ -f "$UPDATE_IMG" ] && rm -f "$UPDATE_IMG" &>/dev/null
+
+ rm -rf $UPDATE_ROOT/.tmp &>/dev/null
+ rm -rf $UPDATE_ROOT/[0-9a-zA-Z]* &>/dev/null
+ rm -f $UPDATE_ROOT/.nocheck $UPDATE_ROOT/.nocompat &>/dev/null
+
+ sync
+
+ StopProgress "done"
+}
+
+check_update() {
+ progress "Checking for updates"
+ UPDATE_TAR=$(ls -1 "$UPDATE_DIR"/*.tar 2>/dev/null | head -n 1)
+ UPDATE_IMG_GZ=$(ls -1 "$UPDATE_DIR"/*.img.gz 2>/dev/null | head -n 1)
+ UPDATE_IMG=$(ls -1 "$UPDATE_DIR"/*.img 2>/dev/null | head -n 1)
+
+ if ! [ -f "$UPDATE_DIR/$UPDATE_KERNEL" -a -f "$UPDATE_DIR/$UPDATE_SYSTEM" ] &&
+ ! [ -f "$UPDATE_TAR" -o -f "$UPDATE_IMG_GZ" -o -f "$UPDATE_IMG" ]; then
+ return 0
+ fi
+
+ if [ "$UPDATE_DISABLED" = "yes" ]; then
+ echo "Updating is not supported on netboot"
+ do_cleanup
+ StartProgress countdown "Normal startup in 10s... " 10 "NOW"
+ return 0
+ fi
+
+ if [ -d $UPDATE_DIR/.tmp ]; then
+ echo "Failed update detected - performing recovery."
+ echo ""
+ do_cleanup
+ StartProgress countdown "Normal startup in 10s... " 10 "NOW"
+ return 0
+ fi
+
+ mkdir -p $UPDATE_DIR/.tmp &>/dev/null
+ sync
+
+ echo "UPDATE IN PROGRESS"
+ echo ""
+ echo "Please do not reboot or turn off your @DISTRONAME@ device!"
+ echo ""
+
+ if [ -f "$UPDATE_TAR" ]; then
+ TARRESULT="0"
+
+ echo "Found new .tar archive"
+ UPDATE_FILENAME="$UPDATE_TAR"
+ StartProgress spinner "Extracting contents of archive... "
+ tar -xf "$UPDATE_TAR" -C $UPDATE_DIR/.tmp 1>/dev/null 2>/tmp/tarresult.txt || TARRESULT="1"
+
+ if [ "${TARRESULT}" -eq "0" ]; then
+ if [ "$FAT32_BOOT" = "yes" ]; then
+ mv $UPDATE_DIR/.tmp/* $UPDATE_DIR &>/dev/null
+ UPDATE_DIR=${UPDATE_TAR%.*}
+ else
+ mv $UPDATE_DIR/.tmp/*/target/* $UPDATE_DIR &>/dev/null
+ fi
+ sync
+ StopProgress "done"
+ else
+ StopProgress "FAILED"
+
+ echo "Failed to extract contents of archive file!"
+ echo "tar result: '$(cat /tmp/tarresult.txt)'"
+
+ check_out_of_space "archive"
+
+ do_cleanup
+ StartProgress countdown "Normal startup in 30s... " 30 "NOW"
+ return 0
+ fi
+ elif [ -f "$UPDATE_IMG_GZ" -o -f "$UPDATE_IMG" ]; then
+ mkdir -p $UPDATE_DIR/.tmp/mnt &>/dev/null
+ IMG_FILE="$UPDATE_DIR/.tmp/update.img"
+ GZRESULT="0"
+
+ if [ -f "$UPDATE_IMG_GZ" ]; then
+ echo "Found new compressed image file"
+ UPDATE_FILENAME="$UPDATE_IMG_GZ"
+ StartProgress spinner "Decompressing image file... "
+ gunzip -d -c "$UPDATE_IMG_GZ" 1>$IMG_FILE 2>/tmp/gzresult.txt || GZRESULT="1"
+ sync
+ [ "${GZRESULT}" -eq "0" ] && StopProgress "OK" || StopProgress "FAILED"
+
+ if [ "${GZRESULT}" -eq "1" ]; then
+ echo "Failed to decompress image file!"
+ echo "gunzip result: '$(cat /tmp/gzresult.txt)'"
+
+ check_out_of_space "compressed image"
+
+ do_cleanup
+ StartProgress countdown "Normal startup in 30s... " 30 "NOW"
+ return 0
+ fi
+ else
+ echo "Found new image file"
+ UPDATE_FILENAME="$UPDATE_IMG"
+ mv "$UPDATE_IMG" $IMG_FILE
+ fi
+
+ LOOP=$(losetup -f)
+ LOOP_NUM=$(echo $LOOP | sed 's|/dev/loop||')
+ mknod $LOOP b 7 $LOOP_NUM &>/dev/null
+ losetup $LOOP $IMG_FILE
+
+ # check for MBR partititon
+ OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^[ ]*Device/{part=1; next}; part{if ($2 == "*") {print $5} else {print $4} ; exit}')
+ if [ -z "$OFFSET" ]; then
+ # check for GPT partititon
+ OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^Number/{part=1; next}; part{print $2; exit}')
+ if [ -z "$OFFSET" ]; then
+ echo "Could not find a valid system partition in image file!"
+ do_cleanup
+ StartProgress countdown "Normal startup in 10s... " 10 "NOW"
+ return 0
+ fi
+ fi
+
+ SECTOR_SIZE=$(cat /sys/devices/virtual/block/loop${LOOP_NUM}/queue/hw_sector_size)
+ losetup -d $LOOP
+ sync
+
+ OFFSET=$(($OFFSET * $SECTOR_SIZE))
+
+ # use losetup because busybox mount does not support the -o offset option
+ echo "Mounting system partition..."
+ losetup -o $OFFSET $LOOP $IMG_FILE
+ mount -o ro,loop $LOOP $UPDATE_DIR/.tmp/mnt
+
+ # don't make temporary files but instead copy
+ # directly from mountpoint to /flash
+ UPDATE_DIR=$UPDATE_ROOT/.tmp/mnt
+ UPDATE_KERNEL="@KERNEL_NAME@"
+ else
+ UPDATE_FILENAME="$UPDATE_DIR/$UPDATE_SYSTEM"
+ fi
+
+ sync
+ if [ ! "$FAT32_BOOT" = "yes" ]; then
+ if [ ! -b "/$IMAGE_KERNEL" -a ! -f "/flash/$IMAGE_KERNEL" ] || [ ! -f "/flash/$IMAGE_SYSTEM" ]; then
+ echo "Missing (target) ${IMAGE_KERNEL} or ${IMAGE_SYSTEM}!"
+ do_cleanup
+ StartProgress countdown "Normal startup in 30s... " 30 "NOW"
+ return 0
+ fi
+ else
+ if [ ! -f "/flash/$IMAGE_KERNEL" ] || [ ! -f "/flash/$IMAGE_SYSTEM" ]; then
+ echo "Missing (target) ${IMAGE_KERNEL} or ${IMAGE_SYSTEM}!"
+ do_cleanup
+ StartProgress countdown "Normal startup in 30s... " 30 "NOW"
+ return 0
+ fi
+ fi
+
+ if [ "$FAT32_BOOT" = "yes" ]; then
+ UPDATE_KERNEL=$IMAGE_KERNEL
+ UPDATE_SYSTEM=$IMAGE_SYSTEM
+ fi
+
+ if [ ! -f "$UPDATE_DIR/$UPDATE_KERNEL" -o ! -f "$UPDATE_DIR/$UPDATE_SYSTEM" ]; then
+ echo "Missing (source) ${UPDATE_KERNEL} or ${UPDATE_SYSTEM}!"
+ do_cleanup
+ StartProgress countdown "Normal startup in 30s... " 30 "NOW"
+ return 0
+ fi
+
+ # check md5 sums if .nocheck doesn't exist
+ if [ ! -f "$UPDATE_ROOT/.nocheck" -a ! "$FAT32_BOOT" = "yes" ]; then
+ if [ -f "$UPDATE_DIR/${UPDATE_KERNEL}.md5" -a -f "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" ]; then
+ # *.md5 size-check
+ if [ ! -s "$UPDATE_DIR/${UPDATE_KERNEL}.md5" -o ! -s "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" ]; then
+ echo "Zero-sized .md5 file!"
+ MD5_FAILED="1"
+ else
+ sed "s#target/KERNEL#$UPDATE_DIR/$UPDATE_KERNEL#g" "$UPDATE_DIR/${UPDATE_KERNEL}.md5" >"$UPDATE_ROOT/${UPDATE_KERNEL}.check.md5"
+ sed "s#target#$UPDATE_DIR#g" "$UPDATE_DIR/${UPDATE_SYSTEM}.md5" >"$UPDATE_ROOT/${UPDATE_SYSTEM}.check.md5"
+
+ StartProgress spinner "Checking ${UPDATE_KERNEL}.md5... "
+ if md5sum -sc "$UPDATE_ROOT/${UPDATE_KERNEL}.check.md5"; then
+ StopProgress "OK"
+ else
+ StopProgress "FAILED"
+ MD5_FAILED="1"
+ fi
+
+ StartProgress spinner "Checking ${UPDATE_SYSTEM}.md5... "
+ if md5sum -sc "$UPDATE_ROOT/${UPDATE_SYSTEM}.check.md5"; then
+ StopProgress "OK"
+ else
+ StopProgress "FAILED"
+ MD5_FAILED="1"
+ fi
+ fi
+ else
+ echo "Missing ${UPDATE_KERNEL}.md5 or ${UPDATE_SYSTEM}.md5!"
+ MD5_FAILED="1"
+ fi
+
+ if [ "$MD5_FAILED" -eq "1" ]; then
+ echo "md5 check failed!"
+ do_cleanup
+ StartProgress countdown "Normal startup in 30s... " 30 "NOW"
+ return 0
+ fi
+ fi
+
+ mount_part "$UPDATE_DIR/$UPDATE_SYSTEM" "/update" "ro,loop"
+
+ # Verify that the new update is compatible with the current system - this should avoid creating
+ # non-booting systems after (for example) an RPi tar is incorrectly applied to an RPi2 system.
+ if [ ! -f "$UPDATE_ROOT/.nocompat" ]; then
+ if ! check_is_compatible "$UPDATE_FILENAME"; then
+ do_cleanup
+ StartProgress countdown "Normal startup in 60s... " 60 "NOW"
+ return 0
+ fi
+ fi
+
+ # get sizes
+ FLASH_FREE=$(df /flash/ | awk '/[0-9]%/{print $4}')
+ FLASH_FREE=$(( $FLASH_FREE * 1024 ))
+
+ # Disregard kernel size if it's a a block device
+ if [ ! -b "/$IMAGE_KERNEL" ]; then
+ OLD_KERNEL=$(stat -t "/flash/$IMAGE_KERNEL" | awk '{print $2}')
+ else
+ OLD_KERNEL="0"
+ fi
+
+ OLD_SYSTEM=$(stat -t "/flash/$IMAGE_SYSTEM" | awk '{print $2}')
+ NEW_KERNEL=$(stat -t "$UPDATE_DIR/$UPDATE_KERNEL" | awk '{print $2}')
+ NEW_SYSTEM=$(stat -t "$UPDATE_DIR/$UPDATE_SYSTEM" | awk '{print $2}')
+
+ # old KERNEL+SYSTEM+free space - new KERNEL+SYSTEM must be higher than 5MB
+ # at least 5MB free after update
+
+ TMP_SIZE=$((OLD_KERNEL + OLD_SYSTEM + FLASH_FREE - NEW_KERNEL - NEW_SYSTEM))
+ FLASH_FREE_MIN=$((FLASH_FREE_MIN * 1024 * 1024))
+
+ if [ $TMP_SIZE -ge $FLASH_FREE_MIN ]; then
+ echo "Checking size: OK"
+ else
+ echo "Checking size: FAILED"
+ echo ""
+ echo "Your System (FAT) partition is too small for this update,"
+ echo "and there is not enough space for the update to be installed!"
+ echo ""
+ echo "You must re-install your system using the disk image of a"
+ echo "current release, or you must re-size your existing partitions"
+ echo "so that the System (FAT) partition is at least 512MB in size."
+ echo ""
+ do_cleanup
+ StartProgress countdown "Normal startup in 60s... " 60 "NOW"
+ return 0
+ fi
+
+ # all ok, update
+ if [ -b "/$IMAGE_KERNEL" ]; then
+ update_partition "Kernel" "$UPDATE_KERNEL" "/$IMAGE_KERNEL"
+ else
+ update_file "Kernel" "$UPDATE_KERNEL" "/flash/$IMAGE_KERNEL"
+ fi
+ umount /sysroot
+ update_file "System" "$UPDATE_SYSTEM" "/flash/$IMAGE_SYSTEM"
+ update_bootloader
+ do_cleanup
+ do_reboot
+}
+
+prepare_sysroot() {
+ progress "Preparing system"
+
+ mount --move /flash /sysroot/flash
+ mount --move /storage /sysroot/storage
+
+ if [ ! "$FAT32_BOOT" = "yes" ]; then
+ if [ ! -d "/sysroot/usr/lib/kernel-overlays/base/lib/modules/$(uname -r)/" -a -f "/sysroot/usr/lib/systemd/systemd" ]; then
+ echo ""
+ echo "NEVER TOUCH boot= in syslinux.conf / cmdline.txt!"
+ echo "If you don't know what you are doing,"
+ echo "your installation is now broken."
+ echo ""
+ StartProgress countdown "Normal startup in 60s... " 60 "NOW"
+ fi
+ fi
+
+ [ -f "/sysroot/usr/lib/systemd/systemd" ] || error "final_check" "Could not find systemd!"
+}
+
+# Do init tasks to bring up system
+
+# hide kernel log messages on console
+echo '1 4 1 7' > /proc/sys/kernel/printk
+
+# run platform_init script if exists
+if [ -f "./platform_init" ]; then
+ ./platform_init
+fi
+
+# clear screen and hide cursor
+clear
+hidecursor
+
+# parse command line arguments
+for arg in $(cat /proc/cmdline); do
+ case $arg in
+ BOOT_IMAGE=*)
+ IMAGE_KERNEL="${arg#*=}"
+ [ "${IMAGE_KERNEL:0:1}" = "/" ] && IMAGE_KERNEL="${IMAGE_KERNEL:1}"
+ ;;
+ SYSTEM_IMAGE=*)
+ IMAGE_SYSTEM="${arg#*=}"
+ [ "${IMAGE_SYSTEM:0:1}" = "/" ] && IMAGE_SYSTEM="${IMAGE_SYSTEM:1}"
+ ;;
+ boot=*)
+ boot="${arg#*=}"
+ case $boot in
+ ISCSI=*|NBD=*|NFS=*)
+ UPDATE_DISABLED=yes
+ FLASH_NETBOOT=yes
+ ;;
+ /dev/*|LABEL=*|UUID=*)
+ RUN_FSCK_DISKS="$RUN_FSCK_DISKS $boot"
+ ;;
+ esac
+ ;;
+ disk=*)
+ disk="${arg#*=}"
+ case $disk in
+ ISCSI=*|NBD=*|NFS=*)
+ STORAGE_NETBOOT=yes
+ ;;
+ /dev/*|LABEL=*|UUID=*)
+ RUN_FSCK_DISKS="$RUN_FSCK_DISKS $disk"
+ ;;
+ esac
+ ;;
+ wol_mac=*)
+ wol_mac="${arg#*=}"
+ ;;
+ wol_wait=*)
+ wol_wait="${arg#*=}"
+ ;;
+ installer)
+ SYSLINUX_DEFAULT="installer"
+ ;;
+ debugging)
+ DEBUG=yes
+ ;;
+ progress)
+ PROGRESS=yes
+ INIT_ARGS="$INIT_ARGS --show-status=1"
+ ;;
+ nofsck)
+ RUN_FSCK=no
+ ;;
+ nosplash)
+ SPLASH=no
+ ;;
+ toram)
+ SYSTEM_TORAM=yes
+ ;;
+ live)
+ LIVE=yes
+ SYSLINUX_DEFAULT="live"
+ ;;
+ portable)
+ SYSLINUX_DEFAULT="run"
+ ;;
+ grub_live)
+ LIVE=yes
+ GRUB_DEFAULT="Live"
+ ;;
+ grub_portable)
+ GRUB_DEFAULT="Run"
+ ;;
+ overlay)
+ OVERLAY=yes
+ ;;
+ setfbres=*)
+ SWITCH_FRAMEBUFFER="${arg#*=}"
+ SWITCH_FRAMEBUFFER="${SWITCH_FRAMEBUFFER//,/ }"
+ ;;
+ break=*)
+ BREAK="${arg#*=}"
+ ;;
+ bigfont=*)
+ BIGFONT="${arg#*=}"
+ ;;
+ ip=*)
+ KERNEL_IPCONFIG="yes"
+ ;;
+ fat32-boot)
+ FAT32_BOOT="yes"
+ ;;
+ esac
+done
+
+if test "$DEBUG" = "yes"; then
+ exec 3>&1
+else
+ exec 3>/dev/null
+fi
+SILENT_OUT=3
+
+# If the network is up (due to the use of the "ip" kernel parameter) and a DNS
+# server is known, allow the libc resolver to use it
+grep '^\(nameserver\|domain\) ' /proc/net/pnp | grep -v '^nameserver 0\.0\.0\.0$' > /etc/resolv.conf
+
+if [ "${boot%%=*}" = "FILE" ]; then
+ error "check arguments" "boot argument can't be FILE type..."
+fi
+
+debug_msg "Unique identifier for this client: ${MACHINE_UID:-NOT AVAILABLE}"
+
+# main boot sequence
+for BOOT_STEP in \
+ set_consolefont \
+ check_disks \
+ mount_flash \
+ cleanup_flash \
+ update_bootmenu \
+ load_splash \
+ mount_sysroot \
+ mount_storage \
+ check_update \
+ prepare_sysroot; do
+ $BOOT_STEP
+ [ -n "$DEBUG" ] && break_after $BOOT_STEP
+done
+
+BOOT_STEP=final
+
+# log if booting from usb / removable storage
+STORAGE=$(cat /proc/mounts | grep " /sysroot/storage " | awk '{print $1}' | awk -F '/' '{print $3}')
+FLASH=$(cat /proc/mounts | grep " /sysroot/flash " | awk '{print $1}' | awk -F '/' '{print $3}')
+for i in $STORAGE $FLASH ; do
+ if [ -n "$i" ]; then
+ removable="/sys/class/block/*/$i/../removable"
+ if [ -e $removable ]; then
+ if [ "$(cat $removable 2>/dev/null)" = "1" ]; then
+ echo "### BIG FAT WARNING" > /dev/kmsg
+ echo "### $i is removable. suspend/resume may not work" > /dev/kmsg
+ fi
+ fi
+ fi
+done
+# move some special filesystems
+/usr/bin/busybox mount --move /dev /sysroot/dev
+/usr/bin/busybox mount --move /proc /sysroot/proc
+/usr/bin/busybox mount --move /sys /sysroot/sys
+/usr/bin/busybox mount --move /run /sysroot/run
+/usr/bin/busybox rm -fr /tmp
+
+# setup kernel overlays
+/usr/bin/busybox chroot /sysroot /usr/sbin/kernel-overlays-setup
+
+# tell OE settings addon to disable updates
+if [ "$UPDATE_DISABLED" = "yes" ]; then
+ echo "" > /sysroot/dev/.update_disabled
+fi
+
+if [ "$FLASH_NETBOOT" = "yes" ]; then
+ echo "" > /sysroot/dev/.flash_netboot
+fi
+
+if [ "$KERNEL_IPCONFIG" = "yes" ]; then
+ echo "" > /sysroot/dev/.kernel_ipconfig
+fi
+
+# swap can not be used over nfs.(see scripts/mount-swap)
+if [ "$STORAGE_NETBOOT" = "yes" ]; then
+ echo "" > /sysroot/dev/.storage_netboot
+fi
+
+# switch to new sysroot and start real init
+exec /usr/bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS
+
+error "switch_root" "Error in initramfs. Could not switch to new root"
diff --git a/projects/L4T/packages/busybox/scripts/kernel-overlays-setup b/projects/L4T/packages/busybox/scripts/kernel-overlays-setup
new file mode 100755
index 00000000000..3da3fea42b1
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/kernel-overlays-setup
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
+
+SYSTEM_OVERLAYS_DIR=/usr/lib/kernel-overlays
+OVERLAY_CONFIG_DIR=/storage/.cache/kernel-overlays
+KVER=$(uname -r)
+RUNTIME_DIR="/run/kernel-overlays"
+MODULES_DIR="${RUNTIME_DIR}/modules/${KVER}"
+FIRMWARE_DIR="${RUNTIME_DIR}/firmware"
+USER_FIRMWARE_DIR="/storage/.config/firmware"
+
+mkdir -p "${MODULES_DIR}"
+mkdir -p "${FIRMWARE_DIR}"
+
+log() {
+ echo "kernel-overlays-setup: $@" > /dev/kmsg
+}
+
+apply_overlay() {
+ case "$1" in
+ /*)
+ modules_overlay_dir="${1}/lib/modules/${KVER}"
+ firmware_overlay_dir="${1}/lib/firmware"
+ ;;
+ *)
+ modules_overlay_dir="${SYSTEM_OVERLAYS_DIR}/${1}/lib/modules/${KVER}"
+ firmware_overlay_dir="${SYSTEM_OVERLAYS_DIR}/${1}/lib/firmware"
+ ;;
+ esac
+
+ if [ -d "${modules_overlay_dir}" ] ; then
+ GOT_MODULE_OVERLAY="yes"
+
+ if cp -rfs "${modules_overlay_dir}"/* "${MODULES_DIR}" ; then
+ log "added modules from $modules_overlay_dir"
+ else
+ log "failed to add modules from $modules_overlay_dir"
+ fi
+ fi
+
+ if [ -d "${firmware_overlay_dir}" ] ; then
+ if cp -rfs "${firmware_overlay_dir}"/* "${FIRMWARE_DIR}" ; then
+ log "added firmware from $firmware_overlay_dir"
+ else
+ log "failed to add firmware from $firmware_overlay_dir"
+ fi
+ fi
+}
+
+# setup system base modules
+
+log "setup base modules"
+apply_overlay base
+
+# apply user-configured module overlays
+
+if [ -d "${OVERLAY_CONFIG_DIR}" ] ; then
+ log "adding overlays from ${OVERLAY_CONFIG_DIR}"
+ GOT_MODULE_OVERLAY="no"
+
+ for conf in "${OVERLAY_CONFIG_DIR}/"*.conf ; do
+ if [ -e "$conf" ] ; then
+ log "processing conf $conf"
+ overlay=$(cat "$conf")
+ [ -n "$overlay" ] && apply_overlay "$overlay"
+ fi
+ done
+
+ if [ "yes" = "$GOT_MODULE_OVERLAY" ] ; then
+ log "running depmod"
+ /usr/sbin/depmod -a >/dev/kmsg 2>&1
+ fi
+fi
+
+if [ -d "${USER_FIRMWARE_DIR}" ] && [ -n "$(ls ${USER_FIRMWARE_DIR})" ] ; then
+ if cp -rfs "${USER_FIRMWARE_DIR}"/* "${FIRMWARE_DIR}" ; then
+ log "added firmware from ${USER_FIRMWARE_DIR}"
+ else
+ log "failed to add firmware from ${USER_FIRMWARE_DIR}"
+ fi
+fi
+
+log "done"
diff --git a/projects/L4T/packages/busybox/scripts/ledfix b/projects/L4T/packages/busybox/scripts/ledfix
new file mode 100755
index 00000000000..d997bf01d76
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/ledfix
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv)
+
+# find heartbeat triggers and set them to none
+case $(dtsoc) in
+ amlogic*)
+ for triggerfile in $(find /sys/devices/platform/leds -name trigger); do
+ trigger=$(awk -F'[][]' '{print $2}' "$triggerfile")
+ if [ "$trigger" = "heartbeat" ]; then
+ echo "none" > "$triggerfile"
+ fi
+ done
+ ;;
+esac
diff --git a/projects/L4T/packages/busybox/scripts/libreelec-target-generator b/projects/L4T/packages/busybox/scripts/libreelec-target-generator
new file mode 100755
index 00000000000..edb902c5fbc
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/libreelec-target-generator
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2020-present Matthias Reichl
+# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv)
+
+EARLY_DIR="$2"
+
+log() {
+ echo "libreelec-target-generator: $@" > /dev/kmsg
+}
+
+if [ -z "$EARLY_DIR" ]; then
+ log "error: generator directory missing"
+ exit 1
+fi
+
+TARGET=""
+
+for arg in $(cat /proc/cmdline); do
+ case "$arg" in
+ textmode)
+ TARGET="textmode.target"
+ ;;
+ installer)
+ TARGET="installer.target"
+ ;;
+ esac
+done
+
+BACKUP_EXTENSION_LIST=".tar .tar.gz .tar.bz2 .tar.xz"
+for extension in $BACKUP_EXTENSION_LIST; do
+ BACKUP_FILE=$(ls -1 /storage/.restore/*${EXTENSION} 2>/dev/null | head -n 1)
+ [ -n "${BACKUP_FILE}" ] && break
+done
+
+if [ -f /storage/.please_resize_me ]; then
+ TARGET="fs-resize.target"
+elif [ -f /storage/.cache/reset_hard -o -f /storage/.cache/reset_soft ]; then
+ TARGET="factory-reset.target"
+elif [ -f "$BACKUP_FILE" ]; then
+ TARGET="backup-restore.target"
+elif [ -f /storage/.rpi_flash_firmware ]; then
+ TARGET="rpi-flash-firmware.target"
+fi
+
+if [ -n "$TARGET" ]; then
+ ln -sT "/usr/lib/systemd/system/$TARGET" "$EARLY_DIR/default.target" 2>/dev/kmsg || log "error creating symlink to $TARGET: $?"
+fi
diff --git a/projects/L4T/packages/busybox/scripts/lsb_release b/projects/L4T/packages/busybox/scripts/lsb_release
new file mode 100755
index 00000000000..54e880e9f90
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/lsb_release
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+# show release information
+. /etc/os-release
+echo "$PRETTY_NAME"
diff --git a/projects/L4T/packages/busybox/scripts/pastebinit b/projects/L4T/packages/busybox/scripts/pastebinit
new file mode 100755
index 00000000000..76dec734fd4
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/pastebinit
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
+
+if [ -n "${PASTEUSR}" -a "${PASTEPWD}" ]; then
+ cat "$@" | curl -F 'f:1=<-' ${PASTEUSR}:${PASTEPWD}@ix.io
+else
+ cat "$@" | curl -F 'f:1=<-' http://ix.io
+fi
diff --git a/projects/L4T/packages/busybox/scripts/rpi-flash-firmware b/projects/L4T/packages/busybox/scripts/rpi-flash-firmware
new file mode 100755
index 00000000000..d519209f80a
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/rpi-flash-firmware
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
+
+FLAG_FILE="/storage/.rpi_flash_firmware"
+
+. /usr/lib/libreelec/functions
+
+hidecursor
+
+if [ -f "${FLAG_FILE}" ]; then
+ . ${FLAG_FILE}
+ rm -f "${FLAG_FILE}"
+
+ if ! mount -o remount,rw /flash 2>/dev/null; then
+ echo "ERROR: Unable to mount /flash as a read/write file system."
+ echo
+ echo "Aborting Flash update process - please proceed with a manual update."
+ echo
+
+ StartProgress countdown "Rebooting in 15s... " 15 "NOW"
+ reboot -f &>/dev/null
+ fi
+
+ # Install new bootloader and/or USB3 firmware files to /flash
+ # Firmware flashing will occur during the next boot, after
+ # which the system will again reboot.
+ # Old firmware files will be automatically removed by init.
+ CMD_ARGS=""
+ [ "${BOOTLOADER}" = "yes" ] && CMD_ARGS="${CMD_ARGS} -A bootloader"
+ [ "${VL805}" = "yes" ] && CMD_ARGS="${CMD_ARGS} -A vl805"
+
+ if [ -n "${CMD_ARGS}" ]; then
+ USE_FLASHROM=0 /usr/bin/.rpi-eeprom-update.real ${CMD_ARGS}
+ fi
+
+ sync
+ mount -o remount,ro /flash
+fi
+
+reboot -f &>/dev/null
diff --git a/projects/L4T/packages/busybox/scripts/sudo b/projects/L4T/packages/busybox/scripts/sudo
new file mode 100755
index 00000000000..6dc03ee0403
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/sudo
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+message="$message\n There is no working 'sudo'."
+message="$message\n "
+message="$message\n On debian/ubuntu/all general purpose linux distributions 'sudo'"
+message="$message\n allows a permitted user to execute a command as the superuser"
+message="$message\n or another user, as specified by the security policy"
+message="$message\n "
+message="$message\n With LibreELEC you have root access by default, so you dont need 'sudo'"
+message="$message\n "
+
+echo -e $message
+
+exit 1
diff --git a/projects/L4T/packages/busybox/scripts/update-bootloader-edid-rpi b/projects/L4T/packages/busybox/scripts/update-bootloader-edid-rpi
new file mode 100755
index 00000000000..1516f3e9d1c
--- /dev/null
+++ b/projects/L4T/packages/busybox/scripts/update-bootloader-edid-rpi
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
+
+EDID_DIR="/storage/.config/firmware/edid"
+EDID_CPIO="/flash/edid.cpio"
+CONFIG_TXT="/flash/config.txt"
+CMDLINE_TXT="/flash/cmdline.txt"
+
+usage() {
+ echo "$0 set CONNECTOR... | delete | help"
+}
+
+check_args() {
+ if [ $# -eq 0 ]; then
+ echo "error: no connector(s) specified!"
+ exit 1
+ fi
+ if [ ! -f "${EDID_CPIO}" ]; then
+ echo "error: ${EDID_CPIO} not present"
+ exit 1
+ fi
+ for conn in "$@"; do
+ if [ ! -f "${EDID_DIR}/edid-${conn}.bin" ]; then
+ echo "error: ${EDID_DIR}/edid-${conn}.bin not present"
+ exit 1
+ fi
+ done
+}
+
+cleanup_config_txt() {
+ sed -i "/^initramfs edid\.cpio/d" ${CONFIG_TXT}
+}
+
+get_cleaned_cmdline_txt() {
+ sed \
+ -e 's| drm\.edid_firmware=[^ ]*||g' \
+ -e 's| video=[^ ]*||g' \
+ ${CMDLINE_TXT}
+}
+
+add_initramfs() {
+ # make sure config.txt ends with a newline
+ if [ "$(tail -c 1 ${CONFIG_TXT} | tr -c -d '\n' | tr '\n' 'X')" != "X" ]; then
+ echo "" >> ${CONFIG_TXT}
+ fi
+ echo "initramfs edid.cpio" >> ${CONFIG_TXT}
+}
+
+add_cmdline() {
+ CMDLINE=$(get_cleaned_cmdline_txt)
+ FIRMWARE=""
+ VIDEO=""
+ for conn in "$@"; do
+ VIDEO="${VIDEO} video=${conn}:D"
+ [ -n "${FIRMWARE}" ] && FIRMWARE="${FIRMWARE},"
+ FIRMWARE="${FIRMWARE}${conn}:edid/edid-${conn}.bin"
+ done
+ echo "${CMDLINE} drm.edid_firmware=${FIRMWARE}${VIDEO}" > ${CMDLINE_TXT}
+}
+
+set_edids() {
+ check_args "$@"
+ mount -o remount,rw /flash
+ cleanup_config_txt
+ add_initramfs
+ add_cmdline "$@"
+ mount -o remount,ro /flash
+}
+
+delete_edids() {
+ mount -o remount,rw /flash
+ cleanup_config_txt
+ CMDLINE=$(get_cleaned_cmdline_txt)
+ echo "${CMDLINE}" > ${CMDLINE_TXT}
+ mount -o remount,ro /flash
+}
+
+case $1 in
+ set)
+ shift
+ set_edids "$@"
+ ;;
+ delete)
+ delete_edids
+ ;;
+ help)
+ usage
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+esac
diff --git a/projects/L4T/packages/busybox/sleep.d.serial/99-suspend-modules.sh b/projects/L4T/packages/busybox/sleep.d.serial/99-suspend-modules.sh
new file mode 100755
index 00000000000..37545ee60ae
--- /dev/null
+++ b/projects/L4T/packages/busybox/sleep.d.serial/99-suspend-modules.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+if [ -f /storage/.config/suspend-modules.conf ]; then
+ . /storage/.config/suspend-modules.conf
+ custom_modules="${SUSPEND_MODULES}"
+ SUSPEND_MODULES=""
+fi
+
+. /etc/suspend-modules.conf
+
+if [ -n "${custom_modules}" ]; then
+ SUSPEND_MODULES="${SUSPEND_MODULES} ${custom_modules}"
+fi
+
+modunload()
+{
+ local MOD D C USED MODS I
+ local UNL="$(echo $1 |tr - _)" RET=1
+
+ while read MOD D C USED D; do
+ [ "$MOD" = "$UNL" ] || continue
+ if [ "$USED" = "-" ]; then
+ # no dependent modules, just try to remove this one.
+ _rmmod "$MOD" $C
+ RET=$?
+ else
+ # modules depend on this one. try to remove them first.
+ MODS=",${USED%,}"
+ while [ -n "${MODS}" ]; do
+ # try to unload the last one first
+ MOD="${MODS##*,}"
+ modunload $MOD && RET=0
+ # prune the last one from the list
+ MODS="${MODS%,*}"
+ done
+ # if we unloaded at least one module, then let's
+ # try again!
+ [ $RET -eq 0 ] && modunload $MOD
+ RET=$?
+ fi
+ return $RET
+ done < /proc/modules
+ # if we came this far, there was nothing to do,
+ # the module is no longer loaded.
+ return 0
+}
+
+_rmmod()
+{
+ if modprobe -r "$1"; then
+ touch "/run/libreelec/suspend/module:$1"
+ return 0
+ else
+ logger -t suspend-modules "# could not unload '$1', usage count was $2"
+ return 1
+ fi
+}
+
+resume_modules()
+{
+ for x in /run/libreelec/suspend/module:* ; do
+ [ -O "${x}" ] || continue
+ modprobe "${x##*:}" &>/dev/null && \
+ logger -t resume-modules "Reloaded module ${x##*:}." || \
+ logger -t resume-modules "Could not reload module ${x##*:}."
+ done
+}
+
+suspend_modules()
+{
+ [ -z "$SUSPEND_MODULES" ] && return 0
+ # clean up
+ rm -rf /run/libreelec/suspend
+ mkdir -p /run/libreelec/suspend
+ for x in $SUSPEND_MODULES ; do
+ modunload $x && \
+ logger -t suspend-modules "Unloading kernel module $x: Done" || \
+ logger -t suspend-modules "Unloading kernel module $x: Failed"
+ done
+ return 0
+}
+
+case $1 in
+ pre)
+ suspend_modules
+ ;;
+ post)
+ resume_modules
+ ;;
+esac
diff --git a/projects/L4T/packages/busybox/sysctl.d/99-coredump.conf b/projects/L4T/packages/busybox/sysctl.d/99-coredump.conf
new file mode 100644
index 00000000000..aa33f5f593a
--- /dev/null
+++ b/projects/L4T/packages/busybox/sysctl.d/99-coredump.conf
@@ -0,0 +1 @@
+kernel.core_pattern=/storage/.cache/cores/core.%E.%t.%p
diff --git a/projects/L4T/packages/busybox/sysctl.d/cdrom.conf b/projects/L4T/packages/busybox/sysctl.d/cdrom.conf
new file mode 100644
index 00000000000..a9c22348a58
--- /dev/null
+++ b/projects/L4T/packages/busybox/sysctl.d/cdrom.conf
@@ -0,0 +1,2 @@
+dev.cdrom.lock=0
+dev.cdrom.autoclose=0
diff --git a/projects/L4T/packages/busybox/sysctl.d/memory.conf b/projects/L4T/packages/busybox/sysctl.d/memory.conf
new file mode 100644
index 00000000000..b2ccb5ba4a9
--- /dev/null
+++ b/projects/L4T/packages/busybox/sysctl.d/memory.conf
@@ -0,0 +1 @@
+vm.min_free_kbytes=16384
diff --git a/projects/L4T/packages/busybox/system.d.opt/cron-defaults.service b/projects/L4T/packages/busybox/system.d.opt/cron-defaults.service
new file mode 100644
index 00000000000..fdd14e95bd1
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d.opt/cron-defaults.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Cron defaults
+After=local-fs.target
+
+ConditionPathExists=!/storage/.cache/services/crond.conf
+ConditionPathExists=!/storage/.cache/services/crond.disabled
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c 'cp /usr/share/services/crond.conf /storage/.cache/services/'
+RemainAfterExit=yes
diff --git a/projects/L4T/packages/busybox/system.d.opt/cron.service b/projects/L4T/packages/busybox/system.d.opt/cron.service
new file mode 100644
index 00000000000..0cf6a1e8c6d
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d.opt/cron.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Cron daemon
+After=cron-defaults.service
+Requires=cron-defaults.service
+
+ConditionPathExists=/storage/.cache/services/crond.conf
+
+[Service]
+ExecStartPre=/bin/mkdir -p /storage/.cache/cron/crontabs
+ExecStart=/sbin/crond -f -S
+KillMode=process
+TimeoutStopSec=1s
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/projects/L4T/packages/busybox/system.d/fs-resize.service b/projects/L4T/packages/busybox/system.d/fs-resize.service
new file mode 100644
index 00000000000..b3a85d6460f
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/fs-resize.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=FS Resize
+DefaultDependencies=no
+
+[Service]
+Type=idle
+ExecStart=/usr/lib/libreelec/fs-resize
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
diff --git a/projects/L4T/packages/busybox/system.d/fs-resize.target b/projects/L4T/packages/busybox/system.d/fs-resize.target
new file mode 100644
index 00000000000..838c57c2937
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/fs-resize.target
@@ -0,0 +1,5 @@
+[Unit]
+Description=FS Resize target
+Requires=fs-resize.service
+After=fs-resize.service
+AllowIsolate=yes
diff --git a/projects/L4T/packages/busybox/system.d/ledfix.service b/projects/L4T/packages/busybox/system.d/ledfix.service
new file mode 100644
index 00000000000..5fbafbc56cf
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/ledfix.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=LEDfix Service
+After=network-online.target graphical.target
+Requires=graphical.target
+Wants=kodi.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh /usr/bin/ledfix
+RemainAfterExit=yes
+StartLimitInterval=0
+
+[Install]
+WantedBy=kodi.target
diff --git a/projects/L4T/packages/busybox/system.d/rpi-flash-firmware.service b/projects/L4T/packages/busybox/system.d/rpi-flash-firmware.service
new file mode 100644
index 00000000000..f2921242faa
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/rpi-flash-firmware.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=RPi Flash Firmware
+Requires=tmp.mount var.mount sys-kernel-config.mount
+After=tmp.mount var.mount sys-kernel-config.mount
+DefaultDependencies=no
+
+[Service]
+Type=idle
+ExecStart=/usr/lib/libreelec/rpi-flash-firmware
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
diff --git a/projects/L4T/packages/busybox/system.d/rpi-flash-firmware.target b/projects/L4T/packages/busybox/system.d/rpi-flash-firmware.target
new file mode 100644
index 00000000000..98480bca45a
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/rpi-flash-firmware.target
@@ -0,0 +1,5 @@
+[Unit]
+Description=RPi Flash Firmware target
+Requires=rpi-flash-firmware.service
+After=rpi-flash-firmware.service
+AllowIsolate=yes
diff --git a/projects/L4T/packages/busybox/system.d/shell.service b/projects/L4T/packages/busybox/system.d/shell.service
new file mode 100644
index 00000000000..7b2a0da78b7
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/shell.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Textmode Shell
+After=multi-user.target
+
+[Service]
+Environment=TTY=1
+WorkingDirectory=/storage
+ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"'
+ExecStart=/bin/sh -c 'clear; lsb_release; . /etc/profile; exec /bin/sh'
+
+Restart=always
+RestartSec=0
+StandardInput=tty
+TTYPath=/dev/tty1
+TTYReset=yes
+TTYVHangup=yes
+KillMode=process
+IgnoreSIGPIPE=no
+# bash ignores SIGTERM
+KillSignal=SIGHUP
+
+[Install]
+WantedBy=textmode.target
diff --git a/projects/L4T/packages/busybox/system.d/show-version.service b/projects/L4T/packages/busybox/system.d/show-version.service
new file mode 100644
index 00000000000..cc29cbad965
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/show-version.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Show Version
+DefaultDependencies=false
+ConditionKernelCommandLine=!morequiet
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/lsb_release
+RemainAfterExit=yes
+StandardOutput=tty
+
+[Install]
+WantedBy=basic.target
diff --git a/projects/L4T/packages/busybox/system.d/storage-log.service b/projects/L4T/packages/busybox/system.d/storage-log.service
new file mode 100644
index 00000000000..deb6f6a1c28
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/storage-log.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Create Persistent Log Directory on /storage and rotate large logs
+DefaultDependencies=no
+RequiresMountsFor=/storage
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/mkdir -p /storage/.cache/log/journal /storage/.cache/journald.conf.d ; \
+/usr/bin/find /storage/.cache/log/ -maxdepth 1 -type f -size +512k ! -name '*.old' -exec mv {} {}.old \;
diff --git a/projects/L4T/packages/busybox/system.d/textmode.target b/projects/L4T/packages/busybox/system.d/textmode.target
new file mode 100644
index 00000000000..dad887acab5
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/textmode.target
@@ -0,0 +1,6 @@
+[Unit]
+Description=Textmode
+Requires=multi-user.target
+After=multi-user.target
+Conflicts=rescue.target
+AllowIsolate=yes
diff --git a/projects/L4T/packages/busybox/system.d/var-log.mount b/projects/L4T/packages/busybox/system.d/var-log.mount
new file mode 100644
index 00000000000..26f34cb1d1d
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/var-log.mount
@@ -0,0 +1,14 @@
+[Unit]
+Description=Persistent Log Storage
+RequiresMountsFor=/var /storage
+Requires=storage-log.service
+After=storage-log.service
+ConditionKernelCommandLine=!installer
+ConditionKernelCommandLine=|debugging
+ConditionPathExists=|/storage/.cache/debug.libreelec
+ConditionPathExists=|/storage/.cache/journald.conf.d/00_settings.conf
+
+[Mount]
+What=/storage/.cache/log
+Where=/var/log
+Options=bind
diff --git a/projects/L4T/packages/busybox/system.d/var.mount b/projects/L4T/packages/busybox/system.d/var.mount
new file mode 100644
index 00000000000..1eea76fa0dd
--- /dev/null
+++ b/projects/L4T/packages/busybox/system.d/var.mount
@@ -0,0 +1,21 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Variable Directory
+Documentation=man:hier(7)
+Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
+DefaultDependencies=no
+Before=local-fs.target umount.target
+
+[Mount]
+What=tmpfs
+Where=/var
+Type=tmpfs
+
+[Install]
+WantedBy=local-fs.target
diff --git a/projects/L4T/packages/busybox/tmpfiles.d/z_01_busybox.conf b/projects/L4T/packages/busybox/tmpfiles.d/z_01_busybox.conf
new file mode 100644
index 00000000000..b3d937099a4
--- /dev/null
+++ b/projects/L4T/packages/busybox/tmpfiles.d/z_01_busybox.conf
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
+
+d /var/media 0755 root root - -
+
+d /storage/backup 0755 root root - -
+d /storage/.update 0755 root root - -
+d /storage/.cache/cores 0755 root root - -
+d /storage/.cache/kernel-overlays 0755 root root - -
+d /storage/.cache/services 0755 root root - -
+d /storage/.config 0755 root root - -
diff --git a/projects/L4T/packages/curl/package.mk b/projects/L4T/packages/curl/package.mk
new file mode 100644
index 00000000000..51123c57628
--- /dev/null
+++ b/projects/L4T/packages/curl/package.mk
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
+
+PKG_NAME="curl"
+PKG_VERSION="8.0.1"
+PKG_SHA256="0a381cd82f4d00a9a334438b8ca239afea5bfefcfa9a1025f2bf118e79e0b5f0"
+PKG_LICENSE="MIT"
+PKG_SITE="https://curl.haxx.se"
+PKG_URL="https://curl.haxx.se/download/${PKG_NAME}-${PKG_VERSION}.tar.xz"
+PKG_DEPENDS_TARGET="toolchain zlib openssl rtmpdump libidn2 nghttp2"
+PKG_LONGDESC="Client and library for (HTTP, HTTPS, FTP, ...) transfers."
+PKG_TOOLCHAIN="configure"
+
+PKG_CONFIGURE_OPTS_TARGET="ac_cv_lib_rtmp_RTMP_Init=yes \
+ ac_cv_header_librtmp_rtmp_h=yes \
+ --disable-debug \
+ --enable-optimize \
+ --enable-warnings \
+ --disable-curldebug \
+ --disable-ares \
+ --enable-largefile \
+ --enable-http \
+ --enable-ftp \
+ --enable-file \
+ --disable-ldap \
+ --disable-ldaps \
+ --enable-rtsp \
+ --enable-proxy \
+ --disable-dict \
+ --disable-telnet \
+ --disable-tftp \
+ --disable-pop3 \
+ --disable-imap \
+ --disable-smb \
+ --disable-smtp \
+ --disable-gopher \
+ --disable-mqtt \
+ --disable-manual \
+ --enable-libgcc \
+ --enable-ipv6 \
+ --enable-versioned-symbols \
+ --enable-nonblocking \
+ --enable-threaded-resolver \
+ --enable-verbose \
+ --disable-sspi \
+ --enable-crypto-auth \
+ --enable-cookies \
+ --enable-symbol-hiding \
+ --disable-soname-bump \
+ --with-gnu-ld \
+ --without-krb4 \
+ --without-spnego \
+ --without-gssapi \
+ --with-zlib \
+ --without-brotli \
+ --without-zstd \
+ --without-egd-socket \
+ --enable-thread \
+ --with-random=/dev/urandom \
+ --without-gnutls \
+ --with-ssl \
+ --without-mbedtls \
+ --without-nss \
+ --with-ca-bundle=/run/libreelec/cacert.pem \
+ --without-ca-path \
+ --without-libpsl \
+ --without-libssh2 \
+ --with-librtmp \
+ --with-libidn2 \
+ --with-nghttp2"
+
+post_configure_target() {
+ libtool_remove_rpath libtool
+}
+
+post_makeinstall_target() {
+ rm -rf ${INSTALL}/usr/share/zsh
+
+ rm -rf ${INSTALL}/usr/bin/${PKG_NAME}-config
+ cp ${PKG_NAME}-config ${TOOLCHAIN}/bin
+ sed -e "s:\(['= ]\)/usr:\\1${PKG_ORIG_SYSROOT_PREFIX}/usr:g" -i ${TOOLCHAIN}/bin/${PKG_NAME}-config
+ chmod +x ${TOOLCHAIN}/bin/${PKG_NAME}-config
+}
diff --git a/projects/L4T/packages/flycast/package.mk b/projects/L4T/packages/flycast/package.mk
deleted file mode 100644
index 8c372ca9aa2..00000000000
--- a/projects/L4T/packages/flycast/package.mk
+++ /dev/null
@@ -1,63 +0,0 @@
-PKG_NAME="flycast"
-PKG_VERSION="886188804de48a4bd9324046598e8dedfd0d2099"
-PKG_LICENSE="GPLv2"
-PKG_SITE="https://github.com/libretro/flycast"
-PKG_URL="${PKG_SITE}.git"
-PKG_DEPENDS_TARGET="toolchain"
-PKG_LONGDESC="Flycast is a multiplatform Sega Dreamcast emulator"
-PKG_TOOLCHAIN="make"
-
-PKG_MAKE_OPTS_TARGET="HAVE_OPENMP=0 LDFLAGS=-lrt"
-
-if [ "${OPENGL_SUPPORT}" = "yes" ]; then
- PKG_DEPENDS_TARGET+=" ${OPENGL}"
- PKG_MAKE_OPTS_TARGET+=" HAVE_OIT=1"
-fi
-
-if [ "${OPENGLES_SUPPORT}" = "yes" ]; then
- PKG_DEPENDS_TARGET+=" ${OPENGLES}"
- PKG_MAKE_OPTS_TARGET+=" FORCE_GLES=1"
-fi
-
-if [ "${VULKAN_SUPPORT}" = "yes" ]; then
- PKG_DEPENDS_TARGET+=" ${VULKAN}"
- PKG_MAKE_OPTS_TARGET+=" HAVE_VULKAN=1"
-fi
-
-case ${DEVICE:-${PROJECT}} in
- RPi2)
- PKG_MAKE_OPTS_TARGET+=" platform=rpi2"
- ;;
- RPi3)
- PKG_MAKE_OPTS_TARGET+=" platform=rpi3_64"
- ;;
- RPi4*)
- PKG_MAKE_OPTS_TARGET+=" platform=rpi4_64"
- ;;
- RK3288)
- PKG_MAKE_OPTS_TARGET+=" platform=RK3288"
- ;;
- Switch)
- PKG_MAKE_OPTS_TARGET+=" platform=jetson-nano"
- ;;
- *)
- if [ "${ARCH}" = "aarch64" ]; then
- PKG_MAKE_OPTS_TARGET+=" platform=arm64"
- elif [ "${ARCH}" = "arm" ]; then
- PKG_MAKE_OPTS_TARGET+=" platform=armv-gles-neon"
- fi
- ;;
-esac
-
-pre_make_target() {
- if [ "${ARCH}" = "arm" -o "${ARCH}" = "aarch64" ]; then
- PKG_MAKE_OPTS_TARGET+=" AS=${AS} CC_AS=${CC}"
- else
- PKG_MAKE_OPTS_TARGET+=" AS=${AS} CC_AS=${AS}"
- fi
-}
-
-makeinstall_target() {
- mkdir -p ${INSTALL}/usr/lib/libretro
- cp -v flycast_libretro.so ${INSTALL}/usr/lib/libretro/
-}
diff --git a/projects/L4T/packages/glibc/patches/fix_autoconf.patch b/projects/L4T/packages/glibc/patches/fix_autoconf.patch
deleted file mode 100644
index 3981c38e33e..00000000000
--- a/projects/L4T/packages/glibc/patches/fix_autoconf.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur glibc-2.27/aclocal.m4 glibc-2.27-2/aclocal.m4
---- glibc-2.27/aclocal.m4 2022-04-20 02:23:50.549365949 +0200
-+++ glibc-2.27-2/aclocal.m4 2022-04-20 02:26:23.179843270 +0200
-@@ -2,7 +2,7 @@
- dnl the internal functions defined and used by the main configure script
- dnl match those expected by the fragments. When changing this version,
- dnl install.texi also needs to be updated.
--m4_define([GLIBC_AUTOCONF_VERSION], [2.69])
-+m4_define([GLIBC_AUTOCONF_VERSION], [2.71])
- m4_if(m4_defn([AC_AUTOCONF_VERSION]), GLIBC_AUTOCONF_VERSION, [],
- [m4_fatal(m4_flatten(
- Exactly version GLIBC_AUTOCONF_VERSION of Autoconf is required but you have
diff --git a/projects/L4T/packages/gptfdisk/package.mk b/projects/L4T/packages/gptfdisk/package.mk
new file mode 100644
index 00000000000..09698df29fb
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/package.mk
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
+
+PKG_NAME="gptfdisk"
+PKG_VERSION="1.0.9"
+PKG_SHA256="dafead2693faeb8e8b97832b23407f6ed5b3219bc1784f482dd855774e2d50c2"
+PKG_LICENSE="GPL"
+PKG_SITE="http://www.rodsbooks.com/gdisk/"
+PKG_URL="https://downloads.sourceforge.net/project/${PKG_NAME}/${PKG_NAME}/${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.gz"
+PKG_DEPENDS_TARGET="toolchain popt crossguid"
+PKG_LONGDESC="GPT text-mode partitioning tools"
+
+make_target() {
+ make sgdisk "CC=${CC}" "CXX=${CXX}"
+}
+
+makeinstall_target() {
+ mkdir -p ${INSTALL}/usr/sbin/
+ cp -p sgdisk ${INSTALL}/usr/sbin/
+}
diff --git a/projects/L4T/packages/gptfdisk/patches/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch b/projects/L4T/packages/gptfdisk/patches/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch
new file mode 100644
index 00000000000..684825b8b83
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch
@@ -0,0 +1,57 @@
+From 5d5e76d369a412bfb3d2cebb5fc0a7509cef878d Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Fri, 15 Apr 2022 18:10:14 -0400
+Subject: [PATCH 01/12] Fix failure & crash of sgdisk when compiled with latest
+ popt (commit 740; presumably eventually release 1.19)
+
+---
+ NEWS | 8 ++++++++
+ gptcl.cc | 2 +-
+ support.h | 2 +-
+ 3 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index c7add56..9e153fd 100644
+--- a/NEWS
++++ b/NEWS
+@@ -1,3 +1,11 @@
++1.0.10 (?/??/2022):
++-------------------
++
++- Fixed problem that caused sgdisk to crash with errors about being unable
++ to read the disk's partition table when compiled with the latest popt
++ (commit 740, which is pre-release as I type; presumably version 1.19 and
++ later once released).
++
+ 1.0.9 (4/14/2022):
+ ------------------
+
+diff --git a/gptcl.cc b/gptcl.cc
+index 34c9421..0d578eb 100644
+--- a/gptcl.cc
++++ b/gptcl.cc
+@@ -155,7 +155,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
+ } // while
+
+ // Assume first non-option argument is the device filename....
+- device = (char*) poptGetArg(poptCon);
++ device = strdup((char*) poptGetArg(poptCon));
+ poptResetContext(poptCon);
+
+ if (device != NULL) {
+diff --git a/support.h b/support.h
+index 8ba9ad1..f91f1bc 100644
+--- a/support.h
++++ b/support.h
+@@ -8,7 +8,7 @@
+ #include
+ #include
+
+-#define GPTFDISK_VERSION "1.0.9"
++#define GPTFDISK_VERSION "1.0.9.1"
+
+ #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
+ // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0002-Updated-guid.cc-to-deal-with-minor-change-in-libuuid.patch b/projects/L4T/packages/gptfdisk/patches/0002-Updated-guid.cc-to-deal-with-minor-change-in-libuuid.patch
new file mode 100644
index 00000000000..7515a956764
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0002-Updated-guid.cc-to-deal-with-minor-change-in-libuuid.patch
@@ -0,0 +1,39 @@
+From 6a8416cbd12d55f882bb751993b94f72d338d96f Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Sat, 16 Apr 2022 09:32:04 -0400
+Subject: [PATCH 02/12] Updated guid.cc to deal with minor change in libuuid
+
+---
+ NEWS | 2 ++
+ guid.cc | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/NEWS b/NEWS
+index 9e153fd..9ec7e63 100644
+--- a/NEWS
++++ b/NEWS
+@@ -6,6 +6,8 @@
+ (commit 740, which is pre-release as I type; presumably version 1.19 and
+ later once released).
+
++- Updated guid.cc to deal with minor change in libuuid.
++
+ 1.0.9 (4/14/2022):
+ ------------------
+
+diff --git a/guid.cc b/guid.cc
+index 1e73ab7..d3e4fd5 100644
+--- a/guid.cc
++++ b/guid.cc
+@@ -141,7 +141,7 @@ void GUIDData::Zero(void) {
+ void GUIDData::Randomize(void) {
+ int i, uuidGenerated = 0;
+
+-#ifdef _UUID_UUID_H
++#if defined (_UUID_UUID_H) || defined (_UL_LIBUUID_UUID_H)
+ uuid_generate(uuidData);
+ ReverseBytes(&uuidData[0], 4);
+ ReverseBytes(&uuidData[4], 2);
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0003-Updated-URLs-in-man-pages-to-HTTPS-rather-than-HTTP.patch b/projects/L4T/packages/gptfdisk/patches/0003-Updated-URLs-in-man-pages-to-HTTPS-rather-than-HTTP.patch
new file mode 100644
index 00000000000..bf368296809
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0003-Updated-URLs-in-man-pages-to-HTTPS-rather-than-HTTP.patch
@@ -0,0 +1,115 @@
+From 913f7b48647bdbd23fdc4abccf2168b061273aa4 Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Tue, 26 Apr 2022 15:46:49 -0400
+Subject: [PATCH 03/12] Updated URLs in man pages to HTTPS rather than HTTP
+
+---
+ cgdisk.8 | 8 ++++----
+ fixparts.8 | 4 ++--
+ gdisk.8 | 8 ++++----
+ sgdisk.8 | 8 ++++----
+ 4 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/cgdisk.8 b/cgdisk.8
+index e3b5cb4..bc83d4b 100644
+--- a/cgdisk.8
++++ b/cgdisk.8
+@@ -25,7 +25,7 @@ disks.
+
+ For information on MBR vs. GPT, as well as GPT terminology and structure,
+ see the extended GPT fdisk documentation at
+-\fIhttp://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
++\fIhttps://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
+
+ The \fBcgdisk\fR program employs a user interface similar to that of Linux's
+ \fBcfdisk\fR, but \fBcgdisk\fR modifies GPT partitions. It also has the
+@@ -389,11 +389,11 @@ Contributors:
+ .BR sgdisk (8),
+ .BR fixparts (8).
+
+-\fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR
++\fIhttps://en.wikipedia.org/wiki/GUID_Partition_Table\fR
+
+-\fIhttp://developer.apple.com/technotes/tn2006/tn2166.html\fR
++\fIhttps://developer.apple.com/technotes/tn2006/tn2166.html\fR
+
+-\fIhttp://www.rodsbooks.com/gdisk/\fR
++\fIhttps://www.rodsbooks.com/gdisk/\fR
+
+ .SH "AVAILABILITY"
+ The \fBcgdisk\fR command is part of the \fIGPT fdisk\fR package and is
+diff --git a/fixparts.8 b/fixparts.8
+index da7462a..25d05ad 100644
+--- a/fixparts.8
++++ b/fixparts.8
+@@ -273,9 +273,9 @@ Contributors:
+ .BR gdisk (8),
+ .BR sgdisk (8).
+
+-\fIhttp://en.wikipedia.org/wiki/Master_boot_record\fR
++\fIhttps://en.wikipedia.org/wiki/Master_boot_record\fR
+
+-\fIhttp://www.rodsbooks.com/fixparts/\fR
++\fIhttps://www.rodsbooks.com/fixparts/\fR
+
+ .SH "AVAILABILITY"
+ The \fBfixparts\fR command is part of the \fIGPT fdisk\fR package and is
+diff --git a/gdisk.8 b/gdisk.8
+index b826b89..8c9929b 100644
+--- a/gdisk.8
++++ b/gdisk.8
+@@ -27,7 +27,7 @@ recovery options require you to understand the distinctions between the
+ main and backup data, as well as between the GPT headers and the partition
+ tables. For information on MBR vs. GPT, as well as GPT terminology and
+ structure, see the extended \fBgdisk\fR documentation at
+-\fIhttp://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
++\fIhttps://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
+
+ The \fBgdisk\fR program employs a user interface similar to that of Linux's
+ \fBfdisk\fR, but \fBgdisk\fR modifies GPT partitions. It also has the
+@@ -702,11 +702,11 @@ Contributors:
+ .BR sgdisk (8),
+ .BR fixparts (8).
+
+-\fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR
++\fIhttps://en.wikipedia.org/wiki/GUID_Partition_Table\fR
+
+-\fIhttp://developer.apple.com/technotes/tn2006/tn2166.html\fR
++\fIhttps://developer.apple.com/technotes/tn2006/tn2166.html\fR
+
+-\fIhttp://www.rodsbooks.com/gdisk/\fR
++\fIhttps://www.rodsbooks.com/gdisk/\fR
+
+ .SH "AVAILABILITY"
+ The \fBgdisk\fR command is part of the \fIGPT fdisk\fR package and is
+diff --git a/sgdisk.8 b/sgdisk.8
+index b966a13..4e5a15a 100644
+--- a/sgdisk.8
++++ b/sgdisk.8
+@@ -23,7 +23,7 @@ recovery options require you to understand the distinctions between the
+ main and backup data, as well as between the GPT headers and the partition
+ tables. For information on MBR vs. GPT, as well as GPT terminology and
+ structure, see the extended \fBgdisk\fR documentation at
+-\fIhttp://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
++\fIhttps://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
+
+ The \fBsgdisk\fR program employs a user interface that's based entirely on
+ the command line, making it suitable for use in scripts or by experts who
+@@ -632,11 +632,11 @@ Contributors:
+ .BR sfdisk (8),
+ .BR fixparts (8).
+
+-\fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR
++\fIhttps://en.wikipedia.org/wiki/GUID_Partition_Table\fR
+
+-\fIhttp://developer.apple.com/technotes/tn2006/tn2166.html\fR
++\fIhttps://developer.apple.com/technotes/tn2006/tn2166.html\fR
+
+-\fIhttp://www.rodsbooks.com/gdisk/\fR
++\fIhttps://www.rodsbooks.com/gdisk/\fR
+
+ .SH "AVAILABILITY"
+ The \fBsgdisk\fR command is part of the \fIGPT fdisk\fR package and is
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0004-Fix-NULL-dereference-when-duplicating-string-argumen.patch b/projects/L4T/packages/gptfdisk/patches/0004-Fix-NULL-dereference-when-duplicating-string-argumen.patch
new file mode 100644
index 00000000000..eef1f466124
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0004-Fix-NULL-dereference-when-duplicating-string-argumen.patch
@@ -0,0 +1,40 @@
+From f5de3401b974ce103ffd93af8f9d43505a04aaf9 Mon Sep 17 00:00:00 2001
+From: Damian Kurek
+Date: Thu, 7 Jul 2022 03:39:16 +0000
+Subject: [PATCH 04/12] Fix NULL dereference when duplicating string argument
+
+poptGetArg can return NULL if there are no additional arguments, which
+makes strdup dereference NULL on strlen
+---
+ gptcl.cc | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/gptcl.cc b/gptcl.cc
+index 0d578eb..ab95239 100644
+--- a/gptcl.cc
++++ b/gptcl.cc
+@@ -155,10 +155,11 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
+ } // while
+
+ // Assume first non-option argument is the device filename....
+- device = strdup((char*) poptGetArg(poptCon));
+- poptResetContext(poptCon);
++ device = (char*) poptGetArg(poptCon);
+
+ if (device != NULL) {
++ device = strdup(device);
++ poptResetContext(poptCon);
+ JustLooking(); // reset as necessary
+ BeQuiet(); // Tell called functions to be less verbose & interactive
+ if (LoadPartitions((string) device)) {
+@@ -498,6 +499,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
+ cerr << "Error encountered; not saving changes.\n";
+ retval = 4;
+ } // if
++ free(device);
+ } // if (device != NULL)
+ poptFreeContext(poptCon);
+ return retval;
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0005-Use-64bit-time_t-on-linux-as-well.patch b/projects/L4T/packages/gptfdisk/patches/0005-Use-64bit-time_t-on-linux-as-well.patch
new file mode 100644
index 00000000000..5518d8305ac
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0005-Use-64bit-time_t-on-linux-as-well.patch
@@ -0,0 +1,34 @@
+From 7dfa8984f5a30f313d8675ff6097c8592d636d10 Mon Sep 17 00:00:00 2001
+From: Khem Raj
+Date: Mon, 12 Dec 2022 12:50:07 -0800
+Subject: [PATCH 05/12] Use 64bit time_t on linux as well
+
+Alias 64bit version of stat functions to original functions
+we are already passing -D_FILE_OFFSET_BITS=64 in linux Makefile
+
+Signed-off-by: Khem Raj
+---
+ diskio-unix.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/diskio-unix.cc b/diskio-unix.cc
+index 7780aeb..0897c56 100644
+--- a/diskio-unix.cc
++++ b/diskio-unix.cc
+@@ -37,8 +37,12 @@
+
+ using namespace std;
+
+-#ifdef __APPLE__
++#if defined(__APPLE__) || defined(__linux__)
+ #define off64_t off_t
++#define stat64 stat
++#define fstat64 fstat
++#define lstat64 lstat
++#define lseek64 lseek
+ #endif
+
+ // Returns the official "real" name for a shortened version of same.
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0006-Allow-partition-dynamically-allocated-by-largest-new.patch b/projects/L4T/packages/gptfdisk/patches/0006-Allow-partition-dynamically-allocated-by-largest-new.patch
new file mode 100644
index 00000000000..e4ecd2ad7ac
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0006-Allow-partition-dynamically-allocated-by-largest-new.patch
@@ -0,0 +1,38 @@
+From caf30c022c5f659bb7a5e52272c6aeca94098c70 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?David=20Joaqu=C3=ADn=20Shourabi=20Porcel?=
+Date: Sat, 28 Jan 2023 16:19:16 +0100
+Subject: [PATCH 06/12] Allow partition dynamically allocated by --largest-new
+ to be referenced by other options
+
+The documentation for the option --new explains that:
+
+> [a] partnum value of 0 causes the program to use the first available
+> partition number. Subsequent uses of the -A (--attributes), -c
+> (--change-name), -t (--typecode), and -u (--partition-guid) options
+> may also use 0 to refer to the same partition.
+
+Although the documentation for the option --largest-new does not mention
+such functionality, I expected it, and was puzzled when it didn't work.
+---
+ gptcl.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/gptcl.cc b/gptcl.cc
+index 0d578eb..e8d394a 100644
+--- a/gptcl.cc
++++ b/gptcl.cc
+@@ -331,8 +331,10 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
+ startSector = FindFirstInLargest();
+ Align(&startSector);
+ endSector = FindLastInFree(startSector, alignEnd);
+- if (largestPartNum <= 0)
++ if (largestPartNum <= 0) {
+ largestPartNum = FindFirstFreePart() + 1;
++ newPartNum = largestPartNum - 1;
++ }
+ if (CreatePartition(largestPartNum - 1, startSector, endSector)) {
+ saveData = 1;
+ } else {
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0007-Document-recent-merge.patch b/projects/L4T/packages/gptfdisk/patches/0007-Document-recent-merge.patch
new file mode 100644
index 00000000000..680eab3602b
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0007-Document-recent-merge.patch
@@ -0,0 +1,31 @@
+From 3c4a9fbd1d71fbd3aff0c83ec3ac9b2a0d9ba748 Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Sun, 5 Mar 2023 10:57:24 -0500
+Subject: [PATCH 07/12] Document recent merge.
+
+---
+ NEWS | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/NEWS b/NEWS
+index 9ec7e63..f9f7f19 100644
+--- a/NEWS
++++ b/NEWS
+@@ -1,4 +1,4 @@
+-1.0.10 (?/??/2022):
++1.0.10 (?/??/2023):
+ -------------------
+
+ - Fixed problem that caused sgdisk to crash with errors about being unable
+@@ -8,6 +8,8 @@
+
+ - Updated guid.cc to deal with minor change in libuuid.
+
++- Fixed potential NULL derefernce bug in sgdisk.
++
+ 1.0.9 (4/14/2022):
+ ------------------
+
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0008-Document-recent-mergest.patch b/projects/L4T/packages/gptfdisk/patches/0008-Document-recent-mergest.patch
new file mode 100644
index 00000000000..ea8bf451d73
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0008-Document-recent-mergest.patch
@@ -0,0 +1,49 @@
+From e7a566bd96573b3f71001d0215dab93dcdd120d9 Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Sun, 5 Mar 2023 11:26:49 -0500
+Subject: [PATCH 08/12] Document recent mergest
+
+---
+ NEWS | 7 ++++++-
+ sgdisk.8 | 7 +++++--
+ 2 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index f9f7f19..8d5b365 100644
+--- a/NEWS
++++ b/NEWS
+@@ -8,7 +8,12 @@
+
+ - Updated guid.cc to deal with minor change in libuuid.
+
+-- Fixed potential NULL derefernce bug in sgdisk.
++- Fixed potential NULL derefernce bug in sgdisk. Thanks to Damian Kurek
++ for this fix.
++
++- The partition number of "0" can now be used to reference newly-created
++ partitions when the --largest-new=0 option to sgdisk is used. Thanks to
++ David Joaqu�n Shourabi Porcel for this improvement.
+
+ 1.0.9 (4/14/2022):
+ ------------------
+diff --git a/sgdisk.8 b/sgdisk.8
+index 4e5a15a..fa53b29 100644
+--- a/sgdisk.8
++++ b/sgdisk.8
+@@ -370,8 +370,11 @@ to use the first available partition number. Subsequent uses of the
+ .B \-N, \-\-largest\-new=num
+ Create a new partition that fills the largest available block of space on
+ the disk. You can use the \fI\-a\fR (\fI\-\-set\-alignment\fR) option to
+-adjust the alignment, if desired. A num value of 0 causes the program to
+-use the first available partition number.
++adjust the alignment, if desired. A num value of 0 causes the program to use
++the first available partition number. Subsequent uses of the \fI\-A\fR
++(\fI\-\-attributes\fR), \fI\-c\fR (\fI\-\-change\-name\fR), \fI\-t\fR
++(\fI\-\-typecode\fR), and \fI\-u\fR (\fI\-\-partition\-guid\fR) options may
++also use \fI0\fR to refer to the same partition.
+
+ .TP
+ .B \-o, \-\-clear
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0009-Do-some-explicit-casts-in-gptcurses.cc-to-eliminate-.patch b/projects/L4T/packages/gptfdisk/patches/0009-Do-some-explicit-casts-in-gptcurses.cc-to-eliminate-.patch
new file mode 100644
index 00000000000..e030221d88c
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0009-Do-some-explicit-casts-in-gptcurses.cc-to-eliminate-.patch
@@ -0,0 +1,69 @@
+From 42eea87e89bdbf4c4548e88428513717a601e05d Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Mon, 6 Mar 2023 14:21:35 -0500
+Subject: [PATCH 09/12] Do some explicit casts in gptcurses.cc to eliminate
+ compiler warnings.
+
+---
+ NEWS | 3 +++
+ gptcurses.cc | 13 +++++++------
+ 2 files changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index 8d5b365..dc1660e 100644
+--- a/NEWS
++++ b/NEWS
+@@ -15,6 +15,9 @@
+ partitions when the --largest-new=0 option to sgdisk is used. Thanks to
+ David Joaqu�n Shourabi Porcel for this improvement.
+
++- Make explicit casts in gptcurses.cc to eliminate compiler warnings about
++ mis-matched types in printw() statements.
++
+ 1.0.9 (4/14/2022):
+ ------------------
+
+diff --git a/gptcurses.cc b/gptcurses.cc
+index 8b0ae91..64cc514 100644
+--- a/gptcurses.cc
++++ b/gptcurses.cc
+@@ -333,13 +333,13 @@ void GPTDataCurses::ShowInfo(int partNum) {
+ printw("Partition GUID code: %s (%s)\n", partitions[partNum].GetType().AsString().c_str(),
+ partitions[partNum].GetTypeName().c_str());
+ printw("Partition unique GUID: %s\n", partitions[partNum].GetUniqueGUID().AsString().c_str());
+- printw("First sector: %lld (at %s)\n", partitions[partNum].GetFirstLBA(),
++ printw("First sector: %llu (at %s)\n", (long long unsigned int) partitions[partNum].GetFirstLBA(),
+ BytesToIeee(partitions[partNum].GetFirstLBA(), blockSize).c_str());
+- printw("Last sector: %lld (at %s)\n", partitions[partNum].GetLastLBA(),
++ printw("Last sector: %llu (at %s)\n", (long long unsigned int) partitions[partNum].GetLastLBA(),
+ BytesToIeee(partitions[partNum].GetLastLBA(), blockSize).c_str());
+ size = partitions[partNum].GetLastLBA() - partitions[partNum].GetFirstLBA() + 1;
+- printw("Partition size: %lld sectors (%s)\n", size, BytesToIeee(size, blockSize).c_str());
+- printw("Attribute flags: %016llx\n", partitions[partNum].GetAttributes().GetAttributes());
++ printw("Partition size: %llu sectors (%s)\n", (long long unsigned int) size, BytesToIeee(size, blockSize).c_str());
++ printw("Attribute flags: %016llx\n", (long long unsigned int) partitions[partNum].GetAttributes().GetAttributes());
+ #ifdef USE_UTF16
+ partitions[partNum].GetDescription().extract(0, NAME_SIZE , temp, NAME_SIZE );
+ printw("Partition name: '%s'\n", temp);
+@@ -447,7 +447,8 @@ void GPTDataCurses::MakeNewPart(void) {
+ clrtoeol();
+ newFirstLBA = currentSpace->firstLBA;
+ Align(&newFirstLBA);
+- printw("First sector (%lld-%lld, default = %lld): ", newFirstLBA, currentSpace->lastLBA, newFirstLBA);
++ printw("First sector (%llu-%llu, default = %llu): ", (long long unsigned int) newFirstLBA,
++ (long long unsigned int) currentSpace->lastLBA, (long long unsigned int) newFirstLBA);
+ echo();
+ getnstr(inLine, 79);
+ noecho();
+@@ -461,7 +462,7 @@ void GPTDataCurses::MakeNewPart(void) {
+ while ((newLastLBA > currentSpace->lastLBA) || (newLastLBA < newFirstLBA)) {
+ move(LINES - 3, 0);
+ clrtoeol();
+- printw("Size in sectors or {KMGTP} (default = %lld): ", size);
++ printw("Size in sectors or {KMGTP} (default = %llu): ", (long long unsigned int) size);
+ echo();
+ getnstr(inLine, 79);
+ noecho();
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0010-Truncate-decimal-inputs-e.g.-9.5G-becomes-9G.patch b/projects/L4T/packages/gptfdisk/patches/0010-Truncate-decimal-inputs-e.g.-9.5G-becomes-9G.patch
new file mode 100644
index 00000000000..52da7e0dbbd
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0010-Truncate-decimal-inputs-e.g.-9.5G-becomes-9G.patch
@@ -0,0 +1,49 @@
+From e1cc654ef71996d836c5d051278130f50f768f84 Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Mon, 6 Mar 2023 17:22:32 -0500
+Subject: [PATCH 10/12] Truncate decimal inputs (e.g., '9.5G' becomes '9G')
+
+---
+ support.cc | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/support.cc b/support.cc
+index 0d3bd6f..3cbabf7 100644
+--- a/support.cc
++++ b/support.cc
+@@ -124,6 +124,8 @@ char GetYN(void) {
+ // inValue works out to something outside the range low-high, returns the
+ // computed value; the calling function is responsible for checking the
+ // validity of this value.
++// If inValue contains a decimal number (e.g., "9.5G"), quietly truncate it
++// (to "9G" in this example).
+ // NOTE: There's a difference in how GCC and VC++ treat oversized values
+ // (say, "999999999999999999999") read via the ">>" operator; GCC turns
+ // them into the maximum value for the type, whereas VC++ turns them into
+@@ -158,6 +160,15 @@ uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high,
+ badInput = 1;
+ inString >> response >> suffix;
+ suffix = toupper(suffix);
++ foundAt = suffixes.find(suffix);
++ // If suffix is invalid, try to find a valid one. Done because users
++ // sometimes enter decimal numbers; when they do, suffix becomes
++ // '.', and we need to truncate the number and find the real suffix.
++ while (foundAt > (suffixes.length() - 1) && inString.peek() != -1) {
++ inString >> suffix;
++ foundAt = suffixes.find(suffix);
++ suffix = toupper(suffix);
++ }
+
+ // If no response, or if response == 0, use default (def)
+ if ((inValue.length() == 0) || (response == 0)) {
+@@ -167,7 +178,6 @@ uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high,
+ } // if
+
+ // Find multiplication and division factors for the suffix
+- foundAt = suffixes.find(suffix);
+ if (foundAt != string::npos) {
+ bytesPerUnit = UINT64_C(1) << (10 * (foundAt + 1));
+ mult = bytesPerUnit / sSize;
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0011-Document-previous-merge.patch b/projects/L4T/packages/gptfdisk/patches/0011-Document-previous-merge.patch
new file mode 100644
index 00000000000..9d8d5931285
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0011-Document-previous-merge.patch
@@ -0,0 +1,44 @@
+From 0e7d63502f6ea68b5c56036c493e72e83b3f145d Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Mon, 6 Mar 2023 17:28:18 -0500
+Subject: [PATCH 11/12] Document previous merge
+
+---
+ NEWS | 7 +++++++
+ support.h | 2 +-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/NEWS b/NEWS
+index dc1660e..5c6dfa1 100644
+--- a/NEWS
++++ b/NEWS
+@@ -18,6 +18,13 @@
+ - Make explicit casts in gptcurses.cc to eliminate compiler warnings about
+ mis-matched types in printw() statements.
+
++- In previous versions, rEFInd accepted only integer values for partition
++ start points, end points, and sizes, and it interpreted decimal values
++ incorrectly. That is, if you typed "+9.5G" as the partition end point,
++ you'd end up with something just 9 sectors in size. This version now
++ truncates decimal numbers to their integral values, so you'd get a 9 GiB
++ partition instead.
++
+ 1.0.9 (4/14/2022):
+ ------------------
+
+diff --git a/support.h b/support.h
+index f91f1bc..4a9f414 100644
+--- a/support.h
++++ b/support.h
+@@ -8,7 +8,7 @@
+ #include
+ #include
+
+-#define GPTFDISK_VERSION "1.0.9.1"
++#define GPTFDISK_VERSION "1.0.9.2"
+
+ #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
+ // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
+--
+2.31.1
+
diff --git a/projects/L4T/packages/gptfdisk/patches/0012-Minor-code-cleanup-based-on-valgrind-analysis.patch b/projects/L4T/packages/gptfdisk/patches/0012-Minor-code-cleanup-based-on-valgrind-analysis.patch
new file mode 100644
index 00000000000..e5d0fdeb6d9
--- /dev/null
+++ b/projects/L4T/packages/gptfdisk/patches/0012-Minor-code-cleanup-based-on-valgrind-analysis.patch
@@ -0,0 +1,38 @@
+From cb4bf320748f701a0ed835d4a410f2960f1ce0bd Mon Sep 17 00:00:00 2001
+From: Rod Smith
+Date: Fri, 10 Mar 2023 13:28:00 -0500
+Subject: [PATCH 12/12] Minor code cleanup based on valgrind analysis
+
+---
+ NEWS | 2 ++
+ gpt.cc | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/NEWS b/NEWS
+index 5c6dfa1..29d99e3 100644
+--- a/NEWS
++++ b/NEWS
+@@ -18,6 +18,8 @@
+ - Make explicit casts in gptcurses.cc to eliminate compiler warnings about
+ mis-matched types in printw() statements.
+
++- Minor code cleanup based on valgrind analysis.
++
+ - In previous versions, rEFInd accepted only integer values for partition
+ start points, end points, and sizes, and it interpreted decimal values
+ incorrectly. That is, if you typed "+9.5G" as the partition end point,
+diff --git a/gpt.cc b/gpt.cc
+index 76cd9ad..24d6918 100644
+--- a/gpt.cc
++++ b/gpt.cc
+@@ -80,6 +80,7 @@ GPTData::GPTData(void) {
+ beQuiet = 0;
+ whichWasUsed = use_new;
+ mainHeader.numParts = 0;
++ mainHeader.firstUsableLBA = 0;
+ mainHeader.lastUsableLBA = 0;
+ numParts = 0;
+ SetGPTSize(NUM_GPT_ENTRIES);
+--
+2.31.1
+
diff --git a/packages/x11/lib/libXv/package.mk b/projects/L4T/packages/libXv/package.mk
similarity index 85%
rename from packages/x11/lib/libXv/package.mk
rename to projects/L4T/packages/libXv/package.mk
index 1a6603550c7..399c8ba9d30 100644
--- a/packages/x11/lib/libXv/package.mk
+++ b/projects/L4T/packages/libXv/package.mk
@@ -4,10 +4,10 @@
PKG_NAME="libXv"
PKG_VERSION="1.0.11"
-PKG_SHA256="11c7e47bed737c8fa01741d1dba4d39a523ded25dd5f3d47f516a0c62dbc450a"
+PKG_SHA256="c4112532889b210e21cf05f46f0f2f8354ff7e1b58061e12d7a76c95c0d47bb1"
PKG_LICENSE="OSS"
PKG_SITE="http://www.x.org/"
-PKG_URL="https://github.com/freedesktop/xorg-libXv/archive/refs/tags/${PKG_NAME}-${PKG_VERSION}.tar.gz"
+PKG_URL="${LAKKA_MIRROR}/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain util-macros libX11 libXfixes libXext"
PKG_LONGDESC="LibXv provides an X video extension to the X protocol."
PKG_BUILD_FLAGS="+pic"
diff --git a/projects/L4T/packages/systemd/package.mk b/projects/L4T/packages/systemd/package.mk
index 2fae032ad4f..ad3376b878a 100644
--- a/projects/L4T/packages/systemd/package.mk
+++ b/projects/L4T/packages/systemd/package.mk
@@ -268,20 +268,20 @@ post_install() {
add_group systemd-network 193
add_user systemd-network x 193 193 "systemd-network" "/" "/bin/sh"
- add_group audio 63
- add_group cdrom 11
- add_group dialout 18
- add_group disk 6
- add_group floppy 19
+ add_group audio 63 ${DISTRO}
+ add_group cdrom 11 ${DISTRO}
+ add_group dialout 18 ${DISTRO}
+ add_group disk 6 ${DISTRO}
+ add_group floppy 19 ${DISTRO}
add_group kmem 9
add_group kvm 10
add_group lp 7
add_group render 12
add_group tape 33
add_group tty 5
- add_group video 39
+ add_group video 39 ${DISTRO}
add_group utmp 22
- add_group input 199
+ add_group input 199 ${DISTRO}
enable_service machine-id.service
enable_service debugconfig.service
@@ -293,4 +293,9 @@ post_install() {
enable_service network-base.service
enable_service systemd-timesyncd.service
enable_service systemd-timesyncd-setup.service
+
+ if [ "${PROJECT}" = "L4T" -a "${DEVICE}" = "Switch" ]; then
+ echo chmod u+s ${BUILD}/image/system/usr/bin/systemctl >> ${FAKEROOT_SCRIPT}
+ fi
+
}
diff --git a/projects/L4T/packages/tegra-bsp/assets/10-monitor.conf b/projects/L4T/packages/tegra-bsp/assets/10-monitor.conf
index 9bdd149ba62..2278e7e083a 100644
--- a/projects/L4T/packages/tegra-bsp/assets/10-monitor.conf
+++ b/projects/L4T/packages/tegra-bsp/assets/10-monitor.conf
@@ -9,6 +9,9 @@ Section "Screen"
Monitor "Monitor0"
DefaultDepth 24
Option "metamodes" "DSI-0: nvidia-auto-select @1280x720 +0+0 {ViewPortIn=1280x720, ViewPortOut=720x1280+0+0, Rotation=90}"
+ Option "AllowIndirectGLXProtocol" "off"
+ Option "TripleBuffer" "on"
+ Option "UseNvKmsCompositionPipeline" "false"
SubSection "Display"
Depth 24
EndSubSection
diff --git a/projects/L4T/packages/v4l-utils/config/rc_keymaps/README b/projects/L4T/packages/v4l-utils/config/rc_keymaps/README
new file mode 100644
index 00000000000..74b4005d1f4
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/config/rc_keymaps/README
@@ -0,0 +1,3 @@
+RC keymaps user config dir
+
+put your own keymaps for ir-keytable in this directory
diff --git a/projects/L4T/packages/v4l-utils/config/rc_keymaps/protocols/README b/projects/L4T/packages/v4l-utils/config/rc_keymaps/protocols/README
new file mode 100644
index 00000000000..ee1f0a3b504
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/config/rc_keymaps/protocols/README
@@ -0,0 +1,3 @@
+BPF protocol decoders user config dir
+
+put your BPF protocol decoders for ir-keytable in this directory
diff --git a/projects/L4T/packages/v4l-utils/config/rc_maps.cfg.sample b/projects/L4T/packages/v4l-utils/config/rc_maps.cfg.sample
new file mode 100644
index 00000000000..c8f6bca229c
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/config/rc_maps.cfg.sample
@@ -0,0 +1,20 @@
+# Keymaps table
+#
+# This table creates an association between a keycode file and a kernel
+# driver. It can be used to automatically override a keycode definition.
+#
+#
+# Format:
+# driver - name of the driver provided via uevent - use * for any driver
+# table - RC keymap table, provided via uevent - use * for any table
+# file - file name. If directory is not specified, it is first looked up
+# in /storage/.config/rc_keymaps, then /usr/lib/udev/rc_keymaps
+#
+# For example:
+#
+# driver table file
+#
+# gpio-rc-recv rc-streamzap streamzap
+# gpio-rc-recv * justboom
+# * rc-rc6-mce rc6_mce_new
+# * * hauppauge_new
diff --git a/projects/L4T/packages/v4l-utils/keymaps/beelink.toml b/projects/L4T/packages/v4l-utils/keymaps/beelink.toml
new file mode 100644
index 00000000000..f8c3d844a4b
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/keymaps/beelink.toml
@@ -0,0 +1,32 @@
+[[protocols]]
+name = "beelink_x2"
+protocol = "NEC"
+[protocols.scancodes]
+0x804d = "KEY_MUTE"
+0x8009 = "KEY_MEDIA"
+0x8011 = "KEY_AUDIO"
+0x8054 = "KEY_WWW"
+0x804e = "KEY_VOLUMEUP"
+0x80bb = "KEY_REWIND"
+0x80bd = "KEY_FORWARD"
+0x8056 = "KEY_VOLUMEDOWN"
+0x8053 = "KEY_HOME"
+0x801b = "KEY_BACK"
+0x8026 = "KEY_UP"
+0x8025 = "KEY_LEFT"
+0x800d = "KEY_OK"
+0x8027 = "KEY_RIGHT"
+0x8028 = "KEY_DOWN"
+0x8049 = "KEY_MENU"
+0x8030 = "KEY_NUMERIC_0"
+0x8031 = "KEY_NUMERIC_1"
+0x8032 = "KEY_NUMERIC_2"
+0x8033 = "KEY_NUMERIC_3"
+0x8034 = "KEY_NUMERIC_4"
+0x8035 = "KEY_NUMERIC_5"
+0x8036 = "KEY_NUMERIC_6"
+0x8037 = "KEY_NUMERIC_7"
+0x8038 = "KEY_NUMERIC_8"
+0x8039 = "KEY_NUMERIC_9"
+0x8044 = "KEY_BACKSPACE"
+0x8051 = "KEY_POWER"
diff --git a/projects/L4T/packages/v4l-utils/keymaps/cubox_i.toml b/projects/L4T/packages/v4l-utils/keymaps/cubox_i.toml
new file mode 100644
index 00000000000..12f2b0af121
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/keymaps/cubox_i.toml
@@ -0,0 +1,13 @@
+[[protocols]]
+name = "cubox_i"
+protocol = "rc6"
+[protocols.scancodes]
+0x1f020b0 = "KEY_MEDIA"
+0x1f02078 = "KEY_UP"
+0x1f02044 = "KEY_ENTER"
+0x1f020f8 = "KEY_DOWN"
+0x1f02004 = "KEY_LEFT"
+0x1f02084 = "KEY_RIGHT"
+0x1f020c4 = "KEY_BACKSPACE"
+0x1f02068 = "KEY_PLAYPAUSE"
+0x1f02064 = "KEY_EPG"
diff --git a/projects/L4T/packages/v4l-utils/keymaps/minix_neo.toml b/projects/L4T/packages/v4l-utils/keymaps/minix_neo.toml
new file mode 100644
index 00000000000..045c3d96dde
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/keymaps/minix_neo.toml
@@ -0,0 +1,16 @@
+[[protocols]]
+name = "Minix Neo"
+protocol = "nec"
+[protocols.scancodes]
+0x118 = "KEY_POWER"
+0x146 = "KEY_UP"
+0x116 = "KEY_DOWN"
+0x147 = "KEY_LEFT"
+0x115 = "KEY_RIGHT"
+0x155 = "KEY_ENTER"
+0x110 = "KEY_VOLUMEDOWN"
+0x140 = "KEY_BACK"
+0x114 = "KEY_VOLUMEUP"
+0x10d = "KEY_HOMEPAGE"
+0x104 = "KEY_MENU"
+0x112 = "KEY_CONFIG"
diff --git a/projects/L4T/packages/v4l-utils/keymaps/pine64.toml b/projects/L4T/packages/v4l-utils/keymaps/pine64.toml
new file mode 100644
index 00000000000..0b0a8c377c8
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/keymaps/pine64.toml
@@ -0,0 +1,29 @@
+[[protocols]]
+name = "pine64"
+protocol = "NEC"
+[protocols.scancodes]
+0x404000 = "KEY_NUMERIC_0"
+0x404001 = "KEY_NUMERIC_1"
+0x404002 = "KEY_NUMERIC_2"
+0x404003 = "KEY_NUMERIC_3"
+0x404004 = "KEY_NUMERIC_4"
+0x404005 = "KEY_NUMERIC_5"
+0x404006 = "KEY_NUMERIC_6"
+0x404007 = "KEY_NUMERIC_7"
+0x404008 = "KEY_NUMERIC_8"
+0x404009 = "KEY_NUMERIC_9"
+0x40400a = "KEY_MUTE"
+0x40400b = "KEY_UP"
+0x40400c = "KEY_BACKSPACE"
+0x40400d = "KEY_OK"
+0x40400e = "KEY_DOWN"
+0x404010 = "KEY_LEFT"
+0x404011 = "KEY_RIGHT"
+0x404017 = "KEY_VOLUMEDOWN"
+0x404018 = "KEY_VOLUMEUP"
+0x40401a = "KEY_HOME"
+0x40401d = "KEY_MENU"
+0x40401f = "KEY_WWW"
+0x404045 = "KEY_BACK"
+0x404047 = "KEY_INFO"
+0x40404d = "KEY_POWER"
diff --git a/projects/L4T/packages/v4l-utils/keymaps/xbox_360.toml b/projects/L4T/packages/v4l-utils/keymaps/xbox_360.toml
new file mode 100644
index 00000000000..9ad76abef10
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/keymaps/xbox_360.toml
@@ -0,0 +1,70 @@
+[[protocols]]
+name = "Xbox 360"
+protocol = "rc6"
+variant = "rc6_mce"
+[protocols.scancodes]
+0x800f7400 = "KEY_NUMERIC_0"
+0x800f7401 = "KEY_NUMERIC_1"
+0x800f7402 = "KEY_NUMERIC_2"
+0x800f7403 = "KEY_NUMERIC_3"
+0x800f7404 = "KEY_NUMERIC_4"
+0x800f7405 = "KEY_NUMERIC_5"
+0x800f7406 = "KEY_NUMERIC_6"
+0x800f7407 = "KEY_NUMERIC_7"
+0x800f7408 = "KEY_NUMERIC_8"
+0x800f7409 = "KEY_NUMERIC_9"
+0x800f740a = "KEY_DELETE"
+0x800f740b = "KEY_ENTER"
+0x800f740c = "KEY_SLEEP"
+0x800f740d = "KEY_MEDIA"
+0x800f7464 = "KEY_MEDIA"
+0x800f740e = "KEY_MUTE"
+0x800f740f = "KEY_INFO"
+0x800f7410 = "KEY_VOLUMEUP"
+0x800f7411 = "KEY_VOLUMEDOWN"
+0x800f7412 = "KEY_CHANNELUP"
+0x800f746C = "KEY_CHANNELUP"
+0x800f7413 = "KEY_CHANNELDOWN"
+0x800f746D = "KEY_CHANNELDOWN"
+0x800f7414 = "KEY_FASTFORWARD"
+0x800f7415 = "KEY_REWIND"
+0x800f7416 = "KEY_PLAY"
+0x800f7417 = "KEY_RECORD"
+0x800f7418 = "KEY_PAUSE"
+0x800f7419 = "KEY_STOP"
+0x800f741a = "KEY_NEXT"
+0x800f741b = "KEY_PREVIOUS"
+0x800f741c = "KEY_NUMERIC_POUND"
+0x800f741d = "KEY_NUMERIC_STAR"
+0x800f741e = "KEY_UP"
+0x800f741f = "KEY_DOWN"
+0x800f7420 = "KEY_LEFT"
+0x800f7421 = "KEY_RIGHT"
+0x800f7422 = "KEY_OK"
+0x800f7423 = "KEY_EXIT"
+0x800f7424 = "KEY_DVD"
+0x800f744f = "KEY_EPG"
+0x800f7427 = "KEY_ZOOM"
+0x800f7432 = "KEY_MODE"
+0x800f7433 = "KEY_PRESENTATION"
+0x800f7428 = "KEY_EJECTCD"
+0x800f743a = "KEY_BRIGHTNESSUP"
+0x800f7446 = "KEY_TV"
+0x800f7447 = "KEY_AUDIO"
+0x800f7448 = "KEY_PVR"
+0x800f7449 = "KEY_CAMERA"
+0x800f744a = "KEY_VIDEO"
+0x800f744c = "KEY_LANGUAGE"
+0x800f7451 = "KEY_TITLE"
+0x800f744e = "KEY_PRINT"
+0x800f7450 = "KEY_RADIO"
+0x800f745a = "KEY_SUBTITLE"
+0x800f7425 = "KEY_RED"
+0x800f7466 = "KEY_GREEN"
+0x800f7426 = "KEY_YELLOW"
+0x800f7468 = "KEY_BLUE"
+0x800f7465 = "KEY_POWER2"
+0x800f746e = "KEY_PLAYPAUSE"
+0x800f746f = "KEY_PLAYER"
+0x800f7480 = "KEY_BRIGHTNESSDOWN"
+0x800f7481 = "KEY_PLAYPAUSE"
diff --git a/projects/L4T/packages/v4l-utils/keymaps/xbox_one.toml b/projects/L4T/packages/v4l-utils/keymaps/xbox_one.toml
new file mode 100644
index 00000000000..d7c7114fc7b
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/keymaps/xbox_one.toml
@@ -0,0 +1,37 @@
+[[protocols]]
+name = "Xbox One"
+protocol = "nec"
+variant = "necx"
+[protocols.scancodes]
+0x80d864 = "KEY_MEDIA"
+0x80d820 = "KEY_LEFT"
+0x80d821 = "KEY_RIGHT"
+0x80d81e = "KEY_UP"
+0x80d81f = "KEY_DOWN"
+0x80d822 = "KEY_OK"
+0x80d823 = "KEY_EXIT"
+0x80d80e = "KEY_MUTE"
+0x80d810 = "KEY_VOLUMEUP"
+0x80d811 = "KEY_VOLUMEDOWN"
+0x80d812 = "KEY_CHANNELUP"
+0x80d813 = "KEY_CHANNELDOWN"
+0x80d814 = "KEY_FASTFORWARD"
+0x80d815 = "KEY_REWIND"
+0x80d870 = "KEY_PLAYPAUSE"
+0x80d819 = "KEY_STOP"
+0x80d81a = "KEY_NEXT"
+0x80d81b = "KEY_PREVIOUS"
+0x80d826 = "KEY_INFO"
+0x80d86f = "KEY_EPG"
+0x80d86e = "KEY_ZOOM"
+0x80d801 = "KEY_1"
+0x80d802 = "KEY_2"
+0x80d803 = "KEY_3"
+0x80d804 = "KEY_4"
+0x80d805 = "KEY_5"
+0x80d806 = "KEY_6"
+0x80d807 = "KEY_7"
+0x80d808 = "KEY_8"
+0x80d809 = "KEY_9"
+0x80d800 = "KEY_0"
+0x80d817 = "KEY_RECORD"
diff --git a/projects/L4T/packages/v4l-utils/keymaps/zotac.toml b/projects/L4T/packages/v4l-utils/keymaps/zotac.toml
new file mode 100644
index 00000000000..cbd237d06c4
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/keymaps/zotac.toml
@@ -0,0 +1,48 @@
+[[protocols]]
+name = "zotac"
+protocol = "rc6"
+variant = "rc6_mce"
+[protocols.scancodes]
+0x8034048e = "KEY_POWER"
+0x8034043d = "KEY_SLEEP"
+0x80340400 = "KEY_NUMERIC_0"
+0x80340401 = "KEY_NUMERIC_1"
+0x80340402 = "KEY_NUMERIC_2"
+0x80340403 = "KEY_NUMERIC_3"
+0x80340404 = "KEY_NUMERIC_4"
+0x80340405 = "KEY_NUMERIC_5"
+0x80340406 = "KEY_NUMERIC_6"
+0x80340407 = "KEY_NUMERIC_7"
+0x80340408 = "KEY_NUMERIC_8"
+0x80340409 = "KEY_NUMERIC_9"
+0x80340432 = "KEY_NUMERIC_POUND"
+0x80340433 = "KEY_NUMERIC_STAR"
+0x8034043a = "KEY_DELETE"
+0x80340434 = "KEY_ENTER"
+0x8034045d = "KEY_MEDIA"
+0x8034040d = "KEY_MUTE"
+0x803404cb = "KEY_INFO"
+0x80340410 = "KEY_VOLUMEUP"
+0x80340411 = "KEY_VOLUMEDOWN"
+0x8034041e = "KEY_CHANNELUP"
+0x8034041f = "KEY_CHANNELDOWN"
+0x80340428 = "KEY_FASTFORWARD"
+0x80340429 = "KEY_REWIND"
+0x8034042c = "KEY_PLAY"
+0x80340437 = "KEY_RECORD"
+0x80340430 = "KEY_PAUSE"
+0x80340431 = "KEY_STOP"
+0x80340420 = "KEY_NEXT"
+0x80340421 = "KEY_PREVIOUS"
+0x80340458 = "KEY_UP"
+0x80340459 = "KEY_DOWN"
+0x8034045a = "KEY_LEFT"
+0x8034045b = "KEY_RIGHT"
+0x8034045c = "KEY_OK"
+0x80340483 = "KEY_EXIT"
+0x8034043e = "KEY_EPG"
+0x8034042f = "KEY_TITLE"
+0x8034046d = "KEY_RED"
+0x8034046e = "KEY_GREEN"
+0x8034046f = "KEY_YELLOW"
+0x80340470 = "KEY_BLUE"
diff --git a/projects/L4T/packages/v4l-utils/package.mk b/projects/L4T/packages/v4l-utils/package.mk
new file mode 100644
index 00000000000..5fe67e0bed2
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/package.mk
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
+
+# with 1.0.0 repeat delay is broken. test on upgrade
+
+PKG_NAME="v4l-utils"
+PKG_VERSION="1.20.0"
+PKG_SHA256="956118713f7ccb405c55c7088a6a2490c32d54300dd9a30d8d5008c28d3726f7"
+PKG_LICENSE="GPL"
+PKG_SITE="http://linuxtv.org/"
+PKG_URL="http://linuxtv.org/downloads/v4l-utils/${PKG_NAME}-${PKG_VERSION}.tar.bz2"
+PKG_DEPENDS_TARGET="toolchain alsa-lib systemd elfutils ir-bpf-decoders"
+PKG_LONGDESC="Linux V4L2 and DVB API utilities and v4l libraries (libv4l)."
+PKG_TOOLCHAIN="autotools"
+
+PKG_CONFIGURE_OPTS_TARGET="--without-jpeg \
+ --enable-bpf \
+ --enable-static \
+ --disable-shared \
+ --disable-doxygen-doc"
+
+pre_configure_target() {
+ # cec-ctl fails to build in subdirs
+ cd ${PKG_BUILD}
+ rm -rf .${TARGET_NAME}
+}
+
+make_target() {
+ make -C utils/keytable CFLAGS="${TARGET_CFLAGS}"
+ make -C utils/ir-ctl CFLAGS="${TARGET_CFLAGS}"
+ if [ "${CEC_FRAMEWORK_SUPPORT}" = "yes" ]; then
+ make -C utils/libcecutil CFLAGS="${TARGET_CFLAGS}"
+ make -C utils/cec-ctl CFLAGS="${TARGET_CFLAGS}"
+ fi
+ make -C lib CFLAGS="${TARGET_CFLAGS}"
+ make -C utils/dvb CFLAGS="${TARGET_CFLAGS}"
+ make -C utils/v4l2-ctl CFLAGS="${TARGET_CFLAGS}"
+
+ if [ "${LIBREELEC_VERSION}" == "devel" ]; then
+ make -C utils/v4l2-compliance CFLAGS="${TARGET_CFLAGS}"
+ fi
+}
+
+makeinstall_target() {
+ make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/keytable
+ make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/ir-ctl
+ if [ "${CEC_FRAMEWORK_SUPPORT}" = "yes" ]; then
+ make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/cec-ctl
+ fi
+ make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/dvb
+ make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/v4l2-ctl
+
+ if [ "${LIBREELEC_VERSION}" == "devel" ]; then
+ make install DESTDIR=${INSTALL} PREFIX=/usr -C utils/v4l2-compliance
+ fi
+
+ cp ${PKG_BUILD}/contrib/lircd2toml.py ${INSTALL}/usr/bin/
+}
+
+create_multi_keymap() {
+ local f name map
+ name="${1}"
+ shift 1
+ (
+ for f in "$@"; do
+ map="${INSTALL}/usr/lib/udev/rc_keymaps/${f}.toml"
+ [ -e "${map}" ] && cat "${map}"
+ done
+ ) > ${INSTALL}/usr/lib/udev/rc_keymaps/${name}.toml
+}
+
+post_makeinstall_target() {
+ local f keymap
+
+ rm -rf ${INSTALL}/etc/rc_keymaps
+ ln -sf /storage/.config/rc_keymaps ${INSTALL}/etc/rc_keymaps
+
+ mkdir -p ${INSTALL}/usr/config
+ cp -PR ${PKG_DIR}/config/* ${INSTALL}/usr/config
+
+ rm -rf ${INSTALL}/usr/lib/udev/rules.d
+ mkdir -p ${INSTALL}/usr/lib/udev/rules.d
+ cp -PR ${PKG_DIR}/udev.d/*.rules ${INSTALL}/usr/lib/udev/rules.d
+
+ # install additional keymaps without overwriting upstream maps
+ (
+ set -C
+ for f in ${PKG_DIR}/keymaps/*; do
+ if [ -e ${f} ]; then
+ keymap=$(basename ${f})
+ cat ${f} > ${INSTALL}/usr/lib/udev/rc_keymaps/${keymap}
+ fi
+ done
+ )
+
+ # create multi keymap to support several remotes OOTB
+ if [ -n "${IR_REMOTE_KEYMAPS}" ]; then
+ create_multi_keymap libreelec_multi ${IR_REMOTE_KEYMAPS}
+
+ # use multi-keymap instead of default one
+ sed -i '/^\*\s*rc-rc6-mce\s*rc6_mce/d' ${INSTALL}/etc/rc_maps.cfg
+
+ cat << EOF >> ${INSTALL}/etc/rc_maps.cfg
+#
+# Custom LibreELEC configuration starts here
+#
+# use combined multi-table on MCE receivers
+# * rc-rc6-mce rc6_mce.toml
+* rc-rc6-mce libreelec_multi.toml
+# multi-table for amlogic devices
+meson-ir rc-empty libreelec_multi.toml
+EOF
+
+ fi
+}
diff --git a/projects/L4T/packages/v4l-utils/patches/v4l-utils-001-disable-doxygen-in-automake.patch b/projects/L4T/packages/v4l-utils/patches/v4l-utils-001-disable-doxygen-in-automake.patch
new file mode 100644
index 00000000000..c67b92d1604
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/patches/v4l-utils-001-disable-doxygen-in-automake.patch
@@ -0,0 +1,26 @@
+From 137dd2edea4d6c70b10caebebed4778716070ed2 Mon Sep 17 00:00:00 2001
+From: Matthias Reichl
+Date: Sun, 9 Feb 2020 00:16:29 +0100
+Subject: [PATCH] don't include doxygen autotools include
+
+Signed-off-by: Matthias Reichl
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index d20dfe0f..05dc8c1a 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -11,7 +11,7 @@ EXTRA_DIST = android-config.h bootstrap.sh doxygen_libdvbv5.cfg include COPYING.
+ COPYING.libdvbv5 README.libv4l README.lib-multi-threading TODO.libdvbv5 \
+ doc/libdvbv5-index.doc
+
+-include $(top_srcdir)/aminclude.am
++# include $(top_srcdir)/aminclude.am
+
+ # custom targets
+
+--
+2.20.1
+
diff --git a/projects/L4T/packages/v4l-utils/patches/v4l-utils-002-enable-bpf-without-clang.patch b/projects/L4T/packages/v4l-utils/patches/v4l-utils-002-enable-bpf-without-clang.patch
new file mode 100644
index 00000000000..79d8c328e26
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/patches/v4l-utils-002-enable-bpf-without-clang.patch
@@ -0,0 +1,40 @@
+From ff65aa88a1ff3f02cc10e5a6e2af865b0c97f4fc Mon Sep 17 00:00:00 2001
+From: Matthias Reichl
+Date: Sat, 8 Feb 2020 21:42:06 +0100
+Subject: [PATCH] disable bpf decoder build and drop bpf dependency on clang
+
+Signed-off-by: Matthias Reichl
+---
+ configure.ac | 2 +-
+ utils/keytable/Makefile.am | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 3bb1d2a5..7b633473 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -549,7 +549,7 @@ AM_CONDITIONAL([WITH_V4L2_CTL_32], [test x${enable_v4l2_ctl_32} = xyes])
+ AM_CONDITIONAL([WITH_V4L2_COMPLIANCE], [test x$ac_cv_func_fork = xyes])
+ AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_libv4l} != xno])
+ AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_32], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_32} = xyes])
+-AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang])
++AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes])
+
+ # append -static to libtool compile and link command to enforce static libs
+ AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])])
+diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am
+index 4724897e..1c209fe2 100644
+--- a/utils/keytable/Makefile.am
++++ b/utils/keytable/Makefile.am
+@@ -18,7 +18,7 @@ ir_keytable_LDFLAGS = $(ARGP_LIBS)
+
+ if WITH_BPF
+ ir_keytable_LDFLAGS += $(LIBELF_LIBS)
+-SUBDIRS = bpf_protocols
++# SUBDIRS = bpf_protocols
+ endif
+
+ EXTRA_DIST = 70-infrared.rules 50-rc_keymap.conf rc_keymaps rc_keymaps_userspace gen_input_events.pl gen_keytables.pl ir-keytable.1 rc_maps.cfg rc_keymap.5
+--
+2.20.1
+
diff --git a/projects/L4T/packages/v4l-utils/udev.d/70-infrared.rules b/projects/L4T/packages/v4l-utils/udev.d/70-infrared.rules
new file mode 100644
index 00000000000..26728303b35
--- /dev/null
+++ b/projects/L4T/packages/v4l-utils/udev.d/70-infrared.rules
@@ -0,0 +1,19 @@
+
+# Automatically load the proper keymaps after the Remote Controller device
+# creation.
+#
+# User-defined rules can be stored in /storage/.config/rc_maps.cfg. If that
+# file doesn't exist the default rules from /etc/rc_maps.cfg are used.
+
+ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="rc", ENV{.rc_sysdev}="$id", GOTO="begin"
+GOTO="end"
+
+LABEL="begin"
+
+ENV{.rc_maps_cfg}="/etc/rc_maps.cfg"
+TEST=="/storage/.config/rc_maps.cfg", ENV{.rc_maps_cfg}="/storage/.config/rc_maps.cfg"
+
+RUN+="/usr/bin/ir-keytable -a $env{.rc_maps_cfg} -s $env{.rc_sysdev}"
+
+LABEL="end"
+
diff --git a/projects/L4T/packages/wpa_supplicant/config/makefile.config b/projects/L4T/packages/wpa_supplicant/config/makefile.config
new file mode 100644
index 00000000000..5c984339696
--- /dev/null
+++ b/projects/L4T/packages/wpa_supplicant/config/makefile.config
@@ -0,0 +1,35 @@
+CONFIG_CTRL_IFACE=y
+CONFIG_CTRL_IFACE_DBUS=y
+CONFIG_CTRL_IFACE_DBUS_NEW=y
+CONFIG_CTRL_IFACE_DBUS_INTRO=y
+CONFIG_DRIVER_WEXT=y
+CONFIG_LIBNL32=y
+CONFIG_DRIVER_NL80211=y
+CONFIG_DRIVER_WIRED=y
+CONFIG_IEEE8021X_EAPOL=y
+CONFIG_EAP_MD5=y
+CONFIG_EAP_MSCHAPV2=y
+CONFIG_EAP_TLS=y
+CONFIG_EAP_PEAP=y
+CONFIG_EAP_TTLS=y
+CONFIG_EAP_PSK=y
+CONFIG_EAP_FAST=y
+CONFIG_EAP_GTC=y
+CONFIG_EAP_OTP=y
+CONFIG_EAP_AKA=y
+CONFIG_EAP_PAX=y
+CONFIG_EAP_LEAP=y
+CONFIG_EAP_SAKE=y
+CONFIG_EAP_GPSK=y
+CONFIG_EAP_GPSK_SHA256=y
+CONFIG_EAP_TNC=y
+CONFIG_WPS=y
+CONFIG_EAP_IKEV2=y
+CONFIG_PKCS12=y
+CONFIG_SMARTCARD=y
+CONFIG_DEBUG_FILE=y
+CONFIG_BACKEND=file
+CONFIG_PEERKEY=y
+CONFIG_BGSCAN_SIMPLE=y
+CONFIG_AP=y
+#CONFIG_FIPS=y
\ No newline at end of file
diff --git a/projects/L4T/packages/wpa_supplicant/package.mk b/projects/L4T/packages/wpa_supplicant/package.mk
new file mode 100644
index 00000000000..ecb27d82f28
--- /dev/null
+++ b/projects/L4T/packages/wpa_supplicant/package.mk
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
+
+PKG_NAME="wpa_supplicant"
+PKG_VERSION="2.10"
+PKG_SHA256="20df7ae5154b3830355f8ab4269123a87affdea59fe74fe9292a91d0d7e17b2f"
+PKG_LICENSE="GPL"
+PKG_SITE="https://w1.fi/wpa_supplicant/"
+PKG_URL="https://w1.fi/releases/${PKG_NAME}-${PKG_VERSION}.tar.gz"
+PKG_DEPENDS_TARGET="toolchain dbus libnl openssl"
+PKG_LONGDESC="A free software implementation of an IEEE 802.11i supplicant."
+PKG_TOOLCHAIN="make"
+PKG_BUILD_FLAGS="+lto-parallel"
+
+PKG_MAKE_OPTS_TARGET="-C wpa_supplicant V=1 LIBDIR=/usr/lib BINDIR=/usr/bin"
+PKG_MAKEINSTALL_OPTS_TARGET="-C wpa_supplicant V=1 LIBDIR=/usr/lib BINDIR=/usr/bin"
+
+configure_target() {
+ LDFLAGS+=" -lpthread -lm"
+
+ cp ${PKG_DIR}/config/makefile.config wpa_supplicant/.config
+}
+
+post_makeinstall_target() {
+ rm -r ${INSTALL}/usr/bin/wpa_cli
+
+ mkdir -p ${INSTALL}/etc/dbus-1/system.d
+ cp wpa_supplicant/dbus/dbus-wpa_supplicant.conf ${INSTALL}/etc/dbus-1/system.d
+
+ mkdir -p ${INSTALL}/usr/lib/systemd/system
+ cp wpa_supplicant/systemd/wpa_supplicant.service ${INSTALL}/usr/lib/systemd/system
+
+ mkdir -p ${INSTALL}/usr/share/dbus-1/system-services
+ cp wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service ${INSTALL}/usr/share/dbus-1/system-services
+}
diff --git a/projects/L4T/packages/wpa_supplicant/patches/wpa_supplicant-2.4-libnl3-includes.patch b/projects/L4T/packages/wpa_supplicant/patches/wpa_supplicant-2.4-libnl3-includes.patch
new file mode 100644
index 00000000000..56c09ffaee8
--- /dev/null
+++ b/projects/L4T/packages/wpa_supplicant/patches/wpa_supplicant-2.4-libnl3-includes.patch
@@ -0,0 +1,12 @@
+diff -Naur wpa_supplicant-2.4/src/drivers/drivers.mk wpa_supplicant-2.4.patch/src/drivers/drivers.mk
+--- wpa_supplicant-2.4/src/drivers/drivers.mk 2015-03-15 18:30:39.000000000 +0100
++++ wpa_supplicant-2.4.patch/src/drivers/drivers.mk 2015-03-17 13:16:01.390789977 +0100
+@@ -35,7 +35,7 @@
+ ifdef CONFIG_LIBNL32
+ DRV_LIBS += -lnl-3
+ DRV_LIBS += -lnl-genl-3
+- DRV_CFLAGS += -I/usr/include/libnl3
++ DRV_CFLAGS += `pkg-config --cflags libnl-3.0`
+ ifdef CONFIG_LIBNL3_ROUTE
+ DRV_LIBS += -lnl-route-3
+ DRV_CFLAGS += -DCONFIG_LIBNL3_ROUTE
diff --git a/projects/L4T/packages/xf86-input-libinput/package.mk b/projects/L4T/packages/xf86-input-libinput/package.mk
new file mode 100644
index 00000000000..bb2fc0c8e36
--- /dev/null
+++ b/projects/L4T/packages/xf86-input-libinput/package.mk
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
+# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
+
+PKG_NAME="xf86-input-libinput"
+PKG_VERSION="1.3.0"
+PKG_SHA256="1446ba20a22bc968b5a4a0b4dbc3b8e037c50d9c59ac75fa3f7fc506c58c1abb"
+PKG_LICENSE="MIT"
+PKG_SITE="https://www.freedesktop.org/wiki/Software/libinput/"
+PKG_URL="https://xorg.freedesktop.org/archive/individual/driver/${PKG_NAME}-${PKG_VERSION}.tar.xz"
+PKG_DEPENDS_TARGET="toolchain libinput xorg-server"
+PKG_LONGDESC="This is an X driver based on libinput."
+PKG_TOOLCHAIN="autotools"
+
+PKG_CONFIGURE_OPTS_TARGET="--with-xorg-module-dir=${XORG_PATH_MODULES}"
+
+[ "${DEVICE}" = "Switch" -o "${DEVICE}" = "Odin" ] && PKG_DEPENDS_TARGET+=" xorg-server" || true
+
+post_makeinstall_target() {
+ mkdir -p ${INSTALL}/usr/share/X11/xorg.conf.d
+ cp ${PKG_BUILD}/conf/*-libinput.conf ${INSTALL}/usr/share/X11/xorg.conf.d
+}
diff --git a/projects/L4T/packages/xorg-server/package.mk b/projects/L4T/packages/xorg-server/package.mk
index e871728d2fb..3ac8e7384d2 100644
--- a/projects/L4T/packages/xorg-server/package.mk
+++ b/projects/L4T/packages/xorg-server/package.mk
@@ -125,7 +125,7 @@ pre_configure_target() {
CFLAGS=$(echo ${CFLAGS} | sed -e "s|-O3|-O2|" -e "s|-Ofast|-O2|")
LDFLAGS=$(echo ${LDFLAGS} | sed -e "s|-O3|-O2|" -e "s|-Ofast|-O2|")
if [ "${PROJECT}" = "L4T" ]; then
- CFLAGS+=" -g"
+ CFLAGS+=" -g -Wno-error=array-bounds"
fi
}
diff --git a/projects/L4T/packages/xorg-server/patches/xorg-server-0002-hw-rename-boolean-config-value-field-from-bool-to-boolean.patch b/projects/L4T/packages/xorg-server/patches/xorg-server-0002-hw-rename-boolean-config-value-field-from-bool-to-boolean.patch
new file mode 100644
index 00000000000..f608a7bfc78
--- /dev/null
+++ b/projects/L4T/packages/xorg-server/patches/xorg-server-0002-hw-rename-boolean-config-value-field-from-bool-to-boolean.patch
@@ -0,0 +1,153 @@
+From 454b3a826edb5fc6d0fea3a9cfd1a5e8fc568747 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Mon, 22 Jul 2019 13:51:06 -0400
+Subject: [PATCH] hw: Rename boolean config value field from bool to boolean
+
+"bool" conflicts with C++ (meh) and stdbool.h (ngh alright fine). This
+is a driver-visible change and will likely break the build for mach64,
+but it can be fixed by simply using xf86ReturnOptValBool like every
+other driver.
+
+Signed-off-by: Adam Jackson
+---
+ hw/xfree86/common/xf86Opt.h | 2 +-
+ hw/xfree86/common/xf86Option.c | 10 +++++-----
+ hw/xwin/winconfig.c | 22 +++++++++++-----------
+ hw/xwin/winconfig.h | 2 +-
+ 4 files changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
+index 3be2a0fc7e..3046fbd417 100644
+--- a/hw/xfree86/common/xf86Opt.h
++++ b/hw/xfree86/common/xf86Opt.h
+@@ -41,7 +41,7 @@ typedef union {
+ unsigned long num;
+ const char *str;
+ double realnum;
+- Bool bool;
++ Bool boolean;
+ OptFrequency freq;
+ } ValueUnion;
+
+diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
+index 06973bca30..ca538cc576 100644
+--- a/hw/xfree86/common/xf86Option.c
++++ b/hw/xfree86/common/xf86Option.c
+@@ -213,7 +213,7 @@ LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt,
+ o.name = name;
+ o.type = OPTV_BOOLEAN;
+ if (ParseOptionValue(-1, optlist, &o, markUsed))
+- deflt = o.value.bool;
++ deflt = o.value.boolean;
+ return deflt;
+ }
+
+@@ -474,7 +474,7 @@ xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt)
+ static Bool
+ GetBoolValue(OptionInfoPtr p, const char *s)
+ {
+- return xf86getBoolValue(&p->value.bool, s);
++ return xf86getBoolValue(&p->value.boolean, s);
+ }
+
+ static Bool
+@@ -678,7 +678,7 @@ ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
+ if (markUsed)
+ xf86MarkOptionUsedByName(options, newn);
+ if (GetBoolValue(&opt, s)) {
+- p->value.bool = !opt.value.bool;
++ p->value.boolean = !opt.value.boolean;
+ p->found = TRUE;
+ }
+ else {
+@@ -869,7 +869,7 @@ xf86GetOptValBool(const OptionInfoRec * table, int token, Bool *value)
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+- *value = p->value.bool;
++ *value = p->value.boolean;
+ return TRUE;
+ }
+ else
+@@ -883,7 +883,7 @@ xf86ReturnOptValBool(const OptionInfoRec * table, int token, Bool def)
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+- return p->value.bool;
++ return p->value.boolean;
+ }
+ else
+ return def;
+diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
+index 31894d2fb0..646d690062 100644
+--- a/hw/xwin/winconfig.c
++++ b/hw/xwin/winconfig.c
+@@ -623,7 +623,7 @@ winSetBoolOption(void *optlist, const char *name, int deflt)
+ o.name = name;
+ o.type = OPTV_BOOLEAN;
+ if (ParseOptionValue(-1, optlist, &o))
+- deflt = o.value.bool;
++ deflt = o.value.boolean;
+ return deflt;
+ }
+
+@@ -918,7 +918,7 @@ ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p)
+ }
+ if ((s = winFindOptionValue(options, newn)) != NULL) {
+ if (GetBoolValue(&opt, s)) {
+- p->value.bool = !opt.value.bool;
++ p->value.boolean = !opt.value.boolean;
+ p->found = TRUE;
+ }
+ else {
+@@ -968,25 +968,25 @@ static Bool
+ GetBoolValue(OptionInfoPtr p, const char *s)
+ {
+ if (*s == 0) {
+- p->value.bool = TRUE;
++ p->value.boolean = TRUE;
+ }
+ else {
+ if (winNameCompare(s, "1") == 0)
+- p->value.bool = TRUE;
++ p->value.boolean = TRUE;
+ else if (winNameCompare(s, "on") == 0)
+- p->value.bool = TRUE;
++ p->value.boolean = TRUE;
+ else if (winNameCompare(s, "true") == 0)
+- p->value.bool = TRUE;
++ p->value.boolean = TRUE;
+ else if (winNameCompare(s, "yes") == 0)
+- p->value.bool = TRUE;
++ p->value.boolean = TRUE;
+ else if (winNameCompare(s, "0") == 0)
+- p->value.bool = FALSE;
++ p->value.boolean = FALSE;
+ else if (winNameCompare(s, "off") == 0)
+- p->value.bool = FALSE;
++ p->value.boolean = FALSE;
+ else if (winNameCompare(s, "false") == 0)
+- p->value.bool = FALSE;
++ p->value.boolean = FALSE;
+ else if (winNameCompare(s, "no") == 0)
+- p->value.bool = FALSE;
++ p->value.boolean = FALSE;
+ }
+ return TRUE;
+ }
+diff --git a/hw/xwin/winconfig.h b/hw/xwin/winconfig.h
+index f079368c7c..bd1f596509 100644
+--- a/hw/xwin/winconfig.h
++++ b/hw/xwin/winconfig.h
+@@ -199,7 +199,7 @@ typedef union {
+ unsigned long num;
+ char *str;
+ double realnum;
+- Bool bool;
++ Bool boolean;
+ OptFrequency freq;
+ } ValueUnion;
+
+--
+GitLab
+
diff --git a/projects/L4T/patches/linux/0001-add-wireguard-support.patch b/projects/L4T/patches/linux/0001-add-wireguard-support.patch
new file mode 100644
index 00000000000..4e0c4aad085
--- /dev/null
+++ b/projects/L4T/patches/linux/0001-add-wireguard-support.patch
@@ -0,0 +1,51709 @@
+From 75c24563fbd9ee657a0115b098f4c03b6c593efa Mon Sep 17 00:00:00 2001
+From: azkali
+Date: Sun, 24 Apr 2022 20:28:16 +0200
+Subject: [PATCH] net: wireguard: Add support for wireguard in-tree
+
+---
+ arch/arm64/configs/tegra_linux_defconfig | 1 +
+ net/Kconfig | 1 +
+ net/Makefile | 1 +
+ net/wireguard/Kconfig | 33 +
+ net/wireguard/Makefile | 15 +
+ net/wireguard/allowedips.c | 386 +
+ net/wireguard/allowedips.h | 59 +
+ net/wireguard/compat/Makefile.include | 111 +
+ .../compat/checksum/checksum_partial_compat.h | 208 +
+ net/wireguard/compat/compat-asm.h | 89 +
+ net/wireguard/compat/compat.h | 1200 +++
+ net/wireguard/compat/dst_cache/dst_cache.c | 177 +
+ .../compat/dst_cache/include/net/dst_cache.h | 97 +
+ .../dstmetadata/include/net/dst_metadata.h | 3 +
+ .../compat/fpu-x86/include/asm/fpu/api.h | 1 +
+ .../include/asm/intel-family.h | 73 +
+ net/wireguard/compat/memneq/include.h | 5 +
+ net/wireguard/compat/memneq/memneq.c | 170 +
+ .../compat/neon-arm/include/asm/neon.h | 7 +
+ .../compat/ptr_ring/include/linux/ptr_ring.h | 674 ++
+ .../compat/simd-asm/include/asm/simd.h | 21 +
+ .../compat/simd/include/linux/simd.h | 69 +
+ .../compat/siphash/include/linux/siphash.h | 134 +
+ net/wireguard/compat/siphash/siphash.c | 539 +
+ .../skb_array/include/linux/skb_array.h | 11 +
+ .../udp_tunnel/include/net/udp_tunnel.h | 94 +
+ net/wireguard/compat/udp_tunnel/udp_tunnel.c | 396 +
+ .../udp_tunnel/udp_tunnel_partial_compat.h | 226 +
+ net/wireguard/compat/version/linux/version.h | 10 +
+ net/wireguard/cookie.c | 236 +
+ net/wireguard/cookie.h | 59 +
+ net/wireguard/crypto/Makefile.include | 57 +
+ net/wireguard/crypto/include/zinc/blake2s.h | 56 +
+ net/wireguard/crypto/include/zinc/chacha20.h | 70 +
+ .../crypto/include/zinc/chacha20poly1305.h | 50 +
+ .../crypto/include/zinc/curve25519.h | 28 +
+ net/wireguard/crypto/include/zinc/poly1305.h | 31 +
+ net/wireguard/crypto/zinc.h | 15 +
+ .../crypto/zinc/blake2s/blake2s-x86_64-glue.c | 72 +
+ .../crypto/zinc/blake2s/blake2s-x86_64.S | 258 +
+ net/wireguard/crypto/zinc/blake2s/blake2s.c | 271 +
+ .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 +
+ .../crypto/zinc/chacha20/chacha20-arm.pl | 1227 +++
+ .../crypto/zinc/chacha20/chacha20-arm64.pl | 1163 +++
+ .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 +
+ .../crypto/zinc/chacha20/chacha20-mips.S | 424 +
+ .../zinc/chacha20/chacha20-unrolled-arm.S | 461 +
+ .../zinc/chacha20/chacha20-x86_64-glue.c | 105 +
+ .../crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ++++++++
+ net/wireguard/crypto/zinc/chacha20/chacha20.c | 191 +
+ net/wireguard/crypto/zinc/chacha20poly1305.c | 398 +
+ .../zinc/curve25519/curve25519-arm-glue.c | 43 +
+ .../crypto/zinc/curve25519/curve25519-arm.S | 2064 ++++
+ .../zinc/curve25519/curve25519-fiat32.c | 860 ++
+ .../zinc/curve25519/curve25519-hacl64.c | 779 ++
+ .../zinc/curve25519/curve25519-x86_64-glue.c | 44 +
+ .../zinc/curve25519/curve25519-x86_64.c | 1580 +++
+ .../crypto/zinc/curve25519/curve25519.c | 109 +
+ .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 +
+ .../crypto/zinc/poly1305/poly1305-arm.pl | 1276 +++
+ .../crypto/zinc/poly1305/poly1305-arm64.pl | 974 ++
+ .../crypto/zinc/poly1305/poly1305-donna32.c | 205 +
+ .../crypto/zinc/poly1305/poly1305-donna64.c | 182 +
+ .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 +
+ .../crypto/zinc/poly1305/poly1305-mips.S | 407 +
+ .../crypto/zinc/poly1305/poly1305-mips64.pl | 467 +
+ .../zinc/poly1305/poly1305-x86_64-glue.c | 156 +
+ .../crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ++++++++
+ net/wireguard/crypto/zinc/poly1305/poly1305.c | 165 +
+ net/wireguard/crypto/zinc/selftest/blake2s.c | 2090 ++++
+ net/wireguard/crypto/zinc/selftest/chacha20.c | 2698 +++++
+ .../crypto/zinc/selftest/chacha20poly1305.c | 9076 +++++++++++++++++
+ .../crypto/zinc/selftest/curve25519.c | 1315 +++
+ net/wireguard/crypto/zinc/selftest/poly1305.c | 1107 ++
+ net/wireguard/crypto/zinc/selftest/run.h | 48 +
+ net/wireguard/device.c | 475 +
+ net/wireguard/device.h | 62 +
+ net/wireguard/main.c | 84 +
+ net/wireguard/messages.h | 128 +
+ net/wireguard/netlink.c | 658 ++
+ net/wireguard/netlink.h | 12 +
+ net/wireguard/noise.c | 830 ++
+ net/wireguard/noise.h | 135 +
+ net/wireguard/peer.c | 240 +
+ net/wireguard/peer.h | 86 +
+ net/wireguard/peerlookup.c | 226 +
+ net/wireguard/peerlookup.h | 64 +
+ net/wireguard/queueing.c | 108 +
+ net/wireguard/queueing.h | 217 +
+ net/wireguard/ratelimiter.c | 235 +
+ net/wireguard/ratelimiter.h | 19 +
+ net/wireguard/receive.c | 602 ++
+ net/wireguard/selftest/allowedips.c | 676 ++
+ net/wireguard/selftest/counter.c | 111 +
+ net/wireguard/selftest/ratelimiter.c | 226 +
+ net/wireguard/send.c | 420 +
+ net/wireguard/socket.c | 437 +
+ net/wireguard/socket.h | 44 +
+ net/wireguard/timers.c | 243 +
+ net/wireguard/timers.h | 31 +
+ net/wireguard/uapi/wireguard.h | 196 +
+ net/wireguard/version.h | 3 +
+ 102 files changed, 50870 insertions(+)
+ create mode 100644 net/wireguard/Kconfig
+ create mode 100644 net/wireguard/Makefile
+ create mode 100644 net/wireguard/allowedips.c
+ create mode 100644 net/wireguard/allowedips.h
+ create mode 100644 net/wireguard/compat/Makefile.include
+ create mode 100644 net/wireguard/compat/checksum/checksum_partial_compat.h
+ create mode 100644 net/wireguard/compat/compat-asm.h
+ create mode 100644 net/wireguard/compat/compat.h
+ create mode 100644 net/wireguard/compat/dst_cache/dst_cache.c
+ create mode 100644 net/wireguard/compat/dst_cache/include/net/dst_cache.h
+ create mode 100644 net/wireguard/compat/dstmetadata/include/net/dst_metadata.h
+ create mode 100644 net/wireguard/compat/fpu-x86/include/asm/fpu/api.h
+ create mode 100644 net/wireguard/compat/intel-family-x86/include/asm/intel-family.h
+ create mode 100644 net/wireguard/compat/memneq/include.h
+ create mode 100644 net/wireguard/compat/memneq/memneq.c
+ create mode 100644 net/wireguard/compat/neon-arm/include/asm/neon.h
+ create mode 100644 net/wireguard/compat/ptr_ring/include/linux/ptr_ring.h
+ create mode 100644 net/wireguard/compat/simd-asm/include/asm/simd.h
+ create mode 100644 net/wireguard/compat/simd/include/linux/simd.h
+ create mode 100644 net/wireguard/compat/siphash/include/linux/siphash.h
+ create mode 100644 net/wireguard/compat/siphash/siphash.c
+ create mode 100644 net/wireguard/compat/skb_array/include/linux/skb_array.h
+ create mode 100644 net/wireguard/compat/udp_tunnel/include/net/udp_tunnel.h
+ create mode 100644 net/wireguard/compat/udp_tunnel/udp_tunnel.c
+ create mode 100644 net/wireguard/compat/udp_tunnel/udp_tunnel_partial_compat.h
+ create mode 100644 net/wireguard/compat/version/linux/version.h
+ create mode 100644 net/wireguard/cookie.c
+ create mode 100644 net/wireguard/cookie.h
+ create mode 100644 net/wireguard/crypto/Makefile.include
+ create mode 100644 net/wireguard/crypto/include/zinc/blake2s.h
+ create mode 100644 net/wireguard/crypto/include/zinc/chacha20.h
+ create mode 100644 net/wireguard/crypto/include/zinc/chacha20poly1305.h
+ create mode 100644 net/wireguard/crypto/include/zinc/curve25519.h
+ create mode 100644 net/wireguard/crypto/include/zinc/poly1305.h
+ create mode 100644 net/wireguard/crypto/zinc.h
+ create mode 100644 net/wireguard/crypto/zinc/blake2s/blake2s-x86_64-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/blake2s/blake2s-x86_64.S
+ create mode 100644 net/wireguard/crypto/zinc/blake2s/blake2s.c
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-arm-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-arm.pl
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-arm64.pl
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-mips-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-mips.S
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-unrolled-arm.S
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-x86_64-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20-x86_64.pl
+ create mode 100644 net/wireguard/crypto/zinc/chacha20/chacha20.c
+ create mode 100644 net/wireguard/crypto/zinc/chacha20poly1305.c
+ create mode 100644 net/wireguard/crypto/zinc/curve25519/curve25519-arm-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/curve25519/curve25519-arm.S
+ create mode 100644 net/wireguard/crypto/zinc/curve25519/curve25519-fiat32.c
+ create mode 100644 net/wireguard/crypto/zinc/curve25519/curve25519-hacl64.c
+ create mode 100644 net/wireguard/crypto/zinc/curve25519/curve25519-x86_64-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/curve25519/curve25519-x86_64.c
+ create mode 100644 net/wireguard/crypto/zinc/curve25519/curve25519.c
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-arm-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-arm.pl
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-arm64.pl
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-donna32.c
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-donna64.c
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-mips-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-mips.S
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-mips64.pl
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-x86_64-glue.c
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305-x86_64.pl
+ create mode 100644 net/wireguard/crypto/zinc/poly1305/poly1305.c
+ create mode 100644 net/wireguard/crypto/zinc/selftest/blake2s.c
+ create mode 100644 net/wireguard/crypto/zinc/selftest/chacha20.c
+ create mode 100644 net/wireguard/crypto/zinc/selftest/chacha20poly1305.c
+ create mode 100644 net/wireguard/crypto/zinc/selftest/curve25519.c
+ create mode 100644 net/wireguard/crypto/zinc/selftest/poly1305.c
+ create mode 100644 net/wireguard/crypto/zinc/selftest/run.h
+ create mode 100644 net/wireguard/device.c
+ create mode 100644 net/wireguard/device.h
+ create mode 100644 net/wireguard/main.c
+ create mode 100644 net/wireguard/messages.h
+ create mode 100644 net/wireguard/netlink.c
+ create mode 100644 net/wireguard/netlink.h
+ create mode 100644 net/wireguard/noise.c
+ create mode 100644 net/wireguard/noise.h
+ create mode 100644 net/wireguard/peer.c
+ create mode 100644 net/wireguard/peer.h
+ create mode 100644 net/wireguard/peerlookup.c
+ create mode 100644 net/wireguard/peerlookup.h
+ create mode 100644 net/wireguard/queueing.c
+ create mode 100644 net/wireguard/queueing.h
+ create mode 100644 net/wireguard/ratelimiter.c
+ create mode 100644 net/wireguard/ratelimiter.h
+ create mode 100644 net/wireguard/receive.c
+ create mode 100644 net/wireguard/selftest/allowedips.c
+ create mode 100644 net/wireguard/selftest/counter.c
+ create mode 100644 net/wireguard/selftest/ratelimiter.c
+ create mode 100644 net/wireguard/send.c
+ create mode 100644 net/wireguard/socket.c
+ create mode 100644 net/wireguard/socket.h
+ create mode 100644 net/wireguard/timers.c
+ create mode 100644 net/wireguard/timers.h
+ create mode 100644 net/wireguard/uapi/wireguard.h
+ create mode 100644 net/wireguard/version.h
+
+diff --git a/arch/arm64/configs/tegra_linux_defconfig b/arch/arm64/configs/tegra_linux_defconfig
+index a4c91c85017f..224b14a95cfb 100644
+--- a/arch/arm64/configs/tegra_linux_defconfig
++++ b/arch/arm64/configs/tegra_linux_defconfig
+@@ -204,6 +204,7 @@ CONFIG_UNIX=y
+ CONFIG_XFRM_USER=y
+ CONFIG_NET_KEY=y
+ CONFIG_INET=y
++CONFIG_WIREGUARD=m
+ CONFIG_IP_MULTICAST=y
+ CONFIG_IP_ADVANCED_ROUTER=y
+ CONFIG_IP_MULTIPLE_TABLES=y
+diff --git a/net/Kconfig b/net/Kconfig
+index 37757600171a..c8605f390276 100644
+--- a/net/Kconfig
++++ b/net/Kconfig
+@@ -83,6 +83,7 @@ config INET
+ Short answer: say Y.
+
+ if INET
++source "net/wireguard/Kconfig"
+ source "net/ipv4/Kconfig"
+ source "net/ipv6/Kconfig"
+ source "net/netlabel/Kconfig"
+diff --git a/net/Makefile b/net/Makefile
+index 4cafaa2b4667..9c7a1aa37143 100644
+--- a/net/Makefile
++++ b/net/Makefile
+@@ -14,6 +14,7 @@ obj-$(CONFIG_NET) += $(tmp-y)
+ obj-$(CONFIG_LLC) += llc/
+ obj-$(CONFIG_NET) += ethernet/ 802/ sched/ netlink/
+ obj-$(CONFIG_NETFILTER) += netfilter/
++obj-$(CONFIG_WIREGUARD) += wireguard/
+ obj-$(CONFIG_INET) += ipv4/
+ obj-$(CONFIG_XFRM) += xfrm/
+ obj-$(CONFIG_UNIX) += unix/
+diff --git a/net/wireguard/Kconfig b/net/wireguard/Kconfig
+new file mode 100644
+index 000000000000..156e9dbfc051
+--- /dev/null
++++ b/net/wireguard/Kconfig
+@@ -0,0 +1,33 @@
++config WIREGUARD
++ tristate "IP: WireGuard secure network tunnel"
++ depends on NET && INET
++ depends on IPV6 || !IPV6
++ select NET_UDP_TUNNEL
++ select DST_CACHE
++ select CRYPTO
++ select CRYPTO_ALGAPI
++ select VFP
++ select VFPv3 if CPU_V7
++ select NEON if CPU_V7
++ select KERNEL_MODE_NEON if CPU_V7
++ default m
++ help
++ WireGuard is a secure, fast, and easy to use replacement for IPsec
++ that uses modern cryptography and clever networking tricks. It's
++ designed to be fairly general purpose and abstract enough to fit most
++ use cases, while at the same time remaining extremely simple to
++ configure. See www.wireguard.com for more info.
++
++ It's safe to say Y or M here, as the driver is very lightweight and
++ is only in use when an administrator chooses to add an interface.
++
++config WIREGUARD_DEBUG
++ bool "Debugging checks and verbose messages"
++ depends on WIREGUARD
++ help
++ This will write log messages for handshake and other events
++ that occur for a WireGuard interface. It will also perform some
++ extra validation checks and unit tests at various points. This is
++ only useful for debugging.
++
++ Say N here unless you know what you're doing.
+diff --git a/net/wireguard/Makefile b/net/wireguard/Makefile
+new file mode 100644
+index 000000000000..c17546eaeedc
+--- /dev/null
++++ b/net/wireguard/Makefile
+@@ -0,0 +1,15 @@
++# SPDX-License-Identifier: GPL-2.0
++#
++# Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++
++ccflags-y := -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt'
++ccflags-y += -Wframe-larger-than=2048
++ccflags-$(CONFIG_WIREGUARD_DEBUG) += -DDEBUG -g
++ccflags-$(if $(WIREGUARD_VERSION),y,) += -D'WIREGUARD_VERSION="$(WIREGUARD_VERSION)"'
++
++wireguard-y := main.o noise.o device.o peer.o timers.o queueing.o send.o receive.o socket.o peerlookup.o allowedips.o ratelimiter.o cookie.o netlink.o
++
++include $(src)/crypto/Makefile.include
++include $(src)/compat/Makefile.include
++
++obj-$(if $(KBUILD_EXTMOD),m,$(CONFIG_WIREGUARD)) := wireguard.o
+diff --git a/net/wireguard/allowedips.c b/net/wireguard/allowedips.c
+new file mode 100644
+index 000000000000..9a4c8ff32d9d
+--- /dev/null
++++ b/net/wireguard/allowedips.c
+@@ -0,0 +1,386 @@
++// SPDX-License-Identifier: GPL-2.0
++/*
++ * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++ */
++
++#include "allowedips.h"
++#include "peer.h"
++
++static struct kmem_cache *node_cache;
++
++static void swap_endian(u8 *dst, const u8 *src, u8 bits)
++{
++ if (bits == 32) {
++ *(u32 *)dst = be32_to_cpu(*(const __be32 *)src);
++ } else if (bits == 128) {
++ ((u64 *)dst)[0] = be64_to_cpu(((const __be64 *)src)[0]);
++ ((u64 *)dst)[1] = be64_to_cpu(((const __be64 *)src)[1]);
++ }
++}
++
++static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src,
++ u8 cidr, u8 bits)
++{
++ node->cidr = cidr;
++ node->bit_at_a = cidr / 8U;
++#ifdef __LITTLE_ENDIAN
++ node->bit_at_a ^= (bits / 8U - 1U) % 8U;
++#endif
++ node->bit_at_b = 7U - (cidr % 8U);
++ node->bitlen = bits;
++ memcpy(node->bits, src, bits / 8U);
++}
++
++static inline u8 choose(struct allowedips_node *node, const u8 *key)
++{
++ return (key[node->bit_at_a] >> node->bit_at_b) & 1;
++}
++
++static void push_rcu(struct allowedips_node **stack,
++ struct allowedips_node __rcu *p, unsigned int *len)
++{
++ if (rcu_access_pointer(p)) {
++ WARN_ON(IS_ENABLED(DEBUG) && *len >= 128);
++ stack[(*len)++] = rcu_dereference_raw(p);
++ }
++}
++
++static void node_free_rcu(struct rcu_head *rcu)
++{
++ kmem_cache_free(node_cache, container_of(rcu, struct allowedips_node, rcu));
++}
++
++static void root_free_rcu(struct rcu_head *rcu)
++{
++ struct allowedips_node *node, *stack[128] = {
++ container_of(rcu, struct allowedips_node, rcu) };
++ unsigned int len = 1;
++
++ while (len > 0 && (node = stack[--len])) {
++ push_rcu(stack, node->bit[0], &len);
++ push_rcu(stack, node->bit[1], &len);
++ kmem_cache_free(node_cache, node);
++ }
++}
++
++static void root_remove_peer_lists(struct allowedips_node *root)
++{
++ struct allowedips_node *node, *stack[128] = { root };
++ unsigned int len = 1;
++
++ while (len > 0 && (node = stack[--len])) {
++ push_rcu(stack, node->bit[0], &len);
++ push_rcu(stack, node->bit[1], &len);
++ if (rcu_access_pointer(node->peer))
++ list_del(&node->peer_list);
++ }
++}
++
++static unsigned int fls128(u64 a, u64 b)
++{
++ return a ? fls64(a) + 64U : fls64(b);
++}
++
++static u8 common_bits(const struct allowedips_node *node, const u8 *key,
++ u8 bits)
++{
++ if (bits == 32)
++ return 32U - fls(*(const u32 *)node->bits ^ *(const u32 *)key);
++ else if (bits == 128)
++ return 128U - fls128(
++ *(const u64 *)&node->bits[0] ^ *(const u64 *)&key[0],
++ *(const u64 *)&node->bits[8] ^ *(const u64 *)&key[8]);
++ return 0;
++}
++
++static bool prefix_matches(const struct allowedips_node *node, const u8 *key,
++ u8 bits)
++{
++ /* This could be much faster if it actually just compared the common
++ * bits properly, by precomputing a mask bswap(~0 << (32 - cidr)), and
++ * the rest, but it turns out that common_bits is already super fast on
++ * modern processors, even taking into account the unfortunate bswap.
++ * So, we just inline it like this instead.
++ */
++ return common_bits(node, key, bits) >= node->cidr;
++}
++
++static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits,
++ const u8 *key)
++{
++ struct allowedips_node *node = trie, *found = NULL;
++
++ while (node && prefix_matches(node, key, bits)) {
++ if (rcu_access_pointer(node->peer))
++ found = node;
++ if (node->cidr == bits)
++ break;
++ node = rcu_dereference_bh(node->bit[choose(node, key)]);
++ }
++ return found;
++}
++
++/* Returns a strong reference to a peer */
++static struct wg_peer *lookup(struct allowedips_node __rcu *root, u8 bits,
++ const void *be_ip)
++{
++ /* Aligned so it can be passed to fls/fls64 */
++ u8 ip[16] __aligned(__alignof(u64));
++ struct allowedips_node *node;
++ struct wg_peer *peer = NULL;
++
++ swap_endian(ip, be_ip, bits);
++
++ rcu_read_lock_bh();
++retry:
++ node = find_node(rcu_dereference_bh(root), bits, ip);
++ if (node) {
++ peer = wg_peer_get_maybe_zero(rcu_dereference_bh(node->peer));
++ if (!peer)
++ goto retry;
++ }
++ rcu_read_unlock_bh();
++ return peer;
++}
++
++static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key,
++ u8 cidr, u8 bits, struct allowedips_node **rnode,
++ struct mutex *lock)
++{
++ struct allowedips_node *node = rcu_dereference_protected(trie, lockdep_is_held(lock));
++ struct allowedips_node *parent = NULL;
++ bool exact = false;
++
++ while (node && node->cidr <= cidr && prefix_matches(node, key, bits)) {
++ parent = node;
++ if (parent->cidr == cidr) {
++ exact = true;
++ break;
++ }
++ node = rcu_dereference_protected(parent->bit[choose(parent, key)], lockdep_is_held(lock));
++ }
++ *rnode = parent;
++ return exact;
++}
++
++static inline void connect_node(struct allowedips_node __rcu **parent, u8 bit, struct allowedips_node *node)
++{
++ node->parent_bit_packed = (unsigned long)parent | bit;
++ rcu_assign_pointer(*parent, node);
++}
++
++static inline void choose_and_connect_node(struct allowedips_node *parent, struct allowedips_node *node)
++{
++ u8 bit = choose(parent, node->bits);
++ connect_node(&parent->bit[bit], bit, node);
++}
++
++static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
++ u8 cidr, struct wg_peer *peer, struct mutex *lock)
++{
++ struct allowedips_node *node, *parent, *down, *newnode;
++
++ if (unlikely(cidr > bits || !peer))
++ return -EINVAL;
++
++ if (!rcu_access_pointer(*trie)) {
++ node = kmem_cache_zalloc(node_cache, GFP_KERNEL);
++ if (unlikely(!node))
++ return -ENOMEM;
++ RCU_INIT_POINTER(node->peer, peer);
++ list_add_tail(&node->peer_list, &peer->allowedips_list);
++ copy_and_assign_cidr(node, key, cidr, bits);
++ connect_node(trie, 2, node);
++ return 0;
++ }
++ if (node_placement(*trie, key, cidr, bits, &node, lock)) {
++ rcu_assign_pointer(node->peer, peer);
++ list_move_tail(&node->peer_list, &peer->allowedips_list);
++ return 0;
++ }
++
++ newnode = kmem_cache_zalloc(node_cache, GFP_KERNEL);
++ if (unlikely(!newnode))
++ return -ENOMEM;
++ RCU_INIT_POINTER(newnode->peer, peer);
++ list_add_tail(&newnode->peer_list, &peer->allowedips_list);
++ copy_and_assign_cidr(newnode, key, cidr, bits);
++
++ if (!node) {
++ down = rcu_dereference_protected(*trie, lockdep_is_held(lock));
++ } else {
++ const u8 bit = choose(node, key);
++ down = rcu_dereference_protected(node->bit[bit], lockdep_is_held(lock));
++ if (!down) {
++ connect_node(&node->bit[bit], bit, newnode);
++ return 0;
++ }
++ }
++ cidr = min(cidr, common_bits(down, key, bits));
++ parent = node;
++
++ if (newnode->cidr == cidr) {
++ choose_and_connect_node(newnode, down);
++ if (!parent)
++ connect_node(trie, 2, newnode);
++ else
++ choose_and_connect_node(parent, newnode);
++ return 0;
++ }
++
++ node = kmem_cache_zalloc(node_cache, GFP_KERNEL);
++ if (unlikely(!node)) {
++ list_del(&newnode->peer_list);
++ kmem_cache_free(node_cache, newnode);
++ return -ENOMEM;
++ }
++ INIT_LIST_HEAD(&node->peer_list);
++ copy_and_assign_cidr(node, newnode->bits, cidr, bits);
++
++ choose_and_connect_node(node, down);
++ choose_and_connect_node(node, newnode);
++ if (!parent)
++ connect_node(trie, 2, node);
++ else
++ choose_and_connect_node(parent, node);
++ return 0;
++}
++
++void wg_allowedips_init(struct allowedips *table)
++{
++ table->root4 = table->root6 = NULL;
++ table->seq = 1;
++}
++
++void wg_allowedips_free(struct allowedips *table, struct mutex *lock)
++{
++ struct allowedips_node __rcu *old4 = table->root4, *old6 = table->root6;
++
++ ++table->seq;
++ RCU_INIT_POINTER(table->root4, NULL);
++ RCU_INIT_POINTER(table->root6, NULL);
++ if (rcu_access_pointer(old4)) {
++ struct allowedips_node *node = rcu_dereference_protected(old4,
++ lockdep_is_held(lock));
++
++ root_remove_peer_lists(node);
++ call_rcu(&node->rcu, root_free_rcu);
++ }
++ if (rcu_access_pointer(old6)) {
++ struct allowedips_node *node = rcu_dereference_protected(old6,
++ lockdep_is_held(lock));
++
++ root_remove_peer_lists(node);
++ call_rcu(&node->rcu, root_free_rcu);
++ }
++}
++
++int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
++ u8 cidr, struct wg_peer *peer, struct mutex *lock)
++{
++ /* Aligned so it can be passed to fls */
++ u8 key[4] __aligned(__alignof(u32));
++
++ ++table->seq;
++ swap_endian(key, (const u8 *)ip, 32);
++ return add(&table->root4, 32, key, cidr, peer, lock);
++}
++
++int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
++ u8 cidr, struct wg_peer *peer, struct mutex *lock)
++{
++ /* Aligned so it can be passed to fls64 */
++ u8 key[16] __aligned(__alignof(u64));
++
++ ++table->seq;
++ swap_endian(key, (const u8 *)ip, 128);
++ return add(&table->root6, 128, key, cidr, peer, lock);
++}
++
++void wg_allowedips_remove_by_peer(struct allowedips *table,
++ struct wg_peer *peer, struct mutex *lock)
++{
++ struct allowedips_node *node, *child, **parent_bit, *parent, *tmp;
++ bool free_parent;
++
++ if (list_empty(&peer->allowedips_list))
++ return;
++ ++table->seq;
++ list_for_each_entry_safe(node, tmp, &peer->allowedips_list, peer_list) {
++ list_del_init(&node->peer_list);
++ RCU_INIT_POINTER(node->peer, NULL);
++ if (node->bit[0] && node->bit[1])
++ continue;
++ child = rcu_dereference_protected(node->bit[!rcu_access_pointer(node->bit[0])],
++ lockdep_is_held(lock));
++ if (child)
++ child->parent_bit_packed = node->parent_bit_packed;
++ parent_bit = (struct allowedips_node **)(node->parent_bit_packed & ~3UL);
++ *parent_bit = child;
++ parent = (void *)parent_bit -
++ offsetof(struct allowedips_node, bit[node->parent_bit_packed & 1]);
++ free_parent = !rcu_access_pointer(node->bit[0]) &&
++ !rcu_access_pointer(node->bit[1]) &&
++ (node->parent_bit_packed & 3) <= 1 &&
++ !rcu_access_pointer(parent->peer);
++ if (free_parent)
++ child = rcu_dereference_protected(
++ parent->bit[!(node->parent_bit_packed & 1)],
++ lockdep_is_held(lock));
++ call_rcu(&node->rcu, node_free_rcu);
++ if (!free_parent)
++ continue;
++ if (child)
++ child->parent_bit_packed = parent->parent_bit_packed;
++ *(struct allowedips_node **)(parent->parent_bit_packed & ~3UL) = child;
++ call_rcu(&parent->rcu, node_free_rcu);
++ }
++}
++
++int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr)
++{
++ const unsigned int cidr_bytes = DIV_ROUND_UP(node->cidr, 8U);
++ swap_endian(ip, node->bits, node->bitlen);
++ memset(ip + cidr_bytes, 0, node->bitlen / 8U - cidr_bytes);
++ if (node->cidr)
++ ip[cidr_bytes - 1U] &= ~0U << (-node->cidr % 8U);
++
++ *cidr = node->cidr;
++ return node->bitlen == 32 ? AF_INET : AF_INET6;
++}
++
++/* Returns a strong reference to a peer */
++struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table,
++ struct sk_buff *skb)
++{
++ if (skb->protocol == htons(ETH_P_IP))
++ return lookup(table->root4, 32, &ip_hdr(skb)->daddr);
++ else if (skb->protocol == htons(ETH_P_IPV6))
++ return lookup(table->root6, 128, &ipv6_hdr(skb)->daddr);
++ return NULL;
++}
++
++/* Returns a strong reference to a peer */
++struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table,
++ struct sk_buff *skb)
++{
++ if (skb->protocol == htons(ETH_P_IP))
++ return lookup(table->root4, 32, &ip_hdr(skb)->saddr);
++ else if (skb->protocol == htons(ETH_P_IPV6))
++ return lookup(table->root6, 128, &ipv6_hdr(skb)->saddr);
++ return NULL;
++}
++
++int __init wg_allowedips_slab_init(void)
++{
++ node_cache = KMEM_CACHE(allowedips_node, 0);
++ return node_cache ? 0 : -ENOMEM;
++}
++
++void wg_allowedips_slab_uninit(void)
++{
++ rcu_barrier();
++ kmem_cache_destroy(node_cache);
++}
++
++#include "selftest/allowedips.c"
+diff --git a/net/wireguard/allowedips.h b/net/wireguard/allowedips.h
+new file mode 100644
+index 000000000000..2346c797eb4d
+--- /dev/null
++++ b/net/wireguard/allowedips.h
+@@ -0,0 +1,59 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++/*
++ * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++ */
++
++#ifndef _WG_ALLOWEDIPS_H
++#define _WG_ALLOWEDIPS_H
++
++#include
++#include
++#include
++
++struct wg_peer;
++
++struct allowedips_node {
++ struct wg_peer __rcu *peer;
++ struct allowedips_node __rcu *bit[2];
++ u8 cidr, bit_at_a, bit_at_b, bitlen;
++ u8 bits[16] __aligned(__alignof(u64));
++
++ /* Keep rarely used members at bottom to be beyond cache line. */
++ unsigned long parent_bit_packed;
++ union {
++ struct list_head peer_list;
++ struct rcu_head rcu;
++ };
++};
++
++struct allowedips {
++ struct allowedips_node __rcu *root4;
++ struct allowedips_node __rcu *root6;
++ u64 seq;
++} __aligned(4); /* We pack the lower 2 bits of &root, but m68k only gives 16-bit alignment. */
++
++void wg_allowedips_init(struct allowedips *table);
++void wg_allowedips_free(struct allowedips *table, struct mutex *mutex);
++int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
++ u8 cidr, struct wg_peer *peer, struct mutex *lock);
++int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
++ u8 cidr, struct wg_peer *peer, struct mutex *lock);
++void wg_allowedips_remove_by_peer(struct allowedips *table,
++ struct wg_peer *peer, struct mutex *lock);
++/* The ip input pointer should be __aligned(__alignof(u64))) */
++int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr);
++
++/* These return a strong reference to a peer: */
++struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table,
++ struct sk_buff *skb);
++struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table,
++ struct sk_buff *skb);
++
++#ifdef DEBUG
++bool wg_allowedips_selftest(void);
++#endif
++
++int wg_allowedips_slab_init(void);
++void wg_allowedips_slab_uninit(void);
++
++#endif /* _WG_ALLOWEDIPS_H */
+diff --git a/net/wireguard/compat/Makefile.include b/net/wireguard/compat/Makefile.include
+new file mode 100644
+index 000000000000..df7670ae8d6c
+--- /dev/null
++++ b/net/wireguard/compat/Makefile.include
+@@ -0,0 +1,111 @@
++# SPDX-License-Identifier: GPL-2.0
++#
++# Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++
++kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
++
++ccflags-y += -include $(kbuild-dir)/compat/compat.h
++asflags-y += -include $(kbuild-dir)/compat/compat-asm.h
++LINUXINCLUDE := -DCOMPAT_VERSION=$(VERSION) -DCOMPAT_PATCHLEVEL=$(PATCHLEVEL) -DCOMPAT_SUBLEVEL=$(SUBLEVEL) -I$(kbuild-dir)/compat/version $(LINUXINCLUDE)
++
++ifeq ($(wildcard $(srctree)/include/linux/ptr_ring.h),)
++ccflags-y += -I$(kbuild-dir)/compat/ptr_ring/include
++endif
++
++ifeq ($(wildcard $(srctree)/include/linux/skb_array.h),)
++ccflags-y += -I$(kbuild-dir)/compat/skb_array/include
++endif
++
++ifeq ($(wildcard $(srctree)/include/linux/siphash.h),)
++ccflags-y += -I$(kbuild-dir)/compat/siphash/include
++wireguard-y += compat/siphash/siphash.o
++endif
++
++ifeq ($(wildcard $(srctree)/include/net/dst_cache.h),)
++ccflags-y += -I$(kbuild-dir)/compat/dst_cache/include
++wireguard-y += compat/dst_cache/dst_cache.o
++endif
++
++ifeq ($(wildcard $(srctree)/arch/x86/include/asm/intel-family.h)$(CONFIG_X86),y)
++ccflags-y += -I$(kbuild-dir)/compat/intel-family-x86/include
++endif
++
++ifeq ($(wildcard $(srctree)/arch/x86/include/asm/fpu/api.h)$(CONFIG_X86),y)
++ccflags-y += -I$(kbuild-dir)/compat/fpu-x86/include
++endif
++
++ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/simd.h)$(shell grep -s -F "generic-y += simd.h" "$(srctree)/arch/$(SRCARCH)/Makefile" "$(srctree)/arch/$(SRCARCH)/Makefile"),)
++ccflags-y += -I$(kbuild-dir)/compat/simd-asm/include
++endif
++
++ifeq ($(wildcard $(srctree)/include/linux/simd.h),)
++ccflags-y += -I$(kbuild-dir)/compat/simd/include
++endif
++
++ifeq ($(wildcard $(srctree)/include/net/udp_tunnel.h),)
++ccflags-y += -I$(kbuild-dir)/compat/udp_tunnel/include
++wireguard-y += compat/udp_tunnel/udp_tunnel.o
++endif
++
++ifeq ($(shell grep -s -F "int crypto_memneq" "$(srctree)/include/crypto/algapi.h"),)
++ccflags-y += -include $(kbuild-dir)/compat/memneq/include.h
++wireguard-y += compat/memneq/memneq.o
++endif
++
++ifeq ($(shell grep -s -F "addr_gen_mode" "$(srctree)/include/linux/ipv6.h"),)
++ccflags-y += -DCOMPAT_CANNOT_USE_DEV_CNF
++endif
++
++ifdef CONFIG_HZ
++ifeq ($(wildcard $(CURDIR)/include/generated/timeconst.h),)
++ccflags-y += $(shell bash -c '((a=$(CONFIG_HZ), b=1000000)); while ((b > 0)); do ((t=b, b=a%b, a=t)); done; echo "-DHZ_TO_USEC_NUM=$$((1000000/a)) -DHZ_TO_USEC_DEN=$$(($(CONFIG_HZ)/a))";')
++endif
++endif
++
++ifeq ($(wildcard $(srctree)/arch/arm/include/asm/neon.h)$(CONFIG_ARM),y)
++ccflags-y += -I$(kbuild-dir)/compat/neon-arm/include
++endif
++ifeq ($(wildcard $(srctree)/arch/arm64/include/asm/neon.h)$(CONFIG_ARM64),y)
++ccflags-y += -I$(kbuild-dir)/compat/neon-arm/include
++endif
++
++ifeq ($(wildcard $(srctree)/include/net/dst_metadata.h),)
++ccflags-y += -I$(kbuild-dir)/compat/dstmetadata/include
++endif
++
++ifeq ($(CONFIG_X86_64),y)
++ ifeq ($(ssse3_instr),)
++ ssse3_instr := $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1)
++ ccflags-y += $(ssse3_instr)
++ asflags-y += $(ssse3_instr)
++ endif
++ ifeq ($(avx_instr),)
++ avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1)
++ ccflags-y += $(avx_instr)
++ asflags-y += $(avx_instr)
++ endif
++ ifeq ($(avx2_instr),)
++ avx2_instr := $(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1)
++ ccflags-y += $(avx2_instr)
++ asflags-y += $(avx2_instr)
++ endif
++ ifeq ($(avx512_instr),)
++ avx512_instr := $(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1)
++ ccflags-y += $(avx512_instr)
++ asflags-y += $(avx512_instr)
++ endif
++ ifeq ($(bmi2_instr),)
++ bmi2_instr :=$(call as-instr,mulx %rax$(comma)%rax$(comma)%rax,-DCONFIG_AS_BMI2=1)
++ ccflags-y += $(bmi2_instr)
++ asflags-y += $(bmi2_instr)
++ endif
++ ifeq ($(adx_instr),)
++ adx_instr :=$(call as-instr,adcx %rax$(comma)%rax,-DCONFIG_AS_ADX=1)
++ ccflags-y += $(adx_instr)
++ asflags-y += $(adx_instr)
++ endif
++endif
++
++ifneq ($(shell grep -s -F "\#define LINUX_PACKAGE_ID \" Debian " "$(CURDIR)/include/generated/package.h"),)
++ccflags-y += -DISDEBIAN
++endif
+diff --git a/net/wireguard/compat/checksum/checksum_partial_compat.h b/net/wireguard/compat/checksum/checksum_partial_compat.h
+new file mode 100644
+index 000000000000..3dfe5397a94f
+--- /dev/null
++++ b/net/wireguard/compat/checksum/checksum_partial_compat.h
+@@ -0,0 +1,208 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++/*
++ * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++ */
++
++#include
++#include
++#include
++#include
++#include
++
++#define IP6_MF 0x0001
++#define IP6_OFFSET 0xFFF8
++static inline int skb_maybe_pull_tail(struct sk_buff *skb, unsigned int len, unsigned int max)
++{
++ if (skb_headlen(skb) >= len)
++ return 0;
++ if (max > skb->len)
++ max = skb->len;
++ if (__pskb_pull_tail(skb, max - skb_headlen(skb)) == NULL)
++ return -ENOMEM;
++ if (skb_headlen(skb) < len)
++ return -EPROTO;
++ return 0;
++}
++#define MAX_IP_HDR_LEN 128
++static inline int skb_checksum_setup_ip(struct sk_buff *skb, bool recalculate)
++{
++ unsigned int off;
++ bool fragment;
++ int err;
++ fragment = false;
++ err = skb_maybe_pull_tail(skb, sizeof(struct iphdr), MAX_IP_HDR_LEN);
++ if (err < 0)
++ goto out;
++ if (ip_hdr(skb)->frag_off & htons(IP_OFFSET | IP_MF))
++ fragment = true;
++ off = ip_hdrlen(skb);
++ err = -EPROTO;
++ if (fragment)
++ goto out;
++ switch (ip_hdr(skb)->protocol) {
++ case IPPROTO_TCP:
++ err = skb_maybe_pull_tail(skb,
++ off + sizeof(struct tcphdr),
++ MAX_IP_HDR_LEN);
++ if (err < 0)
++ goto out;
++
++ if (!skb_partial_csum_set(skb, off,
++ offsetof(struct tcphdr, check))) {
++ err = -EPROTO;
++ goto out;
++ }
++
++ if (recalculate)
++ tcp_hdr(skb)->check =
++ ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
++ ip_hdr(skb)->daddr,
++ skb->len - off,
++ IPPROTO_TCP, 0);
++ break;
++ case IPPROTO_UDP:
++ err = skb_maybe_pull_tail(skb,
++ off + sizeof(struct udphdr),
++ MAX_IP_HDR_LEN);
++ if (err < 0)
++ goto out;
++
++ if (!skb_partial_csum_set(skb, off,
++ offsetof(struct udphdr, check))) {
++ err = -EPROTO;
++ goto out;
++ }
++
++ if (recalculate)
++ udp_hdr(skb)->check =
++ ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
++ ip_hdr(skb)->daddr,
++ skb->len - off,
++ IPPROTO_UDP, 0);
++ break;
++ default:
++ goto out;
++ }
++ err = 0;
++out:
++ return err;
++}
++#define MAX_IPV6_HDR_LEN 256
++#define OPT_HDR(type, skb, off) \
++ (type *)(skb_network_header(skb) + (off))
++static inline int skb_checksum_setup_ipv6(struct sk_buff *skb, bool recalculate)
++{
++ int err;
++ u8 nexthdr;
++ unsigned int off;
++ unsigned int len;
++ bool fragment;
++ bool done;
++ fragment = false;
++ done = false;
++ off = sizeof(struct ipv6hdr);
++ err = skb_maybe_pull_tail(skb, off, MAX_IPV6_HDR_LEN);
++ if (err < 0)
++ goto out;
++ nexthdr = ipv6_hdr(skb)->nexthdr;
++ len = sizeof(struct ipv6hdr) + ntohs(ipv6_hdr(skb)->payload_len);
++ while (off <= len && !done) {
++ switch (nexthdr) {
++ case IPPROTO_DSTOPTS:
++ case IPPROTO_HOPOPTS:
++ case IPPROTO_ROUTING: {
++ struct ipv6_opt_hdr *hp;
++
++ err = skb_maybe_pull_tail(skb, off + sizeof(struct ipv6_opt_hdr), MAX_IPV6_HDR_LEN);
++ if (err < 0)
++ goto out;
++ hp = OPT_HDR(struct ipv6_opt_hdr, skb, off);
++ nexthdr = hp->nexthdr;
++ off += ipv6_optlen(hp);
++ break;
++ }
++ case IPPROTO_FRAGMENT: {
++ struct frag_hdr *hp;
++ err = skb_maybe_pull_tail(skb, off + sizeof(struct frag_hdr), MAX_IPV6_HDR_LEN);
++ if (err < 0)
++ goto out;
++ hp = OPT_HDR(struct frag_hdr, skb, off);
++ if (hp->frag_off & htons(IP6_OFFSET | IP6_MF))
++ fragment = true;
++ nexthdr = hp->nexthdr;
++ off += sizeof(struct frag_hdr);
++ break;
++ }
++ default:
++ done = true;
++ break;
++ }
++ }
++ err = -EPROTO;
++ if (!done || fragment)
++ goto out;
++ switch (nexthdr) {
++ case IPPROTO_TCP:
++ err = skb_maybe_pull_tail(skb,
++ off + sizeof(struct tcphdr),
++ MAX_IPV6_HDR_LEN);
++ if (err < 0)
++ goto out;
++
++ if (!skb_partial_csum_set(skb, off,
++ offsetof(struct tcphdr, check))) {
++ err = -EPROTO;
++ goto out;
++ }
++
++ if (recalculate)
++ tcp_hdr(skb)->check =
++ ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
++ &ipv6_hdr(skb)->daddr,
++ skb->len - off,
++ IPPROTO_TCP, 0);
++ break;
++ case IPPROTO_UDP:
++ err = skb_maybe_pull_tail(skb,
++ off + sizeof(struct udphdr),
++ MAX_IPV6_HDR_LEN);
++ if (err < 0)
++ goto out;
++
++ if (!skb_partial_csum_set(skb, off,
++ offsetof(struct udphdr, check))) {
++ err = -EPROTO;
++ goto out;
++ }
++
++ if (recalculate)
++ udp_hdr(skb)->check =
++ ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
++ &ipv6_hdr(skb)->daddr,
++ skb->len - off,
++ IPPROTO_UDP, 0);
++ break;
++ default:
++ goto out;
++ }
++ err = 0;
++out:
++ return err;
++}
++static inline int skb_checksum_setup(struct sk_buff *skb, bool recalculate)
++{
++ int err;
++ switch (skb->protocol) {
++ case htons(ETH_P_IP):
++ err = skb_checksum_setup_ip(skb, recalculate);
++ break;
++
++ case htons(ETH_P_IPV6):
++ err = skb_checksum_setup_ipv6(skb, recalculate);
++ break;
++ default:
++ err = -EPROTO;
++ break;
++ }
++ return err;
++}
+diff --git a/net/wireguard/compat/compat-asm.h b/net/wireguard/compat/compat-asm.h
+new file mode 100644
+index 000000000000..951fc1094470
+--- /dev/null
++++ b/net/wireguard/compat/compat-asm.h
+@@ -0,0 +1,89 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++/*
++ * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++ */
++
++#ifndef _WG_COMPATASM_H
++#define _WG_COMPATASM_H
++
++#include
++#include
++#include
++
++#ifdef RHEL_MAJOR
++#if RHEL_MAJOR == 7
++#define ISRHEL7
++#elif RHEL_MAJOR == 8
++#define ISRHEL8
++#if RHEL_MINOR >= 6
++#define ISCENTOS8S
++#endif
++#endif
++#endif
++
++/* PaX compatibility */
++#if defined(RAP_PLUGIN) && defined(RAP_ENTRY)
++#undef ENTRY
++#define ENTRY RAP_ENTRY
++#endif
++
++#if defined(__LINUX_ARM_ARCH__) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
++ .irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
++ .macro ret\c, reg
++#if __LINUX_ARM_ARCH__ < 6
++ mov\c pc, \reg
++#else
++ .ifeqs "\reg", "lr"
++ bx\c \reg
++ .else
++ mov\c pc, \reg
++ .endif
++#endif
++ .endm
++ .endr
++#endif
++
++#if defined(__LINUX_ARM_ARCH__) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
++#include
++#define lspush push
++#define lspull pull
++#undef push
++#undef pull
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 76) && !defined(ISRHEL8) && !defined(SYM_FUNC_START)
++#define SYM_FUNC_START ENTRY
++#define SYM_FUNC_END ENDPROC
++#endif
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
++#define blake2s_compress_ssse3 zinc_blake2s_compress_ssse3
++#define blake2s_compress_avx512 zinc_blake2s_compress_avx512
++#define poly1305_init_arm zinc_poly1305_init_arm
++#define poly1305_blocks_arm zinc_poly1305_blocks_arm
++#define poly1305_emit_arm zinc_poly1305_emit_arm
++#define poly1305_blocks_neon zinc_poly1305_blocks_neon
++#define poly1305_emit_neon zinc_poly1305_emit_neon
++#define poly1305_init_mips zinc_poly1305_init_mips
++#define poly1305_blocks_mips zinc_poly1305_blocks_mips
++#define poly1305_emit_mips zinc_poly1305_emit_mips
++#define poly1305_init_x86_64 zinc_poly1305_init_x86_64
++#define poly1305_blocks_x86_64 zinc_poly1305_blocks_x86_64
++#define poly1305_emit_x86_64 zinc_poly1305_emit_x86_64
++#define poly1305_emit_avx zinc_poly1305_emit_avx
++#define poly1305_blocks_avx zinc_poly1305_blocks_avx
++#define poly1305_blocks_avx2 zinc_poly1305_blocks_avx2
++#define poly1305_blocks_avx512 zinc_poly1305_blocks_avx512
++#define curve25519_neon zinc_curve25519_neon
++#define hchacha20_ssse3 zinc_hchacha20_ssse3
++#define chacha20_ssse3 zinc_chacha20_ssse3
++#define chacha20_avx2 zinc_chacha20_avx2
++#define chacha20_avx512 zinc_chacha20_avx512
++#define chacha20_avx512vl zinc_chacha20_avx512vl
++#define chacha20_mips zinc_chacha20_mips
++#define chacha20_arm zinc_chacha20_arm
++#define hchacha20_arm zinc_hchacha20_arm
++#define chacha20_neon zinc_chacha20_neon
++#endif
++
++#endif /* _WG_COMPATASM_H */
+diff --git a/net/wireguard/compat/compat.h b/net/wireguard/compat/compat.h
+new file mode 100644
+index 000000000000..36e902b06237
+--- /dev/null
++++ b/net/wireguard/compat/compat.h
+@@ -0,0 +1,1200 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++/*
++ * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++ */
++
++#ifndef _WG_COMPAT_H
++#define _WG_COMPAT_H
++
++#include
++#include
++#include
++#include
++
++#ifdef RHEL_MAJOR
++#if RHEL_MAJOR == 7
++#define ISRHEL7
++#elif RHEL_MAJOR == 8
++#define ISRHEL8
++#if RHEL_MINOR >= 6
++#define ISCENTOS8S
++#endif
++#endif
++#endif
++#ifdef UTS_UBUNTU_RELEASE_ABI
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
++#define ISUBUNTU1604
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++#define ISUBUNTU1804
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
++#define ISUBUNTU1904
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
++#define ISUBUNTU1910
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
++#error "WireGuard requires Linux >= 3.10"
++#endif
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++#error "WireGuard has been merged into Linux >= 5.6 and therefore this compatibility module is no longer required."
++#endif
++
++#if defined(ISRHEL7)
++#include
++#define headers_end headers_start
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
++#define headers_start data
++#define headers_end data
++#endif
++
++#include
++#include
++#ifndef __ro_after_init
++#define __ro_after_init __read_mostly
++#endif
++
++#include
++#ifndef READ_ONCE
++#define READ_ONCE ACCESS_ONCE
++#endif
++#ifndef WRITE_ONCE
++#ifdef ACCESS_ONCE_RW
++#define WRITE_ONCE(p, v) (ACCESS_ONCE_RW(p) = (v))
++#else
++#define WRITE_ONCE(p, v) (ACCESS_ONCE(p) = (v))
++#endif
++#endif
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
++#include "udp_tunnel/udp_tunnel_partial_compat.h"
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(DEBUG) && defined(net_dbg_ratelimited)
++#undef net_dbg_ratelimited
++#define net_dbg_ratelimited(fmt, ...) do { if (0) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
++#include
++#ifndef RCU_LOCKDEP_WARN
++#define RCU_LOCKDEP_WARN(cond, message) rcu_lockdep_assert(!(cond), message)
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(ISRHEL7)
++#define ipv6_dst_lookup(a, b, c, d) ipv6_dst_lookup(b, c, d)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 83)
++#define ipv6_dst_lookup_flow(a, b, c, d) ipv6_dst_lookup_flow(b, c, d)
++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 5) && LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) && !defined(ISUBUNTU1904)) || (!defined(ISRHEL8) && !defined(ISDEBIAN) && !defined(ISUBUNTU1804) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 119) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 181) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 224) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 224) && !defined(ISUBUNTU1604) && !defined(ISRHEL7))
++#define ipv6_dst_lookup_flow(a, b, c, d) ipv6_dst_lookup(a, b, &dst, c) + (void *)0 ?: dst
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && IS_ENABLED(CONFIG_IPV6) && !defined(ISRHEL7)
++#include
++struct ipv6_stub_type {
++ void *udpv6_encap_enable;
++ int (*ipv6_dst_lookup)(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6);
++};
++static const struct ipv6_stub_type ipv6_stub_impl = {
++ .udpv6_encap_enable = (void *)1,
++ .ipv6_dst_lookup = ip6_dst_lookup
++};
++static const struct ipv6_stub_type *ipv6_stub = &ipv6_stub_impl;
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) && IS_ENABLED(CONFIG_IPV6) && !defined(ISRHEL7)
++#include
++static inline bool ipv6_mod_enabled(void)
++{
++ return ipv6_stub != NULL && ipv6_stub->udpv6_encap_enable != NULL;
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) && !defined(ISRHEL7)
++#include
++static inline void skb_reset_tc(struct sk_buff *skb)
++{
++#ifdef CONFIG_NET_CLS_ACT
++ skb->tc_verd = 0;
++#endif
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
++#include
++#include
++static inline u32 __compat_get_random_u32(void)
++{
++ static siphash_key_t key;
++ static u32 counter = 0;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
++ static bool has_seeded = false;
++ if (unlikely(!has_seeded)) {
++ get_random_bytes(&key, sizeof(key));
++ has_seeded = true;
++ }
++#else
++ get_random_once(&key, sizeof(key));
++#endif
++ return siphash_2u32(counter++, get_random_int(), &key);
++}
++#define get_random_u32 __compat_get_random_u32
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(ISRHEL7)
++static inline void netif_keep_dst(struct net_device *dev)
++{
++ dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
++}
++#define COMPAT_CANNOT_USE_CSUM_LEVEL
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(ISRHEL7)
++#include
++#ifndef netdev_alloc_pcpu_stats
++#define pcpu_sw_netstats pcpu_tstats
++#endif
++#ifndef netdev_alloc_pcpu_stats
++#define netdev_alloc_pcpu_stats alloc_percpu
++#endif
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && !defined(ISRHEL7)
++#include
++#ifndef netdev_alloc_pcpu_stats
++#define netdev_alloc_pcpu_stats(type) \
++({ \
++ typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
++ if (pcpu_stats) { \
++ int __cpu; \
++ for_each_possible_cpu(__cpu) { \
++ typeof(type) *stat; \
++ stat = per_cpu_ptr(pcpu_stats, __cpu); \
++ u64_stats_init(&stat->syncp); \
++ } \
++ } \
++ pcpu_stats; \
++})
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(ISRHEL7)
++#include "checksum/checksum_partial_compat.h"
++static inline void *__compat_pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)
++{
++ if (tail != skb) {
++ skb->data_len += len;
++ skb->len += len;
++ }
++ return skb_put(tail, len);
++}
++#define pskb_put __compat_pskb_put
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) && !defined(ISRHEL7)
++#include
++static inline void skb_scrub_packet(struct sk_buff *skb, bool xnet)
++{
++#ifdef CONFIG_CAVIUM_OCTEON_IPFWD_OFFLOAD
++ memset(&skb->cvm_info, 0, sizeof(skb->cvm_info));
++ skb->cvm_reserved = 0;
++#endif
++ skb->tstamp.tv64 = 0;
++ skb->pkt_type = PACKET_HOST;
++ skb->skb_iif = 0;
++ skb_dst_drop(skb);
++ secpath_reset(skb);
++ nf_reset(skb);
++ nf_reset_trace(skb);
++ if (!xnet)
++ return;
++ skb_orphan(skb);
++ skb->mark = 0;
++}
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
++#define skb_scrub_packet(a, b) skb_scrub_packet(a)
++#endif
++
++#if ((LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 63)) && !defined(ISRHEL7)
++#include
++static inline u32 __compat_prandom_u32_max(u32 ep_ro)
++{
++ return (u32)(((u64)prandom_u32() * ep_ro) >> 32);
++}
++#define prandom_u32_max __compat_prandom_u32_max
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
++#include
++#ifndef U8_MAX
++#define U8_MAX ((u8)~0U)
++#endif
++#ifndef S8_MAX
++#define S8_MAX ((s8)(U8_MAX >> 1))
++#endif
++#ifndef S8_MIN
++#define S8_MIN ((s8)(-S8_MAX - 1))
++#endif
++#ifndef U16_MAX
++#define U16_MAX ((u16)~0U)
++#endif
++#ifndef S16_MAX
++#define S16_MAX ((s16)(U16_MAX >> 1))
++#endif
++#ifndef S16_MIN
++#define S16_MIN ((s16)(-S16_MAX - 1))
++#endif
++#ifndef U32_MAX
++#define U32_MAX ((u32)~0U)
++#endif
++#ifndef S32_MAX
++#define S32_MAX ((s32)(U32_MAX >> 1))
++#endif
++#ifndef S32_MIN
++#define S32_MIN ((s32)(-S32_MAX - 1))
++#endif
++#ifndef U64_MAX
++#define U64_MAX ((u64)~0ULL)
++#endif
++#ifndef S64_MAX
++#define S64_MAX ((s64)(U64_MAX >> 1))
++#endif
++#ifndef S64_MIN
++#define S64_MIN ((s64)(-S64_MAX - 1))
++#endif
++#endif
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 3) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 35) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 24) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 33) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 60) && !defined(ISRHEL7))
++static inline void memzero_explicit(void *s, size_t count)
++{
++ memset(s, 0, count);
++ barrier();
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(ISRHEL7)
++static const struct in6_addr __compat_in6addr_any = IN6ADDR_ANY_INIT;
++#define in6addr_any __compat_in6addr_any
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++#include
++#include
++#include
++struct rng_initializer {
++ struct completion done;
++ struct random_ready_callback cb;
++};
++static inline void rng_initialized_callback(struct random_ready_callback *cb)
++{
++ complete(&container_of(cb, struct rng_initializer, cb)->done);
++}
++static inline int wait_for_random_bytes(void)
++{
++ static bool rng_is_initialized = false;
++ int ret;
++ if (unlikely(!rng_is_initialized)) {
++ struct rng_initializer rng = {
++ .done = COMPLETION_INITIALIZER(rng.done),
++ .cb = { .owner = THIS_MODULE, .func = rng_initialized_callback }
++ };
++ ret = add_random_ready_callback(&rng.cb);
++ if (!ret) {
++ ret = wait_for_completion_interruptible(&rng.done);
++ if (ret) {
++ del_random_ready_callback(&rng.cb);
++ return ret;
++ }
++ } else if (ret != -EALREADY)
++ return ret;
++ rng_is_initialized = true;
++ }
++ return 0;
++}
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
++/* This is a disaster. Without this API, we really have no way of
++ * knowing if it's initialized. We just return that it has and hope
++ * for the best... */
++static inline int wait_for_random_bytes(void)
++{
++ return 0;
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && !defined(ISRHEL8)
++#include
++#include
++struct rng_is_initialized_callback {
++ struct random_ready_callback cb;
++ atomic_t *rng_state;
++};
++static inline void rng_is_initialized_callback(struct random_ready_callback *cb)
++{
++ struct rng_is_initialized_callback *rdy = container_of(cb, struct rng_is_initialized_callback, cb);
++ atomic_set(rdy->rng_state, 2);
++ kfree(rdy);
++}
++static inline bool rng_is_initialized(void)
++{
++ static atomic_t rng_state = ATOMIC_INIT(0);
++
++ if (atomic_read(&rng_state) == 2)
++ return true;
++
++ if (atomic_cmpxchg(&rng_state, 0, 1) == 0) {
++ int ret;
++ struct rng_is_initialized_callback *rdy = kmalloc(sizeof(*rdy), GFP_ATOMIC);
++ if (!rdy) {
++ atomic_set(&rng_state, 0);
++ return false;
++ }
++ rdy->cb.owner = THIS_MODULE;
++ rdy->cb.func = rng_is_initialized_callback;
++ rdy->rng_state = &rng_state;
++ ret = add_random_ready_callback(&rdy->cb);
++ if (ret)
++ kfree(rdy);
++ if (ret == -EALREADY) {
++ atomic_set(&rng_state, 2);
++ return true;
++ } else if (ret)
++ atomic_set(&rng_state, 0);
++ return false;
++ }
++ return false;
++}
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
++/* This is a disaster. Without this API, we really have no way of
++ * knowing if it's initialized. We just return that it has and hope
++ * for the best... */
++static inline bool rng_is_initialized(void)
++{
++ return true;
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
++static inline int get_random_bytes_wait(void *buf, int nbytes)
++{
++ int ret = wait_for_random_bytes();
++ if (unlikely(ret))
++ return ret;
++ get_random_bytes(buf, nbytes);
++ return 0;
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) && !defined(ISRHEL7)
++#define system_power_efficient_wq system_unbound_wq
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
++#include
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
++#include
++#ifndef ktime_get_real_ts64
++#define timespec64 timespec
++#define ktime_get_real_ts64 ktime_get_real_ts
++#endif
++#else
++#include
++#endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
++static inline u64 __compat_jiffies64_to_nsecs(u64 j)
++{
++#if !(NSEC_PER_SEC % HZ)
++ return (NSEC_PER_SEC / HZ) * j;
++#else
++ return div_u64(j * HZ_TO_USEC_NUM, HZ_TO_USEC_DEN) * 1000;
++#endif
++}
++#define jiffies64_to_nsecs __compat_jiffies64_to_nsecs
++#endif
++static inline u64 ktime_get_coarse_boottime_ns(void)
++{
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
++ return ktime_to_ns(ktime_get_boottime());
++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 12) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 53)
++ return ktime_to_ns(ktime_mono_to_any(ns_to_ktime(jiffies64_to_nsecs(get_jiffies_64())), TK_OFFS_BOOT));
++#else
++ return ktime_to_ns(ktime_get_coarse_boottime());
++#endif
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
++#include
++static inline __be32 __compat_confirm_addr_indev(struct in_device *in_dev, __be32 dst, __be32 local, int scope)
++{
++ int same = 0;
++ __be32 addr = 0;
++ for_ifa(in_dev) {
++ if (!addr && (local == ifa->ifa_local || !local) && ifa->ifa_scope <= scope) {
++ addr = ifa->ifa_local;
++ if (same)
++ break;
++ }
++ if (!same) {
++ same = (!local || inet_ifa_match(local, ifa)) && (!dst || inet_ifa_match(dst, ifa));
++ if (same && addr) {
++ if (local || !dst)
++ break;
++ if (inet_ifa_match(addr, ifa))
++ break;
++ if (ifa->ifa_scope <= scope) {
++ addr = ifa->ifa_local;
++ break;
++ }
++ same = 0;
++ }
++ }
++ } endfor_ifa(in_dev);
++ return same ? addr : 0;
++}
++static inline __be32 __compat_inet_confirm_addr(struct net *net, struct in_device *in_dev, __be32 dst, __be32 local, int scope)
++{
++ __be32 addr = 0;
++ struct net_device *dev;
++ if (in_dev)
++ return __compat_confirm_addr_indev(in_dev, dst, local, scope);
++ rcu_read_lock();
++ for_each_netdev_rcu(net, dev) {
++ in_dev = __in_dev_get_rcu(dev);
++ if (in_dev) {
++ addr = __compat_confirm_addr_indev(in_dev, dst, local, scope);
++ if (addr)
++ break;
++ }
++ }
++ rcu_read_unlock();
++ return addr;
++}
++#define inet_confirm_addr __compat_inet_confirm_addr
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
++#include
++#include
++#include
++static inline void *__compat_kvmalloc(size_t size, gfp_t flags)
++{
++ gfp_t kmalloc_flags = flags;
++ void *ret;
++ if (size > PAGE_SIZE) {
++ kmalloc_flags |= __GFP_NOWARN;
++ if (!(kmalloc_flags & __GFP_REPEAT) || (size <= PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER))
++ kmalloc_flags |= __GFP_NORETRY;
++ }
++ ret = kmalloc(size, kmalloc_flags);
++ if (ret || size <= PAGE_SIZE)
++ return ret;
++ return __vmalloc(size, flags, PAGE_KERNEL);
++}
++static inline void *__compat_kvzalloc(size_t size, gfp_t flags)
++{
++ return __compat_kvmalloc(size, flags | __GFP_ZERO);
++}
++#define kvmalloc __compat_kvmalloc
++#define kvzalloc __compat_kvzalloc
++#endif
++
++#if ((LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 41))
++#include
++#include
++static inline void __compat_kvfree(const void *addr)
++{
++ if (is_vmalloc_addr(addr))
++ vfree(addr);
++ else
++ kfree(addr);
++}
++#define kvfree __compat_kvfree
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
++#include
++#include
++static inline void *__compat_kvmalloc_array(size_t n, size_t size, gfp_t flags)
++{
++ if (n != 0 && SIZE_MAX / n < size)
++ return NULL;
++ return kvmalloc(n * size, flags);
++}
++#define kvmalloc_array __compat_kvmalloc_array
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
++#include
++#include
++static inline void *__compat_kvcalloc(size_t n, size_t size, gfp_t flags)
++{
++ return kvmalloc_array(n, size, flags | __GFP_ZERO);
++}
++#define kvcalloc __compat_kvcalloc
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 9)
++#include
++#define priv_destructor destructor
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
++#define wg_newlink(a,b,c,d,e) wg_newlink(a,b,c,d)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
++#include
++#include
++#define nlmsg_parse(a, b, c, d, e, f) nlmsg_parse(a, b, c, d, e)
++#define nla_parse_nested(a, b, c, d, e) nla_parse_nested(a, b, c, d)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) && !defined(ISRHEL7)
++static inline struct nlattr **genl_family_attrbuf(const struct genl_family *family)
++{
++ return family->attrbuf;
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
++#define PTR_ERR_OR_ZERO(p) PTR_RET(p)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
++#include
++#define nla_put_u64_64bit(a, b, c, d) nla_put_u64(a, b, c)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
++#include
++#ifndef GENL_UNS_ADMIN_PERM
++#define GENL_UNS_ADMIN_PERM GENL_ADMIN_PERM
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) && !defined(ISRHEL7)
++#include
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
++#define genl_register_family(a) genl_register_family_with_ops(a, genl_ops, ARRAY_SIZE(genl_ops))
++#define COMPAT_CANNOT_USE_CONST_GENL_OPS
++#else
++#define genl_register_family(a) genl_register_family_with_ops(a, genl_ops)
++#endif
++#define COMPAT_CANNOT_USE_GENL_NOPS
++#endif
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 2) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 16) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 65) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 101) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 84)
++#define __COMPAT_NETLINK_DUMP_BLOCK { \
++ int ret; \
++ skb->end -= nlmsg_total_size(sizeof(int)); \
++ ret = wg_get_device_dump_real(skb, cb); \
++ skb->end += nlmsg_total_size(sizeof(int)); \
++ return ret; \
++}
++#define __COMPAT_NETLINK_DUMP_OVERRIDE
++#else
++#define __COMPAT_NETLINK_DUMP_BLOCK return wg_get_device_dump_real(skb, cb);
++#endif
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 8) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 25) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 87)
++#define wg_get_device_dump(a, b) wg_get_device_dump_real(a, b); \
++static int wg_get_device_dump(a, b) { \
++ struct wg_device *wg = (struct wg_device *)cb->args[0]; \
++ if (!wg) { \
++ int ret = wg_get_device_start(cb); \
++ if (ret) \
++ return ret; \
++ } \
++ __COMPAT_NETLINK_DUMP_BLOCK \
++} \
++static int wg_get_device_dump_real(a, b)
++#define COMPAT_CANNOT_USE_NETLINK_START
++#elif defined(__COMPAT_NETLINK_DUMP_OVERRIDE)
++#define wg_get_device_dump(a, b) wg_get_device_dump_real(a, b); \
++static int wg_get_device_dump(a, b) { \
++ __COMPAT_NETLINK_DUMP_BLOCK \
++} \
++static int wg_get_device_dump_real(a, b)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
++#define COMPAT_CANNOT_USE_IN6_DEV_GET
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
++#define COMPAT_CANNOT_USE_IFF_NO_QUEUE
++#endif
++
++#if defined(CONFIG_X86_64) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
++#include
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
++#include
++#include
++static inline int cpu_has_xfeatures(u64 xfeatures_needed, const char **feature_name)
++{
++ return boot_cpu_has(X86_FEATURE_XSAVE) && xgetbv(XCR_XFEATURE_ENABLED_MASK) & xfeatures_needed;
++}
++#endif
++#ifndef XFEATURE_MASK_YMM
++#define XFEATURE_MASK_YMM XSTATE_YMM
++#endif
++#ifndef XFEATURE_MASK_SSE
++#define XFEATURE_MASK_SSE XSTATE_SSE
++#endif
++#ifndef XSTATE_AVX512
++#define XSTATE_AVX512 (XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM)
++#endif
++#ifndef XFEATURE_MASK_AVX512
++#define XFEATURE_MASK_AVX512 XSTATE_AVX512
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && defined(CONFIG_X86_64)
++/* This is incredibly dumb and reckless, but as it turns out, there's
++ * not really hardware Linux runs properly on that supports F but not BW
++ * and VL, so in practice this isn't so bad. Plus, this is compat layer,
++ * so the bar remains fairly low.
++ */
++#include
++#ifndef X86_FEATURE_AVX512BW
++#define X86_FEATURE_AVX512BW X86_FEATURE_AVX512F
++#endif
++#ifndef X86_FEATURE_AVX512VL
++#define X86_FEATURE_AVX512VL X86_FEATURE_AVX512F
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
++struct __compat_dummy_container { char dev; };
++#define netdev_notifier_info net_device *)data); __attribute((unused)) char __compat_dummy_variable = ((struct __compat_dummy_container
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
++#define timer_setup(a, b, c) setup_timer(a, ((void (*)(unsigned long))b), ((unsigned long)a))
++#define from_timer(var, callback_timer, timer_fieldname) container_of(callback_timer, typeof(*var), timer_fieldname)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 3)
++#define COMPAT_CANNOT_USE_AVX512
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
++#include
++#define genl_dump_check_consistent(a, b) genl_dump_check_consistent(a, b, &genl_family)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && !defined(ISRHEL7)
++static inline void *skb_put_data(struct sk_buff *skb, const void *data, unsigned int len)
++{
++ void *tmp = skb_put(skb, len);
++ memcpy(tmp, data, len);
++ return tmp;
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && !defined(ISRHEL7)
++#define napi_complete_done(n, work_done) napi_complete(n)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
++#include
++/* NAPI_STATE_SCHED gets set by netif_napi_add anyway, so this is safe.
++ * Also, kernels without NAPI_STATE_NO_BUSY_POLL don't have a call to
++ * napi_hash_add inside of netif_napi_add.
++ */
++#define NAPI_STATE_NO_BUSY_POLL NAPI_STATE_SCHED
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
++#include
++#ifndef atomic_read_acquire
++#define atomic_read_acquire(v) ({ int __compat_p1 = atomic_read(v); smp_rmb(); __compat_p1; })
++#endif
++#ifndef atomic_set_release
++#define atomic_set_release(v, i) ({ smp_wmb(); atomic_set(v, i); })
++#endif
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
++#include
++#ifndef atomic_read_acquire
++#define atomic_read_acquire(v) smp_load_acquire(&(v)->counter)
++#endif
++#ifndef atomic_set_release
++#define atomic_set_release(v, i) smp_store_release(&(v)->counter, (i))
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
++static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
++{
++ while (words--) {
++ __le32_to_cpus(buf);
++ buf++;
++ }
++}
++static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
++{
++ while (words--) {
++ __cpu_to_le32s(buf);
++ buf++;
++ }
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
++#include
++static inline void crypto_xor_cpy(u8 *dst, const u8 *src1, const u8 *src2,
++ unsigned int size)
++{
++ if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) &&
++ __builtin_constant_p(size) &&
++ (size % sizeof(unsigned long)) == 0) {
++ unsigned long *d = (unsigned long *)dst;
++ unsigned long *s1 = (unsigned long *)src1;
++ unsigned long *s2 = (unsigned long *)src2;
++
++ while (size > 0) {
++ *d++ = *s1++ ^ *s2++;
++ size -= sizeof(unsigned long);
++ }
++ } else {
++ if (unlikely(dst != src1))
++ memmove(dst, src1, size);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
++ crypto_xor(dst, src2, size);
++#else
++ __crypto_xor(dst, src2, size);
++#endif
++ }
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
++#define read_cpuid_part() read_cpuid_part_number()
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(ISRHEL7)
++#define hlist_add_behind(a, b) hlist_add_after(b, a)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(ISRHEL8)
++#define totalram_pages() totalram_pages
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
++struct __kernel_timespec {
++ int64_t tv_sec, tv_nsec;
++};
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
++#include
++#ifdef __kernel_timespec
++#undef __kernel_timespec
++struct __kernel_timespec {
++ int64_t tv_sec, tv_nsec;
++};
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
++#include
++#ifndef ALIGN_DOWN
++#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && !defined(ISRHEL8)
++#include
++#define skb_probe_transport_header(a) skb_probe_transport_header(a, 0)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) && !defined(ISRHEL7)
++#define ignore_df local_df
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && !defined(ISRHEL8)
++/* Note that all intentional uses of the non-_bh variety need to explicitly
++ * undef these, conditionalized on COMPAT_CANNOT_DEPRECIATE_BH_RCU.
++ */
++#include
++static __always_inline void old_synchronize_rcu(void)
++{
++ synchronize_rcu();
++}
++static __always_inline void old_call_rcu(void *a, void *b)
++{
++ call_rcu(a, b);
++}
++static __always_inline void old_rcu_barrier(void)
++{
++ rcu_barrier();
++}
++#ifdef synchronize_rcu
++#undef synchronize_rcu
++#endif
++#ifdef call_rcu
++#undef call_rcu
++#endif
++#ifdef rcu_barrier
++#undef rcu_barrier
++#endif
++#define synchronize_rcu synchronize_rcu_bh
++#define call_rcu call_rcu_bh
++#define rcu_barrier rcu_barrier_bh
++#define COMPAT_CANNOT_DEPRECIATE_BH_RCU
++#endif
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 10) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) && !defined(ISRHEL8)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 217)
++static inline void skb_mark_not_on_list(struct sk_buff *skb)
++{
++ skb->next = NULL;
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) && !defined(ISRHEL8)
++#include
++#ifndef NLA_POLICY_EXACT_LEN
++#define NLA_POLICY_EXACT_LEN(_len) { .type = NLA_UNSPEC, .len = _len }
++#endif
++#endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && !defined(ISRHEL8)
++#include
++#ifndef NLA_POLICY_MIN_LEN
++#define NLA_POLICY_MIN_LEN(_len) { .type = NLA_UNSPEC, .len = _len }
++#endif
++#define COMPAT_CANNOT_INDIVIDUAL_NETLINK_OPS_POLICY
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && defined(__aarch64__)
++#define cpu_have_named_feature(name) (elf_hwcap & (HWCAP_ ## name))
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
++#include
++#ifndef offsetofend
++#define offsetofend(TYPE, MEMBER) (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) && !defined(ISRHEL8)
++#define genl_dumpit_info(cb) ({ \
++ struct { struct nlattr **attrs; } *a = (void *)((u8 *)cb->args + offsetofend(struct dump_ctx, next_allowedip)); \
++ BUILD_BUG_ON(sizeof(cb->args) < offsetofend(struct dump_ctx, next_allowedip) + sizeof(*a)); \
++ a->attrs = genl_family_attrbuf(&genl_family); \
++ if (nlmsg_parse(cb->nlh, GENL_HDRLEN + genl_family.hdrsize, a->attrs, genl_family.maxattr, device_policy, NULL) < 0) \
++ memset(a->attrs, 0, (genl_family.maxattr + 1) * sizeof(struct nlattr *)); \
++ a; \
++})
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
++#include
++#ifndef skb_list_walk_safe
++#define skb_list_walk_safe(first, skb, next) \
++ for ((skb) = (first), (next) = (skb) ? (skb)->next : NULL; (skb); \
++ (skb) = (next), (next) = (skb) ? (skb)->next : NULL)
++#endif
++#endif
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
++#define blake2s_init zinc_blake2s_init
++#define blake2s_init_key zinc_blake2s_init_key
++#define blake2s_update zinc_blake2s_update
++#define blake2s_final zinc_blake2s_final
++#define blake2s_hmac zinc_blake2s_hmac
++#define chacha20 zinc_chacha20
++#define hchacha20 zinc_hchacha20
++#define chacha20poly1305_encrypt zinc_chacha20poly1305_encrypt
++#define chacha20poly1305_encrypt_sg_inplace zinc_chacha20poly1305_encrypt_sg_inplace
++#define chacha20poly1305_decrypt zinc_chacha20poly1305_decrypt
++#define chacha20poly1305_decrypt_sg_inplace zinc_chacha20poly1305_decrypt_sg_inplace
++#define xchacha20poly1305_encrypt zinc_xchacha20poly1305_encrypt
++#define xchacha20poly1305_decrypt zinc_xchacha20poly1305_decrypt
++#define curve25519 zinc_curve25519
++#define curve25519_generate_secret zinc_curve25519_generate_secret
++#define curve25519_generate_public zinc_curve25519_generate_public
++#define poly1305_init zinc_poly1305_init
++#define poly1305_update zinc_poly1305_update
++#define poly1305_final zinc_poly1305_final
++#define blake2s_compress_ssse3 zinc_blake2s_compress_ssse3
++#define blake2s_compress_avx512 zinc_blake2s_compress_avx512
++#define poly1305_init_arm zinc_poly1305_init_arm
++#define poly1305_blocks_arm zinc_poly1305_blocks_arm
++#define poly1305_emit_arm zinc_poly1305_emit_arm
++#define poly1305_blocks_neon zinc_poly1305_blocks_neon
++#define poly1305_emit_neon zinc_poly1305_emit_neon
++#define poly1305_init_mips zinc_poly1305_init_mips
++#define poly1305_blocks_mips zinc_poly1305_blocks_mips
++#define poly1305_emit_mips zinc_poly1305_emit_mips
++#define poly1305_init_x86_64 zinc_poly1305_init_x86_64
++#define poly1305_blocks_x86_64 zinc_poly1305_blocks_x86_64
++#define poly1305_emit_x86_64 zinc_poly1305_emit_x86_64
++#define poly1305_emit_avx zinc_poly1305_emit_avx
++#define poly1305_blocks_avx zinc_poly1305_blocks_avx
++#define poly1305_blocks_avx2 zinc_poly1305_blocks_avx2
++#define poly1305_blocks_avx512 zinc_poly1305_blocks_avx512
++#define curve25519_neon zinc_curve25519_neon
++#define hchacha20_ssse3 zinc_hchacha20_ssse3
++#define chacha20_ssse3 zinc_chacha20_ssse3
++#define chacha20_avx2 zinc_chacha20_avx2
++#define chacha20_avx512 zinc_chacha20_avx512
++#define chacha20_avx512vl zinc_chacha20_avx512vl
++#define chacha20_mips zinc_chacha20_mips
++#define chacha20_arm zinc_chacha20_arm
++#define hchacha20_arm zinc_hchacha20_arm
++#define chacha20_neon zinc_chacha20_neon
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && !defined(ISRHEL7)
++#include
++static inline int skb_ensure_writable(struct sk_buff *skb, int write_len)
++{
++ if (!pskb_may_pull(skb, write_len))
++ return -ENOMEM;
++
++ if (!skb_cloned(skb) || skb_clone_writable(skb, write_len))
++ return 0;
++
++ return pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
++}
++#endif
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 102) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 178) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 223) && LINUX_VERSION_CODE > KERNEL_VERSION(4, 10, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 259) || defined(ISRHEL8) || defined(ISUBUNTU1804)
++#include
++#include
++#if IS_ENABLED(CONFIG_NF_NAT)
++#include
++#include
++#include
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && !defined(ISRHEL8)
++#include
++#endif
++static inline void __compat_icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
++{
++ struct sk_buff *cloned_skb = NULL;
++ enum ip_conntrack_info ctinfo;
++ struct nf_conn *ct;
++ __be32 orig_ip;
++
++ ct = nf_ct_get(skb_in, &ctinfo);
++ if (!ct || !(ct->status & IPS_SRC_NAT)) {
++ memset(skb_in->cb, 0, sizeof(skb_in->cb));
++ icmp_send(skb_in, type, code, info);
++ return;
++ }
++
++ if (skb_shared(skb_in))
++ skb_in = cloned_skb = skb_clone(skb_in, GFP_ATOMIC);
++
++ if (unlikely(!skb_in || skb_network_header(skb_in) < skb_in->head ||
++ (skb_network_header(skb_in) + sizeof(struct iphdr)) >
++ skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in,
++ skb_network_offset(skb_in) + sizeof(struct iphdr))))
++ goto out;
++
++ orig_ip = ip_hdr(skb_in)->saddr;
++ ip_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.ip;
++ memset(skb_in->cb, 0, sizeof(skb_in->cb));
++ icmp_send(skb_in, type, code, info);
++ ip_hdr(skb_in)->saddr = orig_ip;
++out:
++ consume_skb(cloned_skb);
++}
++static inline void __compat_icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
++{
++ struct sk_buff *cloned_skb = NULL;
++ enum ip_conntrack_info ctinfo;
++ struct in6_addr orig_ip;
++ struct nf_conn *ct;
++
++ ct = nf_ct_get(skb_in, &ctinfo);
++ if (!ct || !(ct->status & IPS_SRC_NAT)) {
++ memset(skb_in->cb, 0, sizeof(skb_in->cb));
++ icmpv6_send(skb_in, type, code, info);
++ return;
++ }
++
++ if (skb_shared(skb_in))
++ skb_in = cloned_skb = skb_clone(skb_in, GFP_ATOMIC);
++
++ if (unlikely(!skb_in || skb_network_header(skb_in) < skb_in->head ||
++ (skb_network_header(skb_in) + sizeof(struct ipv6hdr)) >
++ skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in,
++ skb_network_offset(skb_in) + sizeof(struct ipv6hdr))))
++ goto out;
++
++ orig_ip = ipv6_hdr(skb_in)->saddr;
++ ipv6_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.in6;
++ memset(skb_in->cb, 0, sizeof(skb_in->cb));
++ icmpv6_send(skb_in, type, code, info);
++ ipv6_hdr(skb_in)->saddr = orig_ip;
++out:
++ consume_skb(cloned_skb);
++}
++#else
++static inline void __compat_icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
++{
++ memset(skb_in->cb, 0, sizeof(skb_in->cb));
++ icmp_send(skb_in, type, code, info);
++}
++static inline void __compat_icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
++{
++ memset(skb_in->cb, 0, sizeof(skb_in->cb));
++ icmpv6_send(skb_in, type, code, info);
++}
++#endif
++#define icmp_ndo_send __compat_icmp_ndo_send
++#define icmpv6_ndo_send __compat_icmpv6_ndo_send
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
++#define COMPAT_CANNOT_USE_MAX_MTU
++#endif
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 14) && LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 29) && !defined(ISUBUNTU1910) && !defined(ISUBUNTU1904) && !defined(ISRHEL8))
++#include
++#include
++static inline void skb_reset_redirect(struct sk_buff *skb)
++{
++#ifdef CONFIG_NET_SCHED
++ skb_reset_tc(skb);
++#endif
++}
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(ISRHEL7)
++#define skb_get_hash skb_get_rxhash
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && !defined(ISRHEL7)
++#define hash rxhash
++#define l4_hash l4_rxhash
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(ISRHEL7)
++#define sw_hash ignore_df = 0; skb->nf_trace = skb->ooo_okay
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
++#define pre_exit exit
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
++#include
++#include
++#include
++static inline __be16 ip_tunnel_parse_protocol(const struct sk_buff *skb)
++{
++ if (skb_network_header(skb) >= skb->head &&
++ (skb_network_header(skb) + sizeof(struct iphdr)) <= skb_tail_pointer(skb) &&
++ ip_hdr(skb)->version == 4)
++ return htons(ETH_P_IP);
++ if (skb_network_header(skb) >= skb->head &&
++ (skb_network_header(skb) + sizeof(struct ipv6hdr)) <= skb_tail_pointer(skb) &&
++ ipv6_hdr(skb)->version == 6)
++ return htons(ETH_P_IPV6);
++ return 0;
++}
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(ISRHEL8)
++static const struct header_ops ip_tunnel_header_ops = { .parse_protocol = ip_tunnel_parse_protocol };
++#else
++#define header_ops hard_header_len
++#define ip_tunnel_header_ops *(char *)0 - (char *)0
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
++#define kfree_sensitive(a) kzfree(a)
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(ISRHEL7)
++#define xchg_release xchg
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(ISRHEL7)
++#include
++#ifndef smp_load_acquire
++#define smp_load_acquire(p) \
++({ \
++ typeof(*p) ___p1 = ACCESS_ONCE(*p); \
++ smp_mb(); \
++ ___p1; \
++})
++#endif
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
++#include
++struct dst_cache_pcpu {
++ unsigned long refresh_ts;
++ struct dst_entry *dst;
++ u32 cookie;
++ union {
++ struct in_addr in_saddr;
++ struct in6_addr in6_saddr;
++ };
++};
++#define COMPAT_HAS_DEFINED_DST_CACHE_PCPU
++static inline void dst_cache_reset_now(struct dst_cache *dst_cache)
++{
++ int i;
++
++ if (!dst_cache->cache)
++ return;
++
++ dst_cache->reset_ts = jiffies;
++ for_each_possible_cpu(i) {
++ struct dst_cache_pcpu *idst = per_cpu_ptr(dst_cache->cache, i);
++ struct dst_entry *dst = idst->dst;
++
++ idst->cookie = 0;
++ idst->dst = NULL;
++ dst_release(dst);
++ }
++}
++#endif
++
++#if defined(ISUBUNTU1604) || defined(ISRHEL7)
++#include
++#ifndef _WG_LINUX_SIPHASH_H
++#define hsiphash_1u32 siphash_1u32
++#define hsiphash_2u32 siphash_2u32
++#define hsiphash_3u32 siphash_3u32
++#define hsiphash_key_t siphash_key_t
++#endif
++#endif
++
++#ifdef CONFIG_VE
++#include
++#ifdef NETIF_F_VIRTUAL
++#undef NETIF_F_LLTX
++#define NETIF_F_LLTX (__NETIF_F(LLTX) | __NETIF_F(VIRTUAL))
++#endif
++#endif
++
++/* https://github.com/ClangBuiltLinux/linux/issues/7 */
++#if defined( __clang__) && (!defined(CONFIG_CLANG_VERSION) || CONFIG_CLANG_VERSION < 80000)
++#include
++#undef BUILD_BUG_ON
++#define BUILD_BUG_ON(x)
++#endif
++
++/* PaX compatibility */
++#ifdef CONSTIFY_PLUGIN
++#include
++#undef __read_mostly
++#define __read_mostly
++#endif
++#if (defined(CONFIG_PAX) || defined(CONFIG_CFI_CLANG)) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
++#include
++#define wg_expired_retransmit_handshake(a) wg_expired_retransmit_handshake(unsigned long timer)
++#define wg_expired_send_keepalive(a) wg_expired_send_keepalive(unsigned long timer)
++#define wg_expired_new_handshake(a) wg_expired_new_handshake(unsigned long timer)
++#define wg_expired_zero_key_material(a) wg_expired_zero_key_material(unsigned long timer)
++#define wg_expired_send_persistent_keepalive(a) wg_expired_send_persistent_keepalive(unsigned long timer)
++#undef timer_setup
++#define timer_setup(a, b, c) setup_timer(a, ((void (*)(unsigned long))b), ((unsigned long)a))
++#undef from_timer
++#define from_timer(var, callback_timer, timer_fieldname) container_of((struct timer_list *)callback_timer, typeof(*var), timer_fieldname)
++#endif
++
++#endif /* _WG_COMPAT_H */
+diff --git a/net/wireguard/compat/dst_cache/dst_cache.c b/net/wireguard/compat/dst_cache/dst_cache.c
+new file mode 100644
+index 000000000000..f74c43c550eb
+--- /dev/null
++++ b/net/wireguard/compat/dst_cache/dst_cache.c
+@@ -0,0 +1,177 @@
++/*
++ * net/core/dst_cache.c - dst entry cache
++ *
++ * Copyright (c) 2016 Paolo Abeni
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++
++#include
++#include
++#include
++#include
++#if IS_ENABLED(CONFIG_IPV6)
++#include
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 50)
++static inline u32 rt6_get_cookie(const struct rt6_info *rt)
++{
++ if ((unlikely(rt->dst.flags & DST_NOCACHE) && rt->dst.from))
++ rt = (struct rt6_info *)(rt->dst.from);
++
++ return rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
++}
++#endif
++#endif
++#include
++
++#ifndef COMPAT_HAS_DEFINED_DST_CACHE_PCPU
++struct dst_cache_pcpu {
++ unsigned long refresh_ts;
++ struct dst_entry *dst;
++ u32 cookie;
++ union {
++ struct in_addr in_saddr;
++ struct in6_addr in6_saddr;
++ };
++};
++#endif
++
++static void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache,
++ struct dst_entry *dst, u32 cookie)
++{
++ dst_release(dst_cache->dst);
++ if (dst)
++ dst_hold(dst);
++
++ dst_cache->cookie = cookie;
++ dst_cache->dst = dst;
++}
++
++static struct dst_entry *dst_cache_per_cpu_get(struct dst_cache *dst_cache,
++ struct dst_cache_pcpu *idst)
++{
++ struct dst_entry *dst;
++
++ dst = idst->dst;
++ if (!dst)
++ goto fail;
++
++ /* the cache already hold a dst reference; it can't go away */
++ dst_hold(dst);
++
++ if (unlikely(!time_after(idst->refresh_ts, dst_cache->reset_ts) ||
++ (dst->obsolete && !dst->ops->check(dst, idst->cookie)))) {
++ dst_cache_per_cpu_dst_set(idst, NULL, 0);
++ dst_release(dst);
++ goto fail;
++ }
++ return dst;
++
++fail:
++ idst->refresh_ts = jiffies;
++ return NULL;
++}
++
++struct dst_entry *dst_cache_get(struct dst_cache *dst_cache)
++{
++ if (!dst_cache->cache)
++ return NULL;
++
++ return dst_cache_per_cpu_get(dst_cache, this_cpu_ptr(dst_cache->cache));
++}
++
++struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr)
++{
++ struct dst_cache_pcpu *idst;
++ struct dst_entry *dst;
++
++ if (!dst_cache->cache)
++ return NULL;
++
++ idst = this_cpu_ptr(dst_cache->cache);
++ dst = dst_cache_per_cpu_get(dst_cache, idst);
++ if (!dst)
++ return NULL;
++
++ *saddr = idst->in_saddr.s_addr;
++ return container_of(dst, struct rtable, dst);
++}
++
++void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst,
++ __be32 saddr)
++{
++ struct dst_cache_pcpu *idst;
++
++ if (!dst_cache->cache)
++ return;
++
++ idst = this_cpu_ptr(dst_cache->cache);
++ dst_cache_per_cpu_dst_set(idst, dst, 0);
++ idst->in_saddr.s_addr = saddr;
++}
++
++#if IS_ENABLED(CONFIG_IPV6)
++void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
++ const struct in6_addr *addr)
++{
++ struct dst_cache_pcpu *idst;
++
++ if (!dst_cache->cache)
++ return;
++
++ idst = this_cpu_ptr(dst_cache->cache);
++ dst_cache_per_cpu_dst_set(this_cpu_ptr(dst_cache->cache), dst,
++ rt6_get_cookie((struct rt6_info *)dst));
++ idst->in6_saddr = *addr;
++}
++
++struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache,
++ struct in6_addr *saddr)
++{
++ struct dst_cache_pcpu *idst;
++ struct dst_entry *dst;
++
++ if (!dst_cache->cache)
++ return NULL;
++
++ idst = this_cpu_ptr(dst_cache->cache);
++ dst = dst_cache_per_cpu_get(dst_cache, idst);
++ if (!dst)
++ return NULL;
++
++ *saddr = idst->in6_saddr;
++ return dst;
++}
++#endif
++
++int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp)
++{
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
++ BUG_ON(gfp & GFP_ATOMIC);
++ dst_cache->cache = alloc_percpu(struct dst_cache_pcpu);
++#else
++ dst_cache->cache = alloc_percpu_gfp(struct dst_cache_pcpu,
++ gfp | __GFP_ZERO);
++#endif
++ if (!dst_cache->cache)
++ return -ENOMEM;
++
++ dst_cache_reset(dst_cache);
++ return 0;
++}
++
++void dst_cache_destroy(struct dst_cache *dst_cache)
++{
++ int i;
++
++ if (!dst_cache->cache)
++ return;
++
++ for_each_possible_cpu(i)
++ dst_release(per_cpu_ptr(dst_cache->cache, i)->dst);
++
++ free_percpu(dst_cache->cache);
++}
+diff --git a/net/wireguard/compat/dst_cache/include/net/dst_cache.h b/net/wireguard/compat/dst_cache/include/net/dst_cache.h
+new file mode 100644
+index 000000000000..48021c0d6be1
+--- /dev/null
++++ b/net/wireguard/compat/dst_cache/include/net/dst_cache.h
+@@ -0,0 +1,97 @@
++#ifndef _WG_NET_DST_CACHE_H
++#define _WG_NET_DST_CACHE_H
++
++#include
++#include
++#if IS_ENABLED(CONFIG_IPV6)
++#include
++#endif
++
++struct dst_cache {
++ struct dst_cache_pcpu __percpu *cache;
++ unsigned long reset_ts;
++};
++
++/**
++ * dst_cache_get - perform cache lookup
++ * @dst_cache: the cache
++ *
++ * The caller should use dst_cache_get_ip4() if it need to retrieve the
++ * source address to be used when xmitting to the cached dst.
++ * local BH must be disabled.
++ */
++struct dst_entry *dst_cache_get(struct dst_cache *dst_cache);
++
++/**
++ * dst_cache_get_ip4 - perform cache lookup and fetch ipv4 source address
++ * @dst_cache: the cache
++ * @saddr: return value for the retrieved source address
++ *
++ * local BH must be disabled.
++ */
++struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr);
++
++/**
++ * dst_cache_set_ip4 - store the ipv4 dst into the cache
++ * @dst_cache: the cache
++ * @dst: the entry to be cached
++ * @saddr: the source address to be stored inside the cache
++ *
++ * local BH must be disabled.
++ */
++void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst,
++ __be32 saddr);
++
++#if IS_ENABLED(CONFIG_IPV6)
++
++/**
++ * dst_cache_set_ip6 - store the ipv6 dst into the cache
++ * @dst_cache: the cache
++ * @dst: the entry to be cached
++ * @saddr: the source address to be stored inside the cache
++ *
++ * local BH must be disabled.
++ */
++void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
++ const struct in6_addr *addr);
++
++/**
++ * dst_cache_get_ip6 - perform cache lookup and fetch ipv6 source address
++ * @dst_cache: the cache
++ * @saddr: return value for the retrieved source address
++ *
++ * local BH must be disabled.
++ */
++struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache,
++ struct in6_addr *saddr);
++#endif
++
++/**
++ * dst_cache_reset - invalidate the cache contents
++ * @dst_cache: the cache
++ *
++ * This do not free the cached dst to avoid races and contentions.
++ * the dst will be freed on later cache lookup.
++ */
++static inline void dst_cache_reset(struct dst_cache *dst_cache)
++{
++ dst_cache->reset_ts = jiffies;
++}
++
++/**
++ * dst_cache_init - initialize the cache, allocating the required storage
++ * @dst_cache: the cache
++ * @gfp: allocation flags
++ */
++int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp);
++
++/**
++ * dst_cache_destroy - empty the cache and free the allocated storage
++ * @dst_cache: the cache
++ *
++ * No synchronization is enforced: it must be called only when the cache
++ * is unused.
++ */
++void dst_cache_destroy(struct dst_cache *dst_cache);
++
++#endif /* _WG_NET_DST_CACHE_H */
+diff --git a/net/wireguard/compat/dstmetadata/include/net/dst_metadata.h b/net/wireguard/compat/dstmetadata/include/net/dst_metadata.h
+new file mode 100644
+index 000000000000..995094d4f099
+--- /dev/null
++++ b/net/wireguard/compat/dstmetadata/include/net/dst_metadata.h
+@@ -0,0 +1,3 @@
++#ifndef skb_valid_dst
++#define skb_valid_dst(skb) (!!skb_dst(skb))
++#endif
+diff --git a/net/wireguard/compat/fpu-x86/include/asm/fpu/api.h b/net/wireguard/compat/fpu-x86/include/asm/fpu/api.h
+new file mode 100644
+index 000000000000..f3f9117bcb88
+--- /dev/null
++++ b/net/wireguard/compat/fpu-x86/include/asm/fpu/api.h
+@@ -0,0 +1 @@
++#include
+diff --git a/net/wireguard/compat/intel-family-x86/include/asm/intel-family.h b/net/wireguard/compat/intel-family-x86/include/asm/intel-family.h
+new file mode 100644
+index 000000000000..35a6bc4da8ad
+--- /dev/null
++++ b/net/wireguard/compat/intel-family-x86/include/asm/intel-family.h
+@@ -0,0 +1,73 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++#ifndef _ASM_X86_INTEL_FAMILY_H
++#define _ASM_X86_INTEL_FAMILY_H
++
++/*
++ * "Big Core" Processors (Branded as Core, Xeon, etc...)
++ *
++ * The "_X" parts are generally the EP and EX Xeons, or the
++ * "Extreme" ones, like Broadwell-E.
++ *
++ * Things ending in "2" are usually because we have no better
++ * name for them. There's no processor called "SILVERMONT2".
++ */
++
++#define INTEL_FAM6_CORE_YONAH 0x0E
++
++#define INTEL_FAM6_CORE2_MEROM 0x0F
++#define INTEL_FAM6_CORE2_MEROM_L 0x16
++#define INTEL_FAM6_CORE2_PENRYN 0x17
++#define INTEL_FAM6_CORE2_DUNNINGTON 0x1D
++
++#define INTEL_FAM6_NEHALEM 0x1E
++#define INTEL_FAM6_NEHALEM_G 0x1F /* Auburndale / Havendale */
++#define INTEL_FAM6_NEHALEM_EP 0x1A
++#define INTEL_FAM6_NEHALEM_EX 0x2E
++
++#define INTEL_FAM6_WESTMERE 0x25
++#define INTEL_FAM6_WESTMERE_EP 0x2C
++#define INTEL_FAM6_WESTMERE_EX 0x2F
++
++#define INTEL_FAM6_SANDYBRIDGE 0x2A
++#define INTEL_FAM6_SANDYBRIDGE_X 0x2D
++#define INTEL_FAM6_IVYBRIDGE 0x3A
++#define INTEL_FAM6_IVYBRIDGE_X 0x3E
++
++#define INTEL_FAM6_HASWELL_CORE 0x3C
++#define INTEL_FAM6_HASWELL_X 0x3F
++#define INTEL_FAM6_HASWELL_ULT 0x45
++#define INTEL_FAM6_HASWELL_GT3E 0x46
++
++#define INTEL_FAM6_BROADWELL_CORE 0x3D
++#define INTEL_FAM6_BROADWELL_GT3E 0x47
++#define INTEL_FAM6_BROADWELL_X 0x4F
++#define INTEL_FAM6_BROADWELL_XEON_D 0x56
++
++#define INTEL_FAM6_SKYLAKE_MOBILE 0x4E
++#define INTEL_FAM6_SKYLAKE_DESKTOP 0x5E
++#define INTEL_FAM6_SKYLAKE_X 0x55
++#define INTEL_FAM6_KABYLAKE_MOBILE 0x8E
++#define INTEL_FAM6_KABYLAKE_DESKTOP 0x9E
++
++/* "Small Core" Processors (Atom) */
++
++#define INTEL_FAM6_ATOM_PINEVIEW 0x1C
++#define INTEL_FAM6_ATOM_LINCROFT 0x26
++#define INTEL_FAM6_ATOM_PENWELL 0x27
++#define INTEL_FAM6_ATOM_CLOVERVIEW 0x35
++#define INTEL_FAM6_ATOM_CEDARVIEW 0x36
++#define INTEL_FAM6_ATOM_SILVERMONT1 0x37 /* BayTrail/BYT / Valleyview */
++#define INTEL_FAM6_ATOM_SILVERMONT2 0x4D /* Avaton/Rangely */
++#define INTEL_FAM6_ATOM_AIRMONT 0x4C /* CherryTrail / Braswell */
++#define INTEL_FAM6_ATOM_MERRIFIELD 0x4A /* Tangier */
++#define INTEL_FAM6_ATOM_MOOREFIELD 0x5A /* Anniedale */
++#define INTEL_FAM6_ATOM_GOLDMONT 0x5C
++#define INTEL_FAM6_ATOM_DENVERTON 0x5F /* Goldmont Microserver */
++#define INTEL_FAM6_ATOM_GEMINI_LAKE 0x7A
++
++/* Xeon Phi */
++
++#define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */
++#define INTEL_FAM6_XEON_PHI_KNM 0x85 /* Knights Mill */
++
++#endif /* _ASM_X86_INTEL_FAMILY_H */
+diff --git a/net/wireguard/compat/memneq/include.h b/net/wireguard/compat/memneq/include.h
+new file mode 100644
+index 000000000000..2d18acd9b6c8
+--- /dev/null
++++ b/net/wireguard/compat/memneq/include.h
+@@ -0,0 +1,5 @@
++extern noinline unsigned long __crypto_memneq(const void *a, const void *b, size_t size);
++static inline int crypto_memneq(const void *a, const void *b, size_t size)
++{
++ return __crypto_memneq(a, b, size) != 0UL ? 1 : 0;
++}
+diff --git a/net/wireguard/compat/memneq/memneq.c b/net/wireguard/compat/memneq/memneq.c
+new file mode 100644
+index 000000000000..1c427d405537
+--- /dev/null
++++ b/net/wireguard/compat/memneq/memneq.c
+@@ -0,0 +1,170 @@
++/*
++ * Constant-time equality testing of memory regions.
++ *
++ * Authors:
++ *
++ * James Yonan
++ * Daniel Borkmann
++ *
++ * This file is provided under a dual BSD/GPLv2 license. When using or
++ * redistributing this file, you may do so under either license.
++ *
++ * GPL LICENSE SUMMARY
++ *
++ * Copyright(c) 2013 OpenVPN Technologies, Inc. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
++ * The full GNU General Public License is included in this distribution
++ * in the file called LICENSE.GPL.
++ *
++ * BSD LICENSE
++ *
++ * Copyright(c) 2013 OpenVPN Technologies, Inc. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * * Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * * Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ * * Neither the name of OpenVPN Technologies nor the names of its
++ * contributors may be used to endorse or promote products derived
++ * from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#include
++
++/* Make the optimizer believe the variable can be manipulated arbitrarily. */
++#define COMPILER_OPTIMIZER_HIDE_VAR(var) asm("" : "=r" (var) : "0" (var))
++
++#ifndef __HAVE_ARCH_CRYPTO_MEMNEQ
++
++/* Generic path for arbitrary size */
++static inline unsigned long
++__crypto_memneq_generic(const void *a, const void *b, size_t size)
++{
++ unsigned long neq = 0;
++
++#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
++ while (size >= sizeof(unsigned long)) {
++ neq |= *(unsigned long *)a ^ *(unsigned long *)b;
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ a += sizeof(unsigned long);
++ b += sizeof(unsigned long);
++ size -= sizeof(unsigned long);
++ }
++#endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
++ while (size > 0) {
++ neq |= *(unsigned char *)a ^ *(unsigned char *)b;
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ a += 1;
++ b += 1;
++ size -= 1;
++ }
++ return neq;
++}
++
++/* Loop-free fast-path for frequently used 16-byte size */
++static inline unsigned long __crypto_memneq_16(const void *a, const void *b)
++{
++ unsigned long neq = 0;
++
++#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
++ if (sizeof(unsigned long) == 8) {
++ neq |= *(unsigned long *)(a) ^ *(unsigned long *)(b);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned long *)(a+8) ^ *(unsigned long *)(b+8);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ } else if (sizeof(unsigned int) == 4) {
++ neq |= *(unsigned int *)(a) ^ *(unsigned int *)(b);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned int *)(a+4) ^ *(unsigned int *)(b+4);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned int *)(a+8) ^ *(unsigned int *)(b+8);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned int *)(a+12) ^ *(unsigned int *)(b+12);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ } else
++#endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
++ {
++ neq |= *(unsigned char *)(a) ^ *(unsigned char *)(b);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+1) ^ *(unsigned char *)(b+1);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+2) ^ *(unsigned char *)(b+2);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+3) ^ *(unsigned char *)(b+3);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+4) ^ *(unsigned char *)(b+4);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+5) ^ *(unsigned char *)(b+5);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+6) ^ *(unsigned char *)(b+6);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+7) ^ *(unsigned char *)(b+7);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+8) ^ *(unsigned char *)(b+8);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+9) ^ *(unsigned char *)(b+9);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+10) ^ *(unsigned char *)(b+10);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+11) ^ *(unsigned char *)(b+11);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+12) ^ *(unsigned char *)(b+12);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+13) ^ *(unsigned char *)(b+13);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+14) ^ *(unsigned char *)(b+14);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ neq |= *(unsigned char *)(a+15) ^ *(unsigned char *)(b+15);
++ COMPILER_OPTIMIZER_HIDE_VAR(neq);
++ }
++
++ return neq;
++}
++
++/* Compare two areas of memory without leaking timing information,
++ * and with special optimizations for common sizes. Users should
++ * not call this function directly, but should instead use
++ * crypto_memneq defined in crypto/algapi.h.
++ */
++noinline unsigned long __crypto_memneq(const void *a, const void *b,
++ size_t size)
++{
++ switch (size) {
++ case 16:
++ return __crypto_memneq_16(a, b);
++ default:
++ return __crypto_memneq_generic(a, b, size);
++ }
++}
++
++#endif /* __HAVE_ARCH_CRYPTO_MEMNEQ */
+diff --git a/net/wireguard/compat/neon-arm/include/asm/neon.h b/net/wireguard/compat/neon-arm/include/asm/neon.h
+new file mode 100644
+index 000000000000..980d831e201a
+--- /dev/null
++++ b/net/wireguard/compat/neon-arm/include/asm/neon.h
+@@ -0,0 +1,7 @@
++#ifndef _ARCH_ARM_ASM_NEON
++#define _ARCH_ARM_ASM_NEON
++#define kernel_neon_begin() \
++ BUILD_BUG_ON_MSG(1, "This kernel does not support ARM NEON")
++#define kernel_neon_end() \
++ BUILD_BUG_ON_MSG(1, "This kernel does not support ARM NEON")
++#endif
+diff --git a/net/wireguard/compat/ptr_ring/include/linux/ptr_ring.h b/net/wireguard/compat/ptr_ring/include/linux/ptr_ring.h
+new file mode 100644
+index 000000000000..9d514bac1388
+--- /dev/null
++++ b/net/wireguard/compat/ptr_ring/include/linux/ptr_ring.h
+@@ -0,0 +1,674 @@
++/* SPDX-License-Identifier: GPL-2.0-or-later */
++/*
++ * Definitions for the 'struct ptr_ring' datastructure.
++ *
++ * Author:
++ * Michael S. Tsirkin
++ *
++ * Copyright (C) 2016 Red Hat, Inc.
++ *
++ * This is a limited-size FIFO maintaining pointers in FIFO order, with
++ * one CPU producing entries and another consuming entries from a FIFO.
++ *
++ * This implementation tries to minimize cache-contention when there is a
++ * single producer and a single consumer CPU.
++ */
++
++#ifndef _LINUX_PTR_RING_H
++#define _LINUX_PTR_RING_H 1
++
++#ifdef __KERNEL__
++#include
++#include
++#include
++#include
++#include
++#include
++#include
++#endif
++
++struct ptr_ring {
++ int producer ____cacheline_aligned_in_smp;
++ spinlock_t producer_lock;
++ int consumer_head ____cacheline_aligned_in_smp; /* next valid entry */
++ int consumer_tail; /* next entry to invalidate */
++ spinlock_t consumer_lock;
++ /* Shared consumer/producer data */
++ /* Read-only by both the producer and the consumer */
++ int size ____cacheline_aligned_in_smp; /* max entries in queue */
++ int batch; /* number of entries to consume in a batch */
++ void **queue;
++};
++
++/* Note: callers invoking this in a loop must use a compiler barrier,
++ * for example cpu_relax().
++ *
++ * NB: this is unlike __ptr_ring_empty in that callers must hold producer_lock:
++ * see e.g. ptr_ring_full.
++ */
++static inline bool __ptr_ring_full(struct ptr_ring *r)
++{
++ return r->queue[r->producer];
++}
++
++static inline bool ptr_ring_full(struct ptr_ring *r)
++{
++ bool ret;
++
++ spin_lock(&r->producer_lock);
++ ret = __ptr_ring_full(r);
++ spin_unlock(&r->producer_lock);
++
++ return ret;
++}
++
++static inline bool ptr_ring_full_irq(struct ptr_ring *r)
++{
++ bool ret;
++
++ spin_lock_irq(&r->producer_lock);
++ ret = __ptr_ring_full(r);
++ spin_unlock_irq(&r->producer_lock);
++
++ return ret;
++}
++
++static inline bool ptr_ring_full_any(struct ptr_ring *r)
++{
++ unsigned long flags;
++ bool ret;
++
++ spin_lock_irqsave(&r->producer_lock, flags);
++ ret = __ptr_ring_full(r);
++ spin_unlock_irqrestore(&r->producer_lock, flags);
++
++ return ret;
++}
++
++static inline bool ptr_ring_full_bh(struct ptr_ring *r)
++{
++ bool ret;
++
++ spin_lock_bh(&r->producer_lock);
++ ret = __ptr_ring_full(r);
++ spin_unlock_bh(&r->producer_lock);
++
++ return ret;
++}
++
++/* Note: callers invoking this in a loop must use a compiler barrier,
++ * for example cpu_relax(). Callers must hold producer_lock.
++ * Callers are responsible for making sure pointer that is being queued
++ * points to a valid data.
++ */
++static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr)
++{
++ if (unlikely(!r->size) || r->queue[r->producer])
++ return -ENOSPC;
++
++ /* Make sure the pointer we are storing points to a valid data. */
++ /* Pairs with smp_read_barrier_depends in __ptr_ring_consume. */
++ smp_wmb();
++
++ WRITE_ONCE(r->queue[r->producer++], ptr);
++ if (unlikely(r->producer >= r->size))
++ r->producer = 0;
++ return 0;
++}
++
++/*
++ * Note: resize (below) nests producer lock within consumer lock, so if you
++ * consume in interrupt or BH context, you must disable interrupts/BH when
++ * calling this.
++ */
++static inline int ptr_ring_produce(struct ptr_ring *r, void *ptr)
++{
++ int ret;
++
++ spin_lock(&r->producer_lock);
++ ret = __ptr_ring_produce(r, ptr);
++ spin_unlock(&r->producer_lock);
++
++ return ret;
++}
++
++static inline int ptr_ring_produce_irq(struct ptr_ring *r, void *ptr)
++{
++ int ret;
++
++ spin_lock_irq(&r->producer_lock);
++ ret = __ptr_ring_produce(r, ptr);
++ spin_unlock_irq(&r->producer_lock);
++
++ return ret;
++}
++
++static inline int ptr_ring_produce_any(struct ptr_ring *r, void *ptr)
++{
++ unsigned long flags;
++ int ret;
++
++ spin_lock_irqsave(&r->producer_lock, flags);
++ ret = __ptr_ring_produce(r, ptr);
++ spin_unlock_irqrestore(&r->producer_lock, flags);
++
++ return ret;
++}
++
++static inline int ptr_ring_produce_bh(struct ptr_ring *r, void *ptr)
++{
++ int ret;
++
++ spin_lock_bh(&r->producer_lock);
++ ret = __ptr_ring_produce(r, ptr);
++ spin_unlock_bh(&r->producer_lock);
++
++ return ret;
++}
++
++static inline void *__ptr_ring_peek(struct ptr_ring *r)
++{
++ if (likely(r->size))
++ return READ_ONCE(r->queue[r->consumer_head]);
++ return NULL;
++}
++
++/*
++ * Test ring empty status without taking any locks.
++ *
++ * NB: This is only safe to call if ring is never resized.
++ *
++ * However, if some other CPU consumes ring entries at the same time, the value
++ * returned is not guaranteed to be correct.
++ *
++ * In this case - to avoid incorrectly detecting the ring
++ * as empty - the CPU consuming the ring entries is responsible
++ * for either consuming all ring entries until the ring is empty,
++ * or synchronizing with some other CPU and causing it to
++ * re-test __ptr_ring_empty and/or consume the ring enteries
++ * after the synchronization point.
++ *
++ * Note: callers invoking this in a loop must use a compiler barrier,
++ * for example cpu_relax().
++ */
++static inline bool __ptr_ring_empty(struct ptr_ring *r)
++{
++ if (likely(r->size))
++ return !r->queue[READ_ONCE(r->consumer_head)];
++ return true;
++}
++
++static inline bool ptr_ring_empty(struct ptr_ring *r)
++{
++ bool ret;
++
++ spin_lock(&r->consumer_lock);
++ ret = __ptr_ring_empty(r);
++ spin_unlock(&r->consumer_lock);
++
++ return ret;
++}
++
++static inline bool ptr_ring_empty_irq(struct ptr_ring *r)
++{
++ bool ret;
++
++ spin_lock_irq(&r->consumer_lock);
++ ret = __ptr_ring_empty(r);
++ spin_unlock_irq(&r->consumer_lock);
++
++ return ret;
++}
++
++static inline bool ptr_ring_empty_any(struct ptr_ring *r)
++{
++ unsigned long flags;
++ bool ret;
++
++ spin_lock_irqsave(&r->consumer_lock, flags);
++ ret = __ptr_ring_empty(r);
++ spin_unlock_irqrestore(&r->consumer_lock, flags);
++
++ return ret;
++}
++
++static inline bool ptr_ring_empty_bh(struct ptr_ring *r)
++{
++ bool ret;
++
++ spin_lock_bh(&r->consumer_lock);
++ ret = __ptr_ring_empty(r);
++ spin_unlock_bh(&r->consumer_lock);
++
++ return ret;
++}
++
++/* Must only be called after __ptr_ring_peek returned !NULL */
++static inline void __ptr_ring_discard_one(struct ptr_ring *r)
++{
++ /* Fundamentally, what we want to do is update consumer
++ * index and zero out the entry so producer can reuse it.
++ * Doing it naively at each consume would be as simple as:
++ * consumer = r->consumer;
++ * r->queue[consumer++] = NULL;
++ * if (unlikely(consumer >= r->size))
++ * consumer = 0;
++ * r->consumer = consumer;
++ * but that is suboptimal when the ring is full as producer is writing
++ * out new entries in the same cache line. Defer these updates until a
++ * batch of entries has been consumed.
++ */
++ /* Note: we must keep consumer_head valid at all times for __ptr_ring_empty
++ * to work correctly.
++ */
++ int consumer_head = r->consumer_head;
++ int head = consumer_head++;
++
++ /* Once we have processed enough entries invalidate them in
++ * the ring all at once so producer can reuse their space in the ring.
++ * We also do this when we reach end of the ring - not mandatory
++ * but helps keep the implementation simple.
++ */
++ if (unlikely(consumer_head - r->consumer_tail >= r->batch ||
++ consumer_head >= r->size)) {
++ /* Zero out entries in the reverse order: this way we touch the
++ * cache line that producer might currently be reading the last;
++ * producer won't make progress and touch other cache lines
++ * besides the first one until we write out all entries.
++ */
++ while (likely(head >= r->consumer_tail))
++ r->queue[head--] = NULL;
++ r->consumer_tail = consumer_head;
++ }
++ if (unlikely(consumer_head >= r->size)) {
++ consumer_head = 0;
++ r->consumer_tail = 0;
++ }
++ /* matching READ_ONCE in __ptr_ring_empty for lockless tests */
++ WRITE_ONCE(r->consumer_head, consumer_head);
++}
++
++static inline void *__ptr_ring_consume(struct ptr_ring *r)
++{
++ void *ptr;
++
++ ptr = __ptr_ring_peek(r);
++ if (ptr)
++ __ptr_ring_discard_one(r);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
++ /* The READ_ONCE in __ptr_ring_peek doesn't imply a barrier on old kernels. */
++ smp_read_barrier_depends();
++#endif
++
++ return ptr;
++}
++
++static inline int __ptr_ring_consume_batched(struct ptr_ring *r,
++ void **array, int n)
++{
++ void *ptr;
++ int i;
++
++ for (i = 0; i < n; i++) {
++ ptr = __ptr_ring_consume(r);
++ if (!ptr)
++ break;
++ array[i] = ptr;
++ }
++
++ return i;
++}
++
++/*
++ * Note: resize (below) nests producer lock within consumer lock, so if you
++ * call this in interrupt or BH context, you must disable interrupts/BH when
++ * producing.
++ */
++static inline void *ptr_ring_consume(struct ptr_ring *r)
++{
++ void *ptr;
++
++ spin_lock(&r->consumer_lock);
++ ptr = __ptr_ring_consume(r);
++ spin_unlock(&r->consumer_lock);
++
++ return ptr;
++}
++
++static inline void *ptr_ring_consume_irq(struct ptr_ring *r)
++{
++ void *ptr;
++
++ spin_lock_irq(&r->consumer_lock);
++ ptr = __ptr_ring_consume(r);
++ spin_unlock_irq(&r->consumer_lock);
++
++ return ptr;
++}
++
++static inline void *ptr_ring_consume_any(struct ptr_ring *r)
++{
++ unsigned long flags;
++ void *ptr;
++
++ spin_lock_irqsave(&r->consumer_lock, flags);
++ ptr = __ptr_ring_consume(r);
++ spin_unlock_irqrestore(&r->consumer_lock, flags);
++
++ return ptr;
++}
++
++static inline void *ptr_ring_consume_bh(struct ptr_ring *r)
++{
++ void *ptr;
++
++ spin_lock_bh(&r->consumer_lock);
++ ptr = __ptr_ring_consume(r);
++ spin_unlock_bh(&r->consumer_lock);
++
++ return ptr;
++}
++
++static inline int ptr_ring_consume_batched(struct ptr_ring *r,
++ void **array, int n)
++{
++ int ret;
++
++ spin_lock(&r->consumer_lock);
++ ret = __ptr_ring_consume_batched(r, array, n);
++ spin_unlock(&r->consumer_lock);
++
++ return ret;
++}
++
++static inline int ptr_ring_consume_batched_irq(struct ptr_ring *r,
++ void **array, int n)
++{
++ int ret;
++
++ spin_lock_irq(&r->consumer_lock);
++ ret = __ptr_ring_consume_batched(r, array, n);
++ spin_unlock_irq(&r->consumer_lock);
++
++ return ret;
++}
++
++static inline int ptr_ring_consume_batched_any(struct ptr_ring *r,
++ void **array, int n)
++{
++ unsigned long flags;
++ int ret;
++
++ spin_lock_irqsave(&r->consumer_lock, flags);
++ ret = __ptr_ring_consume_batched(r, array, n);
++ spin_unlock_irqrestore(&r->consumer_lock, flags);
++
++ return ret;
++}
++
++static inline int ptr_ring_consume_batched_bh(struct ptr_ring *r,
++ void **array, int n)
++{
++ int ret;
++
++ spin_lock_bh(&r->consumer_lock);
++ ret = __ptr_ring_consume_batched(r, array, n);
++ spin_unlock_bh(&r->consumer_lock);
++
++ return ret;
++}
++
++/* Cast to structure type and call a function without discarding from FIFO.
++ * Function must return a value.
++ * Callers must take consumer_lock.
++ */
++#define __PTR_RING_PEEK_CALL(r, f) ((f)(__ptr_ring_peek(r)))
++
++#define PTR_RING_PEEK_CALL(r, f) ({ \
++ typeof((f)(NULL)) __PTR_RING_PEEK_CALL_v; \
++ \
++ spin_lock(&(r)->consumer_lock); \
++ __PTR_RING_PEEK_CALL_v = __PTR_RING_PEEK_CALL(r, f); \
++ spin_unlock(&(r)->consumer_lock); \
++ __PTR_RING_PEEK_CALL_v; \
++})
++
++#define PTR_RING_PEEK_CALL_IRQ(r, f) ({ \
++ typeof((f)(NULL)) __PTR_RING_PEEK_CALL_v; \
++ \
++ spin_lock_irq(&(r)->consumer_lock); \
++ __PTR_RING_PEEK_CALL_v = __PTR_RING_PEEK_CALL(r, f); \
++ spin_unlock_irq(&(r)->consumer_lock); \
++ __PTR_RING_PEEK_CALL_v; \
++})
++
++#define PTR_RING_PEEK_CALL_BH(r, f) ({ \
++ typeof((f)(NULL)) __PTR_RING_PEEK_CALL_v; \
++ \
++ spin_lock_bh(&(r)->consumer_lock); \
++ __PTR_RING_PEEK_CALL_v = __PTR_RING_PEEK_CALL(r, f); \
++ spin_unlock_bh(&(r)->consumer_lock); \
++ __PTR_RING_PEEK_CALL_v; \
++})
++
++#define PTR_RING_PEEK_CALL_ANY(r, f) ({ \
++ typeof((f)(NULL)) __PTR_RING_PEEK_CALL_v; \
++ unsigned long __PTR_RING_PEEK_CALL_f;\
++ \
++ spin_lock_irqsave(&(r)->consumer_lock, __PTR_RING_PEEK_CALL_f); \
++ __PTR_RING_PEEK_CALL_v = __PTR_RING_PEEK_CALL(r, f); \
++ spin_unlock_irqrestore(&(r)->consumer_lock, __PTR_RING_PEEK_CALL_f); \
++ __PTR_RING_PEEK_CALL_v; \
++})
++
++/* Not all gfp_t flags (besides GFP_KERNEL) are allowed. See
++ * documentation for vmalloc for which of them are legal.
++ */
++static inline void **__ptr_ring_init_queue_alloc(unsigned int size, gfp_t gfp)
++{
++ if (size > KMALLOC_MAX_SIZE / sizeof(void *))
++ return NULL;
++ return kvmalloc(size * sizeof(void *), gfp | __GFP_ZERO);
++}
++
++static inline void __ptr_ring_set_size(struct ptr_ring *r, int size)
++{
++ r->size = size;
++ r->batch = SMP_CACHE_BYTES * 2 / sizeof(*(r->queue));
++ /* We need to set batch at least to 1 to make logic
++ * in __ptr_ring_discard_one work correctly.
++ * Batching too much (because ring is small) would cause a lot of
++ * burstiness. Needs tuning, for now disable batching.
++ */
++ if (r->batch > r->size / 2 || !r->batch)
++ r->batch = 1;
++}
++
++static inline int ptr_ring_init(struct ptr_ring *r, int size, gfp_t gfp)
++{
++ r->queue = __ptr_ring_init_queue_alloc(size, gfp);
++ if (!r->queue)
++ return -ENOMEM;
++
++ __ptr_ring_set_size(r, size);
++ r->producer = r->consumer_head = r->consumer_tail = 0;
++ spin_lock_init(&r->producer_lock);
++ spin_lock_init(&r->consumer_lock);
++
++ return 0;
++}
++
++/*
++ * Return entries into ring. Destroy entries that don't fit.
++ *
++ * Note: this is expected to be a rare slow path operation.
++ *
++ * Note: producer lock is nested within consumer lock, so if you
++ * resize you must make sure all uses nest correctly.
++ * In particular if you consume ring in interrupt or BH context, you must
++ * disable interrupts/BH when doing so.
++ */
++static inline void ptr_ring_unconsume(struct ptr_ring *r, void **batch, int n,
++ void (*destroy)(void *))
++{
++ unsigned long flags;
++ int head;
++
++ spin_lock_irqsave(&r->consumer_lock, flags);
++ spin_lock(&r->producer_lock);
++
++ if (!r->size)
++ goto done;
++
++ /*
++ * Clean out buffered entries (for simplicity). This way following code
++ * can test entries for NULL and if not assume they are valid.
++ */
++ head = r->consumer_head - 1;
++ while (likely(head >= r->consumer_tail))
++ r->queue[head--] = NULL;
++ r->consumer_tail = r->consumer_head;
++
++ /*
++ * Go over entries in batch, start moving head back and copy entries.
++ * Stop when we run into previously unconsumed entries.
++ */
++ while (n) {
++ head = r->consumer_head - 1;
++ if (head < 0)
++ head = r->size - 1;
++ if (r->queue[head]) {
++ /* This batch entry will have to be destroyed. */
++ goto done;
++ }
++ r->queue[head] = batch[--n];
++ r->consumer_tail = head;
++ /* matching READ_ONCE in __ptr_ring_empty for lockless tests */
++ WRITE_ONCE(r->consumer_head, head);
++ }
++
++done:
++ /* Destroy all entries left in the batch. */
++ while (n)
++ destroy(batch[--n]);
++ spin_unlock(&r->producer_lock);
++ spin_unlock_irqrestore(&r->consumer_lock, flags);
++}
++
++static inline void **__ptr_ring_swap_queue(struct ptr_ring *r, void **queue,
++ int size, gfp_t gfp,
++ void (*destroy)(void *))
++{
++ int producer = 0;
++ void **old;
++ void *ptr;
++
++ while ((ptr = __ptr_ring_consume(r)))
++ if (producer < size)
++ queue[producer++] = ptr;
++ else if (destroy)
++ destroy(ptr);
++
++ if (producer >= size)
++ producer = 0;
++ __ptr_ring_set_size(r, size);
++ r->producer = producer;
++ r->consumer_head = 0;
++ r->consumer_tail = 0;
++ old = r->queue;
++ r->queue = queue;
++
++ return old;
++}
++
++/*
++ * Note: producer lock is nested within consumer lock, so if you
++ * resize you must make sure all uses nest correctly.
++ * In particular if you consume ring in interrupt or BH context, you must
++ * disable interrupts/BH when doing so.
++ */
++static inline int ptr_ring_resize(struct ptr_ring *r, int size, gfp_t gfp,
++ void (*destroy)(void *))
++{
++ unsigned long flags;
++ void **queue = __ptr_ring_init_queue_alloc(size, gfp);
++ void **old;
++
++ if (!queue)
++ return -ENOMEM;
++
++ spin_lock_irqsave(&(r)->consumer_lock, flags);
++ spin_lock(&(r)->producer_lock);
++
++ old = __ptr_ring_swap_queue(r, queue, size, gfp, destroy);
++
++ spin_unlock(&(r)->producer_lock);
++ spin_unlock_irqrestore(&(r)->consumer_lock, flags);
++
++ kvfree(old);
++
++ return 0;
++}
++
++/*
++ * Note: producer lock is nested within consumer lock, so if you
++ * resize you must make sure all uses nest correctly.
++ * In particular if you consume ring in interrupt or BH context, you must
++ * disable interrupts/BH when doing so.
++ */
++static inline int ptr_ring_resize_multiple(struct ptr_ring **rings,
++ unsigned int nrings,
++ int size,
++ gfp_t gfp, void (*destroy)(void *))
++{
++ unsigned long flags;
++ void ***queues;
++ int i;
++
++ queues = kmalloc_array(nrings, sizeof(*queues), gfp);
++ if (!queues)
++ goto noqueues;
++
++ for (i = 0; i < nrings; ++i) {
++ queues[i] = __ptr_ring_init_queue_alloc(size, gfp);
++ if (!queues[i])
++ goto nomem;
++ }
++
++ for (i = 0; i < nrings; ++i) {
++ spin_lock_irqsave(&(rings[i])->consumer_lock, flags);
++ spin_lock(&(rings[i])->producer_lock);
++ queues[i] = __ptr_ring_swap_queue(rings[i], queues[i],
++ size, gfp, destroy);
++ spin_unlock(&(rings[i])->producer_lock);
++ spin_unlock_irqrestore(&(rings[i])->consumer_lock, flags);
++ }
++
++ for (i = 0; i < nrings; ++i)
++ kvfree(queues[i]);
++
++ kfree(queues);
++
++ return 0;
++
++nomem:
++ while (--i >= 0)
++ kvfree(queues[i]);
++
++ kfree(queues);
++
++noqueues:
++ return -ENOMEM;
++}
++
++static inline void ptr_ring_cleanup(struct ptr_ring *r, void (*destroy)(void *))
++{
++ void *ptr;
++
++ if (destroy)
++ while ((ptr = ptr_ring_consume(r)))
++ destroy(ptr);
++ kvfree(r->queue);
++}
++
++#endif /* _LINUX_PTR_RING_H */
+diff --git a/net/wireguard/compat/simd-asm/include/asm/simd.h b/net/wireguard/compat/simd-asm/include/asm/simd.h
+new file mode 100644
+index 000000000000..a975b38b5578
+--- /dev/null
++++ b/net/wireguard/compat/simd-asm/include/asm/simd.h
+@@ -0,0 +1,21 @@
++#ifndef _COMPAT_ASM_SIMD_H
++#define _COMPAT_ASM_SIMD_H
++
++#if defined(CONFIG_X86_64)
++#include
++#endif
++
++static __must_check inline bool may_use_simd(void)
++{
++#if defined(CONFIG_X86_64)
++ return irq_fpu_usable();
++#elif defined(CONFIG_ARM64) && defined(CONFIG_KERNEL_MODE_NEON)
++ return true;
++#elif defined(CONFIG_ARM) && defined(CONFIG_KERNEL_MODE_NEON)
++ return !in_nmi() && !in_irq() && !in_serving_softirq();
++#else
++ return false;
++#endif
++}
++
++#endif
+diff --git a/net/wireguard/compat/simd/include/linux/simd.h b/net/wireguard/compat/simd/include/linux/simd.h
+new file mode 100644
+index 000000000000..e7f2550320c7
+--- /dev/null
++++ b/net/wireguard/compat/simd/include/linux/simd.h
+@@ -0,0 +1,69 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++/*
++ * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++ */
++
++#ifndef _WG_SIMD_H
++#define _WG_SIMD_H
++
++#include
++#include
++#if defined(CONFIG_X86_64)
++#include
++#elif defined(CONFIG_KERNEL_MODE_NEON)
++#include
++#endif
++
++typedef enum {
++ HAVE_NO_SIMD = 1 << 0,
++ HAVE_FULL_SIMD = 1 << 1,
++ HAVE_SIMD_IN_USE = 1 << 31
++} simd_context_t;
++
++#define DONT_USE_SIMD ((simd_context_t []){ HAVE_NO_SIMD })
++
++static inline void simd_get(simd_context_t *ctx)
++{
++ *ctx = !IS_ENABLED(CONFIG_PREEMPT_RT) && !IS_ENABLED(CONFIG_PREEMPT_RT_BASE) && may_use_simd() ? HAVE_FULL_SIMD : HAVE_NO_SIMD;
++}
++
++static inline void simd_put(simd_context_t *ctx)
++{
++#if defined(CONFIG_X86_64)
++ if (*ctx & HAVE_SIMD_IN_USE)
++ kernel_fpu_end();
++#elif defined(CONFIG_KERNEL_MODE_NEON)
++ if (*ctx & HAVE_SIMD_IN_USE)
++ kernel_neon_end();
++#endif
++ *ctx = HAVE_NO_SIMD;
++}
++
++static inline bool simd_relax(simd_context_t *ctx)
++{
++#ifdef CONFIG_PREEMPT
++ if ((*ctx & HAVE_SIMD_IN_USE) && need_resched()) {
++ simd_put(ctx);
++ simd_get(ctx);
++ return true;
++ }
++#endif
++ return false;
++}
++
++static __must_check inline bool simd_use(simd_context_t *ctx)
++{
++ if (!(*ctx & HAVE_FULL_SIMD))
++ return false;
++ if (*ctx & HAVE_SIMD_IN_USE)
++ return true;
++#if defined(CONFIG_X86_64)
++ kernel_fpu_begin();
++#elif defined(CONFIG_KERNEL_MODE_NEON)
++ kernel_neon_begin();
++#endif
++ *ctx |= HAVE_SIMD_IN_USE;
++ return true;
++}
++
++#endif /* _WG_SIMD_H */
+diff --git a/net/wireguard/compat/siphash/include/linux/siphash.h b/net/wireguard/compat/siphash/include/linux/siphash.h
+new file mode 100644
+index 000000000000..3b30b3c47778
+--- /dev/null
++++ b/net/wireguard/compat/siphash/include/linux/siphash.h
+@@ -0,0 +1,134 @@
++/* Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved.
++ *
++ * This file is provided under a dual BSD/GPLv2 license.
++ *
++ * SipHash: a fast short-input PRF
++ * https://131002.net/siphash/
++ *
++ * This implementation is specifically for SipHash2-4 for a secure PRF
++ * and HalfSipHash1-3/SipHash1-3 for an insecure PRF only suitable for
++ * hashtables.
++ */
++
++#ifndef _WG_LINUX_SIPHASH_H
++#define _WG_LINUX_SIPHASH_H
++
++#include
++#include