Skip to content

Commit

Permalink
UBUNTU: [Packaging] remove debian/scripts/misc/arch-has-odm-enabled.sh
Browse files Browse the repository at this point in the history
On Ubuntu, /bin/sh is a symlink to /bin/dash by default.

While this is a rare use case, when /bin/sh is a symlink to /bin/bash,
the annotation check fails due to a mismatch of CONFIG_UBUNTU_ODM_DRIVERS.

debian/scripts/misc/arch-has-odm-enabled.sh always fails with bash.

You can see it if you directly execute it.

[with dash]

  $ dash debian/scripts/misc/arch-has-odm-enabled.sh amd64
  cat: debian/scripts/misc/../../../debian.master/rules.d/hooks.mk: No such file or directory
  $ echo $?
  0

[with bash]

  $ bash debian/scripts/misc/arch-has-odm-enabled.sh amd64
  cat: debian/scripts/misc/../../../debian.master/rules.d/hooks.mk: No such file or directory
  debian/scripts/misc/arch-has-odm-enabled.sh: line 26: return: can only `return' from a function or sourced script
  $ echo $?
  2

Bash provides stricter checks, hence the 'return' statement outside
a function leads to an error.

While it is trivial to fix, I wonder if we need this script in the
first place. Its purpose is to make CONFIG_UBUNTU_ODM_DRIVERS a
user-unconfigurable option.

Given debian.*/config/annotations specifying the CONFIG set for each
arch/flavour, why not handle CONFIG_UBUNTU_ODM_DRIVERS just like
other normal CONFIG options? Users are still allow to toggle it from
menuconfig etc., but I do not see a significant issue, as any trouble
comes to users' responsibility when they change CONFIG options by
themselves.

Signed-off-by: Masahiro Yamada <[email protected]>
Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
masahir0y authored and Andrea Righi committed Apr 4, 2024
1 parent 9c85bd8 commit 056f438
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 37 deletions.
2 changes: 1 addition & 1 deletion debian.master/config/annotations
Original file line number Diff line number Diff line change
Expand Up @@ -14122,7 +14122,7 @@ CONFIG_UBSAN_SHIFT policy<{'amd64': 'y', 'arm64': '
CONFIG_UBSAN_TRAP policy<{'amd64': 'n', 'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 's390x': 'n'}>
CONFIG_UBSAN_UNREACHABLE policy<{'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 's390x': 'n'}>
CONFIG_UBUNTU_HOST policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm', 's390x': 'm'}>
CONFIG_UBUNTU_ODM_DRIVERS policy<{'amd64': 'y'}>
CONFIG_UBUNTU_ODM_DRIVERS policy<{'amd64': 'y', 'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 'riscv64': 'n', 's390x': 'n'}>
CONFIG_UCC policy<{'arm64': 'y', 'armhf': 'y', 'ppc64el': 'y'}>
CONFIG_UCC_FAST policy<{'arm64': 'y', 'armhf': 'y', 'ppc64el': 'y'}>
CONFIG_UCC_SLOW policy<{'arm64': 'y', 'armhf': 'y', 'ppc64el': 'y'}>
Expand Down
1 change: 0 additions & 1 deletion debian.master/rules.d/amd64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ do_tools_x86 = true
do_tools_hyperv = true
do_extras_package = true
do_tools_acpidbg = true
do_odm_drivers = true
do_lib_rust = true
4 changes: 0 additions & 4 deletions debian/rules.d/0-common-vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ endif
# common headers normally is built as an indep package, but may be arch
do_common_headers_indep=true

# Add an option to enable special drivers which should only be build when
# explicitly enabled.
do_odm_drivers=false

# build tools
ifneq ($(wildcard $(CURDIR)/tools),)
ifeq ($(do_tools),)
Expand Down
1 change: 0 additions & 1 deletion debian/rules.d/1-maintainer.mk
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ printenv:
@echo "do_flavour_image_package = $(do_flavour_image_package)"
@echo "do_flavour_header_package = $(do_flavour_header_package)"
@echo "do_common_headers_indep = $(do_common_headers_indep)"
@echo "do_odm_drivers = $(do_odm_drivers)"
@echo "do_lib_rust = $(do_lib_rust)"
@echo "do_tools = $(do_tools)"
@echo "do_tools_common = $(do_tools_common)"
Expand Down
3 changes: 0 additions & 3 deletions debian/rules.d/2-binary-arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ $(stampdir)/stamp-prepare-tree-%: debian/scripts/fix-filenames
touch $(builddir)/build-$*/ubuntu-build
python3 debian/scripts/misc/annotations --export --arch $(arch) --flavour $(target_flavour) > $(builddir)/build-$*/.config
sed -i 's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$* $(raw_kernelversion)"/' $(builddir)/build-$*/.config
[ "$(do_odm_drivers)" = 'true' ] && true || \
sed -ie 's/.*CONFIG_UBUNTU_ODM_DRIVERS.*/# CONFIG_UBUNTU_ODM_DRIVERS is not set/' \
$(builddir)/build-$*/.config
find $(builddir)/build-$* -name "*.ko" | xargs rm -f
$(kmake) O=$(builddir)/build-$* $(conc_level) rustavailable || true
$(kmake) O=$(builddir)/build-$* $(conc_level) olddefconfig
Expand Down
26 changes: 0 additions & 26 deletions debian/scripts/misc/arch-has-odm-enabled.sh

This file was deleted.

2 changes: 1 addition & 1 deletion ubuntu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ menu "Ubuntu Supplied Third-Party Device Drivers"


config UBUNTU_ODM_DRIVERS
def_bool $(success,$(srctree)/debian/scripts/misc/arch-has-odm-enabled.sh $(DEB_ARCH))
bool "Ubuntu ODM supplied drivers"
help
Turn on support for Ubuntu ODM supplied drivers

Expand Down

0 comments on commit 056f438

Please sign in to comment.