Skip to content

Commit bc41c0d

Browse files
committed
Keep track of defconfig that's in use
This is useful for making sure that the right environment is in use.
1 parent c650572 commit bc41c0d

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ buildroot
22
.buildroot-downloaded
33
.buildroot-patched
44
*~
5+
.nerves-defconfig

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ reset-buildroot: .buildroot-downloaded
4343
update-patches: reset-buildroot .buildroot-patched
4444

4545
%_defconfig: $(TOPDIR)/configs/%_defconfig .buildroot-patched
46+
echo "$@" > .nerves-defconfig
4647
$(MAKE_BR) $@
4748

4849
buildroot/.config: .buildroot-patched
@@ -76,8 +77,8 @@ menuconfig: buildroot/.config
7677
$(MAKE_BR) savedefconfig
7778
@echo
7879
@echo "!!! Important !!!"
79-
@echo "1. Remember to copy buildroot/defconfig to the configs directory to save"
80-
@echo " the new settings."
80+
@echo "1. Remember to copy buildroot/defconfig to configs/$(shell cat .nerves-defconfig)"
81+
@echo " or another file in the configs directory to save the new settings."
8182
@echo "2. Buildroot normally requires you to run 'make clean' and 'make' after"
8283
@echo " changing the configuration. You don't technically have to do this,"
8384
@echo " but if you're new to Buildroot, it's best to be safe."
@@ -102,7 +103,7 @@ busybox-menuconfig: buildroot/.config
102103
clean: realclean
103104
distclean: realclean
104105
realclean:
105-
-rm -fr buildroot .buildroot-patched .buildroot-downloaded
106+
-rm -fr buildroot .buildroot-patched .buildroot-downloaded .nerves-defconfig
106107

107108
help:
108109
@echo 'Nerves SDK Help'

nerves-env.sh

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Source this script to setup your environment to cross-compile
4-
# and build Erlang apps for this nerves-sdk build.
4+
# and build Erlang apps for this Nerves build.
55

66
if [ "$SHELL" != "/bin/bash" ]; then
77
echo ERROR: This script currently only works from bash.
@@ -12,13 +12,31 @@ if [ "$0" != "bash" -a "$0" != "-bash" -a "$0" != "/bin/bash" ]; then
1212
echo ERROR: This scripted should be sourced from bash:
1313
echo
1414
echo source $BASH_SOURCE
15+
echo
1516
return 1
1617
exit 1
1718
fi
1819

1920
NERVES_ROOT=$(dirname $(readlink -f $BASH_SOURCE))
21+
NERVES_DEFCONFIG=`cat $NERVES_ROOT/.nerves-defconfig`
2022

2123
source $NERVES_ROOT/scripts/nerves-env-helper.sh $NERVES_ROOT
2224

23-
echo Shell environment updated for nerves
24-
echo Cross-compiler prefix: `basename $CROSSCOMPILE`
25+
echo "Shell environment updated for Nerves"
26+
echo
27+
echo "Nerves configuration: $NERVES_DEFCONFIG"
28+
echo "Cross-compiler prefix: `basename $CROSSCOMPILE`"
29+
if ! diff $NERVES_ROOT/configs/$NERVES_DEFCONFIG $NERVES_ROOT/buildroot/defconfig >/dev/null; then
30+
echo
31+
echo "----------------------------------------------------------------------------"
32+
echo "Your Nerves configuation (configs/$NERVES_DEFCONFIG) does not match"
33+
echo "$NERVES_ROOT/buildroot/defconfig!"
34+
echo "This means that you may have unsaved changes. This is ok if you're"
35+
echo "experimenting with Buildroot, but be sure to save or revert your changes"
36+
echo "when you are done."
37+
echo
38+
echo "Changes:"
39+
diff $NERVES_ROOT/configs/$NERVES_DEFCONFIG $NERVES_ROOT/buildroot/defconfig
40+
echo "----------------------------------------------------------------------------"
41+
echo
42+
fi

0 commit comments

Comments
 (0)