[PATCH] bootchooser: Fix initcall before environment is ready

Gavin Schenk g.schenk at eckelmann.de
Thu Dec 14 01:50:12 PST 2017


Some properties of bootchooser are initialized by NV variables.

Initialize bootchooser as postenvironment_initcall to ensure that
properties can be initialized correctly.

Signed-off-by: Gavin Schenk <g.schenk at eckelmann.de>
---

Hi,

I want to initialize bootchooser.reset_attempts=all-zero power-on on my
machine.

cat bootchooser.reset_attempts
'all-zero power-on' 

Wenn starting the machine with only build-in environment I got this
message:

envfs: no envfs (magic mismatch) - envfs never written?
failed to create nv variable bootchooser.reset_attempts: Invalid argument

And as result bootchooser.reset_attempts is empty :-(

Is this is a good way to fix this?


 common/bootchooser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/bootchooser.c b/common/bootchooser.c
index 83b15e0f7..4664b8a51 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -916,7 +916,7 @@ static int bootchooser_init(void)
 
 	return 0;
 }
-device_initcall(bootchooser_init);
+postenvironment_initcall(bootchooser_init);
 
 BAREBOX_MAGICVAR_NAMED(global_bootchooser_disable_on_zero_attempts,
 		       global.bootchooser.disable_on_zero_attempts,
-- 
2.15.1


-- 
Eckelmann AG
Vorstand: Dipl.-Ing. Peter Frankenbach (Sprecher) Dipl.-Wi.-Ing. Philipp Eckelmann
Dr.-Ing. Marco Münchhof Dr.-Ing. Frank Uhlemann
Vorsitzender des Aufsichtsrats: Hubertus G. Krossa
Stv. Vorsitzender des Aufsichtsrats: Dr.-Ing. Gerd Eckelmann
Sitz der Gesellschaft: Berliner Str. 161, 65205 Wiesbaden, Amtsgericht Wiesbaden HRB 12636
http://www.eckelmann.de



More information about the barebox mailing list