Skip to contentSkip to conversation

Add genimage.cfg coding style to Manual

PATCH Applied Giulio Benetti 2 participants 3 messages Nov 8, 2021

lore
Share & tools
lore
#0 lore raw

cover Add genimage.cfg coding style to Manual

Following my involuntary funny "beatify" :-) genimage patchset I send a patch to add an entry for genimage files to Buildroot manual. A real standard doesn't exist, so I've tried to invent one based on Linux C coding style and on what I see around.

As correctly pointed by Yann[1] there is no Linter for this kind of file, so this would lead to inconsistency again in the long time, so Arnout suggested to hack check-package[2] and I'll do that.

[1]: https://lists.buildroot.org/pipermail/buildroot/2021-November/627885.html
[2]: https://lists.buildroot.org/pipermail/buildroot/2021-November/627929.html

Best regards
Giulio Benetti
Benetti Engineering sas

Giulio Benetti (1):
docs/manual: add genimage.cfg file coding style standard

 docs/manual/writing-rules.txt | 62 +++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/1 docs/manual: add genimage.cfg file coding style standard

This patch adds the explanation for the genimage.cfg files coding standard. A real standard is not defined upstream by the genimage utility developers[1], but I try to give one here in Buildroot for consistency.

[1]: https://github.com/pengutronix/genimage

---
 docs/manual/writing-rules.txt | 62 +++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
docs/manual/writing-rules.txt +62 -0
index 3b809d5c48..28cb0fe4f1 100644
@@ -136,6 +136,68 @@ LIBFOO_POST_INSTALL_TARGET_HOOKS += LIBFOO_REMOVE_DATA
 endif
 ---------------------
 
+[[writing-genimage-cfg]]
+
+=== The +genimage.cfg+ file
+
++genimage.cfg+ files contain the output image layout that genimage utility
+uses to create final .img file.
+
+An example follows:
+
+---------------------
+image efi-part.vfat {
+	vfat {
+		file EFI {
+			image = "efi-part/EFI"
+		}
+
+		file Image {
+			image = "Image"
+		}
+	}
+
+	size = 32M
+}
+
+image sdimage.img {
+	hdimage {
+	}
+
+	partition u-boot {
+		image = "efi-part.vfat"
+		offset = 8K
+	}
+
+	partition root {
+		image = "rootfs.ext2"
+		size = 512M
+	}
+}
+---------------------
+
+* Every +section+(i.e. hdimage, vfat etc.), +partition+ must be indented
+  with one tab.
+
+* Every +file+ or other +subnode+ must be indented with two tabs.
+
+* Every node(+section+, +partition+, +file+, +subnode+) must have an open
+  curly bracket on the same line of the node's name, while the closing one
+  must be on a newline and after it a newline must be added except for the
+  last one node. Same goes for its option, for example option +size = +.
+
+* Every +option+(i.e. +image+, +offset+, +size+) must have the +=+
+  assignment one space from it and one space from the value specified.
+
+* Filename must at least begin with genimage prefix and have the .cfg
+  extension to be easy to recognize.
+
+The +genimage.cfg+ files are the input for the genimage tool used in
+Buildroot to generate the final image file(i.e. sdcard.img). For further
+details about the _genimage_ language, refer to
+https://github.com/pengutronix/genimage/blob/master/README.rst[].
+
+
 === The documentation
 
 The documentation uses the
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 1/1] docs/manual: add genimage.cfg file coding style standard

Quoted 7 lines · Giulio Benetti

This patch adds the explanation for the genimage.cfg files coding standard. A real standard is not defined upstream by the genimage utility developers[1], but I try to give one here in Buildroot for consistency.

[1]: https://github.com/pengutronix/genimage

Applied to master, thanks.

Regards,
Arnout

Quoted 68 lines
---
  docs/manual/writing-rules.txt | 62 +++++++++++++++++++++++++++++++++++
  1 file changed, 62 insertions(+)
docs/manual/writing-rules.txt +55 -0
index 3b809d5c48..28cb0fe4f1 100644
@@ -136,6 +136,68 @@ LIBFOO_POST_INSTALL_TARGET_HOOKS += LIBFOO_REMOVE_DATA
  endif
  ---------------------
 
+[[writing-genimage-cfg]]
+
+=== The +genimage.cfg+ file
+
++genimage.cfg+ files contain the output image layout that genimage utility
+uses to create final .img file.
+
+An example follows:
+
+---------------------
+image efi-part.vfat {
+	vfat {
+		file EFI {
+			image = "efi-part/EFI"
+		}
+
+		file Image {
+			image = "Image"
+		}
+	}
+
+	size = 32M
+}
+
+image sdimage.img {
+	hdimage {
+	}
+
+	partition u-boot {
+		image = "efi-part.vfat"
+		offset = 8K
+	}
+
+	partition root {
+		image = "rootfs.ext2"
+		size = 512M
+	}
+}
+---------------------
+
+* Every +section+(i.e. hdimage, vfat etc.), +partition+ must be indented
+  with one tab.
+
+* Every +file+ or other +subnode+ must be indented with two tabs.
+
+* Every node(+section+, +partition+, +file+, +subnode+) must have an open
+  curly bracket on the same line of the node's name, while the closing one
+  must be on a newline and after it a newline must be added except for the
+  last one node. Same goes for its option, for example option +size = +.
+
+* Every +option+(i.e. +image+, +offset+, +size+) must have the +=+
+  assignment one space from it and one space from the value specified.
+
+* Filename must at least begin with genimage prefix and have the .cfg
+  extension to be easy to recognize.

docs/manual/writing-rules.txt LIBFOO_POST_INSTALL_TARGET_HOOKS += LIBFOO_REMOVE_DATA · line 203

Quoted 10 lines
docs/manual/writing-rules.txt +7 -0
+
+The +genimage.cfg+ files are the input for the genimage tool used in
+Buildroot to generate the final image file(i.e. sdcard.img). For further
+details about the _genimage_ language, refer to
+https://github.com/pengutronix/genimage/blob/master/README.rst[].
+
+
  === The documentation
 
  The documentation uses the

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot