diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-11-25 17:10:37 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-07 15:03:31 +0100 |
commit | 863a2251393e5ee5ecdd6d696ee0e23c3b945f9a (patch) | |
tree | 75667279ccba0ca22318016ed300b16d7a5dd7d0 /drivers/misc | |
parent | 22d06d7d72d781d16db7f8292181d51752e2a860 (diff) | |
download | barebox-863a2251393e5ee5ecdd6d696ee0e23c3b945f9a.tar.gz barebox-863a2251393e5ee5ecdd6d696ee0e23c3b945f9a.tar.xz |
state: make first boot less verbose
First boot with uninitialized state is needlessly verbose:
state: New state registered 'state'
state: Detected old on-storage format
ERROR: state: Error, invalid header crc in raw format, calculated 0x7bd5c66f, found 0x00000000
state: Ignoring broken bucket 0@0x00000000...
state: Detected old on-storage format
ERROR: state: Error, invalid header crc in raw format, calculated 0x7bd5c66f, found 0x00000000
state: Ignoring broken bucket 1@0x00040000...
state: Detected old on-storage format
ERROR: state: Error, invalid header crc in raw format, calculated 0x7bd5c66f, found 0x00000000
state: Ignoring broken bucket 2@0x00080000...
ERROR: state: Failed to find any valid state copy in any bucket
ERROR: state: Failed to read state with format raw, -2
This has confused barebox-state novices more than once. Let's handle
the zeroed state case specially and reduce output in that case, so
it now looks like this:
state: New state registered 'state'
state: Detected old on-storage format
state: Detected old on-storage format
state: Detected old on-storage format
state state.of: Fresh state detected, continuing with defaults
This is only the output when CRC is zero (hinting at zeroed state
partition). If crc != zero, then output is a little more verbose than
before:
state: New state registered 'state'
state: Detected old on-storage format
ERROR: state: init error: Invalid argument: header crc in raw format, calculated 0x7bd5c66f, found 0x00000000
state: Ignoring broken bucket 0@0x00000000...
state: Detected old on-storage format
ERROR: state: init error: Invalid argument: header crc in raw format, calculated 0x7bd5c66f, found 0x00000000
state: Ignoring broken bucket 1@0x00040000...
state: Detected old on-storage format
ERROR: state: init error: Invalid argument: header crc in raw format, calculated 0x7bd5c66f, found 0x00000000
state: Ignoring broken bucket 2@0x00080000...
ERROR: state: init error: No such file or directory: no valid state copy in any bucket
ERROR: state: init error: No such file or directory: format raw read failed
WARNING: state state.of: Failed to load persistent state, continuing with defaults, -2
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211125161042.3829996-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/state.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/state.c b/drivers/misc/state.c index 5da8e4ef91..cb0d9cf3ad 100644 --- a/drivers/misc/state.c +++ b/drivers/misc/state.c @@ -28,7 +28,9 @@ static int state_probe(struct device_d *dev) } ret = state_load(state); - if (ret) + if (ret == -ENOMEDIUM) + dev_info(dev, "Fresh state detected, continuing with defaults\n"); + else if (ret) dev_warn(dev, "Failed to load persistent state, continuing with defaults, %d\n", ret); |