Skip to content

Exclude service scripts, config files, and ectty.h from userspace master installs#152

Merged
sittner merged 2 commits intouspacefrom
copilot/remove-unnecessary-config-files
Mar 2, 2026
Merged

Exclude service scripts, config files, and ectty.h from userspace master installs#152
sittner merged 2 commits intouspacefrom
copilot/remove-unnecessary-config-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

--enable-uspace-master builds don't use kernel modules, service scripts, or TTY — but make install was unconditionally installing all of them. Kernel builds are unaffected.

Changes

script/Makefile.am

Wrap kernel-only install targets in if !ENABLE_USPACE_MASTER:

  • sbin_SCRIPTS (ethercatctl)
  • dist_sysconf_DATA (ethercat.conf)
  • systemdsystemunit_DATA (ethercat.service)
  • init_SCRIPTS + sys_DATA (init.d/ethercat, /etc/sysconfig/ethercat)

Bash completion continues to install unconditionally.

include/Makefile.am

Gate ectty.h (kernel TTY header) on ENABLE_TTY; add it to EXTRA_DIST when not installed so distribution tarballs remain complete:

if ENABLE_TTY
include_HEADERS = \
    $(builddir)/ecrt.h \
    ectp.h \
    ectty.h
else
include_HEADERS = \
    $(builddir)/ecrt.h \
    ectp.h
endif

if !ENABLE_TTY
EXTRA_DIST += ectty.h
endif
Original prompt

When building with --enable-uspace-master, make install currently installs files to /etc and installs ectty.h that are unnecessary and inappropriate for userspace builds. All configuration in userspace mode is done by the user program or the ec_master tool, so service scripts and config files should not be installed. The kernel build should NOT be changed.

Problem 1: script/Makefile.am installs config/service files to /etc

Currently, script/ is always included in the top-level SUBDIRS, so regardless of build mode these get installed:

  • ethercat.conf → installed to /etc/ethercat.conf via dist_sysconf_DATA (unnecessary in userspace — config is done by user program or ec_master tool)
  • ethercatctl → installed to sbin via sbin_SCRIPTS (unnecessary — there's no kernel module to manage)
  • ethercat.service → installed to systemd unit dir via systemdsystemunit_DATA (unnecessary)
  • init.d/ethercat → installed to /etc/init.d/ via init_SCRIPTS (unnecessary)
  • /etc/sysconfig/ethercat → installed via sys_DATA (unnecessary)

Fix: Guard dist_sysconf_DATA, sbin_SCRIPTS, systemd unit data, init.d scripts, and sysconfig data so they are only installed when NOT building userspace master. The bash completion can still be installed. One approach is to wrap the relevant lines in script/Makefile.am with if !ENABLE_USPACE_MASTER / endif conditionals so these files are only installed for kernel builds.

Problem 2: include/Makefile.am installs ectty.h

Currently in include/Makefile.am:

include_HEADERS = \
    $(builddir)/ecrt.h \
    ectp.h \
    ectty.h

ectty.h is a kernel-only TTY header and should NOT be installed in userspace builds.

Fix: Conditionally include ectty.h in include_HEADERS only when ENABLE_TTY is set (which is only relevant for kernel builds since TTY is a kernel module). When ENABLE_TTY is not set (which is the case in userspace builds), only install ecrt.h and ectp.h. Make sure to add ectty.h to EXTRA_DIST when it's not being installed so it's still included in distribution tarballs.

Important constraints:

  • The kernel build (--enable-kernel, the default) must NOT be changed at all — all files must still be installed exactly as before.
  • Only the userspace master build (--enable-uspace-master) should have these files excluded from make install.
  • The AM_CONDITIONAL(ENABLE_USPACE_MASTER, ...) already exists in configure.ac and can be used in Makefile.am conditionals.
  • The ENABLE_TTY conditional also already exists in configure.ac.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… non-TTY builds

Co-authored-by: sittner <1475582+sittner@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove installation of unnecessary files for userspace builds Exclude service scripts, config files, and ectty.h from userspace master installs Mar 2, 2026
@sittner sittner marked this pull request as ready for review March 2, 2026 08:36
@sittner sittner merged commit cdb426b into uspace Mar 2, 2026
@sittner sittner deleted the copilot/remove-unnecessary-config-files branch March 4, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants