From 8b9aaddd2763b45b3bf02947b99958feedc8c7cb Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 5 Jun 2017 14:19:37 -0700 Subject: [PATCH] build: px4: allow to embed defaults file into ROMFS (cherry picked from commit f6d43aea25898c8b34d72e5068e8a4e8f41d03ee) --- Tools/ardupilotwaf/boards.py | 7 +++++++ Tools/ardupilotwaf/px4.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 78e5a67bec..0e8a46a67e 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -460,6 +460,12 @@ class px4(Board): # be searched for in sources and installed in ROMFS as rc.board. This # init script is used to change the init behavior among different boards. self.board_rc = False + + # Path relative to the ROMFS directory where to find a file with default + # parameters. If set this file will be copied to /etc/defaults.parm + # inside the ROMFS + self.param_defaults = None + self.ROMFS_EXCLUDE = [] def configure(self, cfg): @@ -504,6 +510,7 @@ class px4(Board): env.PX4_BOARD_NAME = self.board_name env.PX4_BOARD_RC = self.board_rc env.PX4_PX4IO_NAME = self.px4io_name + env.PX4_PARAM_DEFAULTS = self.param_defaults env.AP_PROGRAM_AS_STLIB = True diff --git a/Tools/ardupilotwaf/px4.py b/Tools/ardupilotwaf/px4.py index fec6e98be1..a770c6e696 100644 --- a/Tools/ardupilotwaf/px4.py +++ b/Tools/ardupilotwaf/px4.py @@ -200,6 +200,9 @@ def _process_romfs(self): board_rc = 'init.d/rc.%s' % bld.env.get_flat('PX4_BOARD_NAME') file_list.append((board_rc, 'init.d/rc.board')) + if bld.env.PX4_PARAM_DEFAULTS: + file_list.append((bld.env.PX4_PARAM_DEFAULTS, 'defaults.parm')) + romfs_src = bld.srcnode.find_dir(bld.env.PX4_ROMFS_SRC) romfs_bld = bld.bldnode.make_node(bld.env.PX4_ROMFS_BLD)