* [PATCH 1/2] docs: Document hexdump command
2023-07-26 18:50 [PATCH 0/2] Documentation on hexdump Glenn Washburn
@ 2023-07-26 18:50 ` Glenn Washburn
2023-07-26 18:50 ` [PATCH 2/2] docs: A note to cat that hexdump should be used for binary data Glenn Washburn
2023-07-27 3:43 ` [PATCH 0/2] Documentation on hexdump Oskari Pirhonen
2 siblings, 0 replies; 5+ messages in thread
From: Glenn Washburn @ 2023-07-26 18:50 UTC (permalink / raw)
To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
docs/grub.texi | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index dae10621b99f..5f6f0895ef4f 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -4361,6 +4361,7 @@ you forget a command, you can run the command @command{help}
* halt:: Shut down your computer
* hashsum:: Compute or check hash checksum
* help:: Show help messages
+* hexdump:: Show raw contents of a file or memory
* insmod:: Insert a module
* keystatus:: Check key modifier status
* list_env:: List variables in environment block
@@ -4979,6 +4980,20 @@ about each of the commands whose names begin with those @var{patterns}.
@end deffn
+@node hexdump
+@subsection hexdump
+
+@deffn Command hexdump [--skip offset] [--length len] FILE_OR_DEVICE
+Show raw contents of a file or memory. When option @option{--skip} is given,
+@samp{offset} number of bytes are skipped from the start of the device or
+file given. And @option{--length} allows specifying a maximum number of bytes
+to be shown.
+
+If given the special device named @samp{(mem)}, then the @samp{offset} given to
+@option{--skip} is treated as the address of a memory location to dump from.
+@end deffn
+
+
@node insmod
@subsection insmod
@@ -6170,7 +6185,6 @@ GRUB shell may provide more information on parameters and usage.
@item @command{gdbstub} - Start GDB stub on given port
@item @command{gdbstub_stop} - Stop GDB stub
@item @command{hdparm} - Get/set ATA disk parameters.
-@item @command{hexdump} - Show raw contents of a file or memory.
@item @command{hexdump_random} - Hexdump random data.
@item @command{inb} - Read 8-bit value from PORT.
@item @command{inl} - Read 32-bit value from PORT.
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] docs: A note to cat that hexdump should be used for binary data
2023-07-26 18:50 [PATCH 0/2] Documentation on hexdump Glenn Washburn
2023-07-26 18:50 ` [PATCH 1/2] docs: Document hexdump command Glenn Washburn
@ 2023-07-26 18:50 ` Glenn Washburn
2023-07-27 3:43 ` [PATCH 0/2] Documentation on hexdump Oskari Pirhonen
2 siblings, 0 replies; 5+ messages in thread
From: Glenn Washburn @ 2023-07-26 18:50 UTC (permalink / raw)
To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn
The cat command should not be used to print binary data because it can
show bytes not in the binary data and not show bytes that are in the data,
which can lead to confusion. This happens because cat does some processing
of the data stream, namely trying to decode substrings as UTF-8.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
docs/grub.texi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/docs/grub.texi b/docs/grub.texi
index 5f6f0895ef4f..71bd578c7a11 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -4541,6 +4541,12 @@ will be displayed as a simple new line. Otherwise, the carriage return will
be displayed as a control character (@samp{<d>}) to make it easier to see
when boot problems are caused by a file formatted using DOS-style line
endings.
+
+Note: @command{cat} can be used to view the contents of devices using the
+block list syntax (@pxref{Block list syntax}). However, it is not advised
+to view binary data because it will try to decode UTF-8 strings, which can
+lead to some bytes missing or added in the output. Instead, use the
+@command{hexdump} command (@pxref{hexdump}).
@end deffn
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] Documentation on hexdump
2023-07-26 18:50 [PATCH 0/2] Documentation on hexdump Glenn Washburn
2023-07-26 18:50 ` [PATCH 1/2] docs: Document hexdump command Glenn Washburn
2023-07-26 18:50 ` [PATCH 2/2] docs: A note to cat that hexdump should be used for binary data Glenn Washburn
@ 2023-07-27 3:43 ` Oskari Pirhonen
2023-08-11 15:56 ` Daniel Kiper
2 siblings, 1 reply; 5+ messages in thread
From: Oskari Pirhonen @ 2023-07-27 3:43 UTC (permalink / raw)
To: Glenn Washburn; +Cc: grub-devel, Daniel Kiper
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
On Wed, Jul 26, 2023 at 13:50:10 -0500, Glenn Washburn wrote:
> Add documentation on hexdump.
>
> Glenn
>
> Glenn Washburn (2):
> docs: Document hexdump command
> docs: A note to cat that hexdump should be used for binary data
>
> docs/grub.texi | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
LGTM
Reviewed-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
- Oskari
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Documentation on hexdump
2023-07-27 3:43 ` [PATCH 0/2] Documentation on hexdump Oskari Pirhonen
@ 2023-08-11 15:56 ` Daniel Kiper
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Kiper @ 2023-08-11 15:56 UTC (permalink / raw)
To: Glenn Washburn, grub-devel
On Wed, Jul 26, 2023 at 10:43:37PM -0500, Oskari Pirhonen wrote:
> On Wed, Jul 26, 2023 at 13:50:10 -0500, Glenn Washburn wrote:
> > Add documentation on hexdump.
> >
> > Glenn
> >
> > Glenn Washburn (2):
> > docs: Document hexdump command
> > docs: A note to cat that hexdump should be used for binary data
> >
> > docs/grub.texi | 22 +++++++++++++++++++++-
> > 1 file changed, 21 insertions(+), 1 deletion(-)
>
> LGTM
>
> Reviewed-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 5+ messages in thread