summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2017-03-09 10:59:15 +1100
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2017-03-16 15:17:16 +1100
commit8107b37ad034f7fd201ed49dfcc7a8284e71de0a (patch)
tree1a2663bfcd2ec9bb70f28b86e51b0f1d1b945a74 /utils
parentd0602ed25e3bff8298c19bece8cd8b3f80d86624 (diff)
downloadpetitboot-8107b37ad034f7fd201ed49dfcc7a8284e71de0a.zip
petitboot-8107b37ad034f7fd201ed49dfcc7a8284e71de0a.tar.gz
utils/hooks: Don't fail early if fb0 missing
30-dtb-updates would exit early if the 'fb0' file was missing, however the set_stdout() step does not depend on this. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/hooks/30-dtb-updates.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/utils/hooks/30-dtb-updates.c b/utils/hooks/30-dtb-updates.c
index aff3844..66e7a77 100644
--- a/utils/hooks/30-dtb-updates.c
+++ b/utils/hooks/30-dtb-updates.c
@@ -576,20 +576,10 @@ static int write_devicetree(struct offb_ctx *ctx)
return rc;
}
-
-int main(void)
+static int set_offb(struct offb_ctx *ctx)
{
- struct offb_ctx *ctx;
int rc;
- ctx = talloc_zero(NULL, struct offb_ctx);
-
- ctx->dtb_name = getenv("boot_dtb");
- if (!ctx->dtb_name) {
- talloc_free(ctx);
- return EXIT_SUCCESS;
- }
-
rc = load_dtb(ctx);
if (rc)
goto out;
@@ -605,14 +595,39 @@ int main(void)
rc = populate_devicetree(ctx);
if (rc)
goto out;
+out:
+ return rc;
+}
- rc = set_stdout(ctx);
- if (rc)
- goto out;
- rc = write_devicetree(ctx);
+int main(void)
+{
+ struct offb_ctx *ctx;
+ int rc;
+
+ ctx = talloc_zero(NULL, struct offb_ctx);
+
+ ctx->dtb_name = getenv("boot_dtb");
+ if (!ctx->dtb_name) {
+ talloc_free(ctx);
+ return EXIT_SUCCESS;
+ }
+
+ if (set_offb(ctx)) {
+ warn("Failed offb setup step");
+ rc = -1;
+ }
+
+ if (set_stdout(ctx)) {
+ warn("Failed stdout setup step\n");
+ rc = -1;
+ }
+
+ if (write_devicetree(ctx)) {
+ warn("Failed to write back device tree\n");
+ rc = -1;
+ }
-out:
talloc_free(ctx);
return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}
OpenPOWER on IntegriCloud