Skip to content

Commit e3eae2d

Browse files
committed
Simplify nerves-config and select required packages
A whole lot of this hasn't been used in a long time so I started deleting parts. The automatic selection of required packages is pretty convenient so I added a few more to simplify system configuration.
1 parent dd40342 commit e3eae2d

File tree

4 files changed

+17
-94
lines changed

4 files changed

+17
-94
lines changed

package/nerves-config/Config.in

+9-65
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,17 @@ menuconfig BR2_PACKAGE_NERVES_CONFIG
33
select BR2_PACKAGE_ERLANG # Erlang is required for all Nerves systems
44
select BR2_PACKAGE_ERLINIT # Always use erlinit to boot
55
select BR2_PACKAGE_OPENSSL # Used for Erlang crypto
6+
select BR2_PACKAGE_FWUP # Used for OTA firmware updates
7+
select BR2_PACKAGE_NCURSES # IEx shell is near impossible to use without
8+
select BR2_PACKAGE_UBOOT_TOOLS # Required for Nerves firmware metadata
9+
select BR2_PACKAGE_BOARDID # ID board for assigning unique names
610
select BR2_PACKAGE_HOST_FWUP # Used by Nerves packaging tools
711
select BR2_PACKAGE_HOST_ERLANG_RELX # Used to create test .fw file
12+
select BR2_TARGET_ROOTFS_SQUASHFS # Nerves uses squashfs archives
813
help
9-
Nerves system configuration helper
14+
Nerves system configuration helper. This selects a set of packages
15+
used by all Nerves systems so that they're never accidentally omitted.
16+
This package used to do more, but has been trimmed down as functionality
17+
has moved into the Nerves tooling.
1018

1119
https://github.com/nerves-project/nerves_system_br
12-
13-
if BR2_PACKAGE_NERVES_CONFIG
14-
15-
choice
16-
prompt "erlinit.config"
17-
default BR2_PACKAGE_NERVES_CONFIG_GENERATE_ERLINIT_CONF
18-
help
19-
Select source of erlinit.config
20-
21-
config BR2_PACKAGE_NERVES_CONFIG_SPECIFY_ERLINIT_CONF
22-
bool "Specify erlinit.config"
23-
help
24-
Specify a path to an erlinit.config.
25-
26-
config BR2_PACKAGE_NERVES_CONFIG_NO_ERLINIT_CONF
27-
bool "No erlinit.config"
28-
help
29-
Do not include an erlinit.config. The generated image won't boot unless
30-
one is added using another mechanism.
31-
endchoice
32-
33-
if BR2_PACKAGE_NERVES_CONFIG_SPECIFY_ERLINIT_CONF
34-
35-
config BR2_PACKAGE_NERVES_CONFIG_ERLINIT_CONF_PATH
36-
string "Path to erlinit.config"
37-
default ""
38-
help
39-
Specify a path to erlinit.config
40-
41-
endif
42-
43-
config BR2_PACKAGE_NERVES_CONFIG_APPS
44-
string "Erlang apps to include"
45-
help
46-
Space-separated list of Erlang apps to include in the base
47-
Nerves image. The apps must be already be built or relx will
48-
fail.
49-
50-
config BR2_PACKAGE_NERVES_CONFIG_DISTRIBUTION
51-
bool "Enable Erlang distribution"
52-
default y
53-
help
54-
Enable Erlang distribution. You will also need to bring up the
55-
appropriate network interfaces at runtime for this to work.
56-
57-
if BR2_PACKAGE_NERVES_CONFIG_DISTRIBUTION
58-
config BR2_PACKAGE_NERVES_CONFIG_SNAME
59-
string "sname"
60-
default "demo"
61-
help
62-
Use the specified simple name for this node. This will be the
63-
sname for all nodes running the firmware release, so if you have
64-
multiple nodes running the same firmware, it is better to set the
65-
node name at runtime.
66-
67-
config BR2_PACKAGE_NERVES_CONFIG_COOKIE
68-
string "cookie"
69-
default "democookie"
70-
help
71-
The cookie to use for distributed Erlang
72-
endif
73-
74-
endif
75-

package/nerves-config/nerves-config.mk

+7-21
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,26 @@
77
# Remember to bump the version when anything changes in this
88
# directory.
99
NERVES_CONFIG_SOURCE =
10-
NERVES_CONFIG_VERSION = 0.5
10+
NERVES_CONFIG_VERSION = 0.6
1111

1212
NERVES_CONFIG_DEPENDENCIES = erlinit erlang host-erlang-relx host-fwup openssl
1313

1414
NERVES_CONFIG_PACKAGE_DIR = $(BR2_EXTERNAL_NERVES_PATH)/package/nerves-config
1515
NERVES_CONFIG_ERLANG_RELEASE_DIR = $(TARGET_DIR)/srv/erlang
1616

17-
NERVES_CONFIG_EXTRA_APPS += stdlib
18-
NERVES_CONFIG_ALL_APPS = $(subst $(space),$(comma),$(call qstrip,$(BR2_PACKAGE_NERVES_CONFIG_APPS) $(NERVES_CONFIG_EXTRA_APPS)))
19-
2017
define NERVES_CONFIG_BUILD_CMDS
2118
# Create the relx configuration file
22-
m4 -DAPPS="$(NERVES_CONFIG_ALL_APPS)" \
23-
$(NERVES_CONFIG_PACKAGE_DIR)/relx.config.m4 > $(@D)/relx.config
19+
m4 $(NERVES_CONFIG_PACKAGE_DIR)/relx.config.m4 > $(@D)/relx.config
2420

2521
# Create the vm.args file for starting the Erlang runtime
26-
m4 -DDISTRIBUTION=$(BR2_PACKAGE_NERVES_CONFIG_DISTRIBUTION) \
27-
-DSNAME=$(BR2_PACKAGE_NERVES_CONFIG_SNAME) \
28-
-DCOOKIE=$(BR2_PACKAGE_NERVES_CONFIG_COOKIE) \
29-
$(NERVES_CONFIG_PACKAGE_DIR)/vm.args.m4 > $(@D)/vm.args
22+
m4 $(NERVES_CONFIG_PACKAGE_DIR)/vm.args.m4 > $(@D)/vm.args
3023

3124
# Run relx to create a sample release. Real projects will have
3225
# their own relx.config scripts and be in a separate repo, but
3326
# this release is a good one for playing around with Nerves.
3427
NERVES_SDK_SYSROOT=$(HOST_DIR) $(RELX) $(NERVES_CONFIG_RELX_LIBDIRS) --vm_args $(@D)/vm.args -c $(@D)/relx.config
3528
endef
3629

37-
ifeq ($(BR2_PACKAGE_NERVES_CONFIG_SPECIFY_ERLINIT_CONF),y)
38-
define NERVES_CONFIG_INSTALL_ERLINIT
39-
cp $(BR2_PACKAGE_NERVES_CONFIG_ERLINIT_CONF_PATH) $(TARGET_DIR)/etc/erlinit.config
40-
endef
41-
endif
42-
4330
define NERVES_CONFIG_INSTALL_RELEASE
4431
# Copy the release that starts the shell over to the target
4532
rm -fr $(NERVES_CONFIG_ERLANG_RELEASE_DIR)
@@ -49,14 +36,13 @@ endef
4936

5037
define NERVES_CONFIG_INSTALL_TARGET_CMDS
5138
$(NERVES_CONFIG_INSTALL_RELEASE)
52-
$(NERVES_CONFIG_INSTALL_ERLINIT)
5339
endef
5440

5541
# This is tricky. We want the squashfs created by Buildroot to have everything
56-
# except for the OTP release. The squashfs tools can only append to filesystems,
57-
# so we'll want to append OTP releases frequently. If it were possible to modify
58-
# a squashfs after the fact, then we could skip this part, but this isn't possible
59-
# on non-Linux platforms (i.e. no fakeroot).
42+
# except for the OTP release. The squashfs tools can only append to
43+
# filesystems, so we'll want to append OTP releases frequently. If it were
44+
# possible to modify a squashfs after the fact, then we could skip this part,
45+
# but this isn't possible on non-Linux platforms (i.e. no fakeroot).
6046
ROOTFS_SQUASHFS_ARGS += -e srv
6147

6248
$(eval $(generic-package))

package/nerves-config/relx.config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{include_erts, false}.
22
{include_src, false}.
3-
{release, {nerves_config, "0.1.0"}, [APPS]}.
3+
{release, {nerves_config, "0.1.0"}, [stdlib, crypto]}.

package/nerves-config/vm.args.m4

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
ifelse(DISTRIBUTION, `y', `
2-
## Name of the node
3-
-sname SNAME
4-
5-
## Cookie for distributed erlang
6-
-setcookie COOKIE
7-
')
81
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
92
## (Disabled by default..use with caution!)
103
##-heart

0 commit comments

Comments
 (0)