Skip to content

Commit

Permalink
Merge pull request batocera-linux#7139 from batocera-linux/batocera.c…
Browse files Browse the repository at this point in the history
…onf_default

batocera.conf default values by board
  • Loading branch information
nadenislamarre authored Sep 26, 2022
2 parents e8f935d + 1f4d6e6 commit 32c5003
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 31 deletions.
6 changes: 3 additions & 3 deletions package/batocera/core/batocera-audio/S27audioconfig
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ start_audioconfig() {
# and thus, we let splash before config here while udev is the services taking the most time

# set default device and volume
DEVICE=$(/usr/bin/batocera-settings-get audio.device)
PROFILE=$(/usr/bin/batocera-settings-get audio.profile)
VOLUME=$(/usr/bin/batocera-settings-get audio.volume)
DEVICE=$(/usr/bin/batocera-settings-get-master audio.device)
PROFILE=$(/usr/bin/batocera-settings-get-master audio.profile)
VOLUME=$(/usr/bin/batocera-settings-get-master audio.volume)
test -z "${DEVICE}" && DEVICE=auto
test -z "${PROFILE}" && PROFILE=auto
test -z "${VOLUME}" && VOLUME=80
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# this script can be used by values that can have a default value by board

KEY=$1

# prefer the user value
batocera-settings-get "${KEY}" && exit 0

BOARD_MODEL=$(cat /sys/firmware/devicetree/base/model 2>/dev/null | sed -e s+"[^A-Za-z0-9]"+"_"+g)
if test -z "${BOARD_MODEL}"
then
# give an other chance with dmi
BOARD_MODEL=$(cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null | sed -e s+"[^A-Za-z0-9]"+"_"+g)
fi

# prefer the board value
if test -e "/usr/share/batocera/sysconfigs/batocera.conf.${BOARD_MODEL}"
then
batocera-settings-get -f "/usr/share/batocera/sysconfigs/batocera.conf.${BOARD_MODEL}" "${KEY}" && exit 0
fi

# prefer the general value
if test -e "/usr/share/batocera/sysconfigs/batocera.conf"
then
batocera-settings-get -f "/usr/share/batocera/sysconfigs/batocera.conf" "${KEY}" && exit 0
fi

exit 1
4 changes: 4 additions & 0 deletions package/batocera/core/batocera-settings/batocera-settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ BATOCERA_SETTINGS_CONF_OPTS = \
-Dget_exe_name=batocera-settings-get \
-Dset_exe_name=batocera-settings-set

define BATOCERA_SETTINGS_INSTALL_TARGET_CMDS
install -m 0755 $(BR2_EXTERNAL_BATOCERA_PATH)/package/batocera/core/batocera-settings/batocera-settings-get-master $(TARGET_DIR)/usr/bin/batocera-settings-get-master
endef

$(eval $(meson-package))
32 changes: 4 additions & 28 deletions package/batocera/core/batocera-system/batocera-system.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,88 +13,60 @@ BATOCERA_SYSTEM_DEPENDENCIES = tzdata

ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_BCM2837),y)
BATOCERA_SYSTEM_ARCH=bcm2837
BATOCERA_SYSTEM_BATOCERA_CONF=bcm2837
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_RK3399),y)
BATOCERA_SYSTEM_ARCH=rk3399
BATOCERA_SYSTEM_BATOCERA_CONF=rk3399
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_RG552),y)
BATOCERA_SYSTEM_ARCH=rg552
BATOCERA_SYSTEM_BATOCERA_CONF=rg552
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_RK3288),y)
BATOCERA_SYSTEM_ARCH=rk3288
BATOCERA_SYSTEM_BATOCERA_CONF=rk3288
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_TRITIUM_H5),y)
BATOCERA_SYSTEM_ARCH=tritium_h5
BATOCERA_SYSTEM_BATOCERA_CONF=tritium_h5
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_ORANGEPI_ZERO2),y)
BATOCERA_SYSTEM_ARCH=orangepi_zero2
BATOCERA_SYSTEM_BATOCERA_CONF=orangepi_zero2
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_ORANGEPI_PC),y)
BATOCERA_SYSTEM_ARCH=orangepi_pc
BATOCERA_SYSTEM_BATOCERA_CONF=orangepi_pc
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_CHA),y)
BATOCERA_SYSTEM_ARCH=cha
BATOCERA_SYSTEM_BATOCERA_CONF=cha
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_S812),y)
BATOCERA_SYSTEM_ARCH=s812
BATOCERA_SYSTEM_BATOCERA_CONF=s812
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_S922X),y)
BATOCERA_SYSTEM_ARCH=s922x
BATOCERA_SYSTEM_BATOCERA_CONF=s922x
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_RK3326),y)
BATOCERA_SYSTEM_ARCH=rk3326
BATOCERA_SYSTEM_BATOCERA_CONF=rk3326
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_RK3128),y)
BATOCERA_SYSTEM_ARCH=rk3128
BATOCERA_SYSTEM_BATOCERA_CONF=rk3128
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_XU4),y)
BATOCERA_SYSTEM_ARCH=odroidxu4
BATOCERA_SYSTEM_BATOCERA_CONF=xu4
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_S905),y)
BATOCERA_SYSTEM_ARCH=s905
BATOCERA_SYSTEM_BATOCERA_CONF=s905
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_S905GEN2),y)
BATOCERA_SYSTEM_ARCH=s905gen2
BATOCERA_SYSTEM_BATOCERA_CONF=s905gen2
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_S905GEN3),y)
BATOCERA_SYSTEM_ARCH=s905gen3
BATOCERA_SYSTEM_BATOCERA_CONF=s905gen3
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_S912),y)
BATOCERA_SYSTEM_ARCH=s912
BATOCERA_SYSTEM_BATOCERA_CONF=s912
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_X86),y)
BATOCERA_SYSTEM_ARCH=x86
BATOCERA_SYSTEM_BATOCERA_CONF=x86
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_X86_64),y)
BATOCERA_SYSTEM_ARCH=x86_64
BATOCERA_SYSTEM_BATOCERA_CONF=x86_64
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_PS4),y)
BATOCERA_SYSTEM_ARCH=ps4
BATOCERA_SYSTEM_BATOCERA_CONF=ps4
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_ZNVER2),y)
BATOCERA_SYSTEM_ARCH=znver2
BATOCERA_SYSTEM_BATOCERA_CONF=znver2
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_BCM2836),y)
BATOCERA_SYSTEM_ARCH=bcm2836
BATOCERA_SYSTEM_BATOCERA_CONF=bcm2836
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_BCM2835),y)
BATOCERA_SYSTEM_ARCH=bcm2835
BATOCERA_SYSTEM_BATOCERA_CONF=bcm2835
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_RPIZERO2),y)
BATOCERA_SYSTEM_ARCH=rpizero2
BATOCERA_SYSTEM_BATOCERA_CONF=rpizero2
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_BCM2711),y)
BATOCERA_SYSTEM_ARCH=bcm2711
BATOCERA_SYSTEM_BATOCERA_CONF=bcm2711
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_ODIN),y)
BATOCERA_SYSTEM_ARCH=odin
BATOCERA_SYSTEM_BATOCERA_CONF=odin
else ifeq ($(BR2_PACKAGE_BATOCERA_TARGET_ORANGEPI_3_LTS),y)
BATOCERA_SYSTEM_ARCH=orangepi_3_lts
BATOCERA_SYSTEM_BATOCERA_CONF=orangepi_3_lts
else
BATOCERA_SYSTEM_ARCH=unknown
BATOCERA_SYSTEM_BATOCERA_CONF=unknown
endif

ifneq (,$(findstring dev,$(BATOCERA_SYSTEM_VERSION)))
Expand All @@ -117,6 +89,10 @@ define BATOCERA_SYSTEM_INSTALL_TARGET_CMDS
# batocera-boot.conf
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_BATOCERA_PATH)/package/batocera/core/batocera-system/batocera-boot.conf $(BINARIES_DIR)/batocera-boot.conf

# sysconfigs (default batocera.conf for boards)
mkdir -p $(TARGET_DIR)/usr/share/batocera/sysconfigs
test -d $(BR2_EXTERNAL_BATOCERA_PATH)/package/batocera/core/batocera-system/sysconfigs/${BATOCERA_SYSTEM_ARCH} && cp -pr $(BR2_EXTERNAL_BATOCERA_PATH)/package/batocera/core/batocera-system/sysconfigs/${BATOCERA_SYSTEM_ARCH}/* $(TARGET_DIR)/usr/share/batocera/sysconfigs

# mounts
mkdir -p $(TARGET_DIR)/boot $(TARGET_DIR)/overlay $(TARGET_DIR)/userdata

Expand Down

0 comments on commit 32c5003

Please sign in to comment.