1
0
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
Lakka-rk322x/packages/sysutils/busybox/package.mk
GavinDarkglider 3cc9dbb9ca
Switch: Tons of fixes, with poor commit history. lol. (#1839)
* Switch: Minor kernel config update

* fat32-boot: Attempt to fix umounting flash partition to prevent possible corruption on reboot

* Switch: Bootloader: Fix mistake in boot.txt that wasnt properly setting up dvfsb stuff

* Switch: Add user for retroarch to run as

* Busybox: Fix writing flash partition when using fat32-boot option to give all users write access

* Audio: Pulseaudio-configs: Minor updates for use when running apps as non root user

* Switch: Finalize changes so for running as non root user.

* Retroarch: Revert broken WAR in retroarch-config script

* Switch: Fix default retroarch config, to work out of box with new user

* Fix retroarch controller configs for switch, and add line to fix it to the update.sh file

* Add back missing lite gamepad config, which got lost in a rebase somewhere

* Retroarch: Start Reworking Switch Clocks

* Switch: Bump switch specific package versions, and add changes needed to make built in lakka clock speed menu work properly. Also hide gamemode.

* Retroarch: add patch to remove game mode from menu to all builds

* Switch: dont enable overclock by default

* sort

* Sort me.

* Switch: Drop old flycast from switch build in favor of newer core.

This has some issues with some games showing artifact bars using vulkan renderer,
but also fixes a lot of issues. As a work around to this issue, users can set opengl renderer, and the bars will not be there.

* More to sort

* Fix CEC stuff

* Fix dock audio switching with new user config

* WIP: GPU Clocks

* sort

* fix quotes

* Add working single joycon configs

* Update Switch Joycond to latest

* Switch: Retroarch: add bluetooth ertm disable, and add patch to fix l2cap kernel hang

* Switch: Update image stuff, so kernel reflects Lakka/Libreelec kernel makes in uimage header, and re-arange some things to make them global

* Switch: Linux: Enable Xpad Driver for wired xbox controllers

* Switch: More xpadneo stuff
This should at a minimum fix issues with Xbox One S controllers
8bitdo and GuliKit KingKong Controller families will probably need more
hid-core patching to redirect them to this driver for support.

Also, when 0.10 version of Xpadneo is released, It will stop building due to kernel not having this patch:
f07b3c1da9

When the time comes, this will need to be looked into.

* xpadneo: update package

* Switch: Update U-Boot to Switchroot 2023-NX03 version

* Switch: Update kernel to Switchroot 5.1.0

* Switch: Create Singular switch-bsp Package
This package consolodates the switch specific configs into one package,
as this feels cleaner, and easier to deal with later, if/when needed.
This package combines the switch-alsa-ucm and switch-bluetooth-dock stuff
into one package.

---------

Co-authored-by: Tomáš Kelemen (vudiq) <vudiq@vudiq.sk>
2023-06-10 03:17:06 +03:00

256 lines
8.5 KiB
Makefile

# 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() {
ROOT_PWD="$(${TOOLCHAIN}/bin/cryptpw -m sha512 ${ROOT_PASSWORD})"
echo "chmod 4755 ${INSTALL}/usr/bin/busybox" >> ${FAKEROOT_SCRIPT}
echo "chmod 000 ${INSTALL}/usr/cache/shadow" >> ${FAKEROOT_SCRIPT}
add_user root "${ROOT_PWD}" 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}" "$(${TOOLCHAIN}/bin/cryptpw -m sha512 "${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
}