package/io: New package
PATCH 1/1 package/io: New package
A utility to access memory/register via physicas address:
Raw memory i/o utility
io -v -1|2|4 -r|w [-l <len>] [-f <file>] <addr> [<value>]
-v Verbose, asks for confirmation
-1|2|4 Sets memory access size in bytes (default byte)
-l <len> Length in bytes of area to access (defaults to one access, or whole file length)
-r|w Read from or Write to memory (default read)
-f <file> File to write on memory read, or
to read on memory write
<addr> The memory address to access
<val> The value to write (implies -w)
Examples:
io 0x1000 Reads one byte from 0x1000
io 0x1000 0x12 Writes 0x12 to location 0x1000
io -2 -l 8 0x1000 Reads 8 words from 0x1000
io -r -f dmp -l 100 200 Reads 100 bytes from addr 200 to file
io -w -f img 0x10000 Writes the whole of file to memoryNote access size (-1|2|4) does not apply to file based accesses.
--- package/Config.in | 1 + package/io/Config.in | 6 ++++++ package/io/io.mk | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 package/io/Config.in create mode 100644 package/io/io.mk
package/Config.in +1 -0
@@ -2361,6 +2361,7 @@ menu "Miscellaneous" source "package/gr-osmosdr/Config.in" source "package/gsettings-desktop-schemas/Config.in" source "package/haveged/Config.in" + source "package/io/Config.in" source "package/linux-syscall-support/Config.in" source "package/mobile-broadband-provider-info/Config.in" source "package/netdata/Config.in"
package/io/Config.in new file +6 -0
@@ -0,0 +1,6 @@ +config BR2_PACKAGE_IO + bool "Raw memory i/o utility" + help + A utility for read/write memory/register + + https://github.com/andyshrk/io.git
package/io/io.mk new file +20 -0
@@ -0,0 +1,20 @@ +################################################################################ +# +# io +# +################################################################################ + +IO_VERSION = master +IO_SITE = $(call github,andyshrk,io,$(IO_VERSION)) +IO_LICENSE = GPL-2.0+ +IO_LICENSE_FILES = COPYING.GPL + +define IO_BUILD_CMDS + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/io.c -o $(@D)/io +endef + +define IO_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/io $(TARGET_DIR)/usr/bin/io +endef + +$(eval $(generic-package))
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Andy,
Quoted 3 lines · Andy Yan
A utility to access memory/register via physicas address:
Raw memory i/o utility
So this is basically busybox's devmem, right?
Quoted 11 lines
io -v -1|2|4 -r|w [-l <len>] [-f <file>] <addr> [<value>]
-v Verbose, asks for confirmation -1|2|4 Sets memory access size in bytes (default byte) -l <len> Length in bytes of area to access (defaults toone access, or whole file length)
-r|w Read from or Write to memory (default read)
-f <file> File to write on memory read, or
to read on memory write
<addr> The memory address to access
<val> The value to write (implies -w)
... but with additional features.
Quoted 8 lines
Examples:
io 0x1000 Reads one byte from 0x1000 io 0x1000 0x12 Writes 0x12 to location 0x1000 io -2 -l 8 0x1000 Reads 8 words from 0x1000 io -r -f dmp -l 100 200 Reads 100 bytes from addr 200 to file io -w -f img 0x10000 Writes the whole of file to memory
Quoted 7 lines
Note access size (-1|2|4) does not apply to file based accesses.
Signed-off-by Andy Yan <[email protected]>--- package/Config.in | 1 + package/io/Config.in | 6 ++++++ package/io/io.mk | 20 ++++++++++++++++++++
Please add yourself to the DEVELOPERS file [1] for this package. This way,
you'll get an e-mail if the package fails in the autobuilders, or when a new version is released if the package is registered on release-monitoring.org.
You are also missing a hash file with the hash of the downloaded tarball and
of the license file.
Quoted 34 lines
3 files changed, 27 insertions(+)create mode 100644 package/io/Config.in
create mode 100644package/io/io.mkpackage/Config.in +1
-0@@ -2361,6 +2361,7 @@ menu "Miscellaneous" source "package/gr-osmosdr/Config.in" source "package/gsettings-desktop-schemas/Config.in" source "package/haveged/Config.in" + source "package/io/Config.in" source "package/linux-syscall-support/Config.in" source "package/mobile-broadband-provider-info/Config.in" source "package/netdata/Config.in"package/io/Config.in new file +6
-0@@ -0,0 +1,6 @@ +config BR2_PACKAGE_IO + bool "Raw memory i/o utility" + help + A utility for read/write memory/register + + https://github.com/andyshrk/io.gitpackage/io/io.mk new file +0
-0
package/io/io.mk line 7
Quoted 7 lines
package/io/io.mk new file +7
-0@@ -0,0 +1,20 @@ +################################################################################ +# +# io +# +################################################################################ + +IO_VERSION = master
We don't want a branch, we only want a tag or commit hash.
package/io/io.mk line 8
Quoted 1 line
package/io/io.mk new file +1
-0+IO_SITE = $(call github,andyshrk,io,$(IO_VERSION))
You couldn't know of course, but we're moving away from using the tarballs for
github downloads, and instead prefer the git download method. So could you change this to something like:
IO_SITE = https://github.com/andyshrk/io.gitIO_SITE_METHOD = git
package/io/io.mk line 11
Quoted 3 lines
package/io/io.mk new file +3
-0+IO_LICENSE = GPL-2.0+ +IO_LICENSE_FILES = COPYING.GPL +
I guess this relies on CONFIG_DEVMEM to be set in the kernel. This should be
mentioned in the Config.in help text, and ideally something like this:
define IO_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_DEVMEM)
endef
package/io/io.mk line 20
Quoted 9 lines
package/io/io.mk new file +9
-0+define IO_BUILD_CMDS + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/io.c -o $(@D)/io +endef + +define IO_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/io $(TARGET_DIR)/usr/bin/io +endef + +$(eval $(generic-package))
Regards,
Arnout
[1] https://nightly.buildroot.org/#DEVELOPERS
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Arnout,
Quoted 8 lines · Arnout Vandecappelle via buildroot
Hi Andy,
Quoted 3 lines · Andy Yan
A utility to access memory/register via physicas address:
Raw memory i/o utility
So this is basically busybox's devmem, right?
Yes, it works like busybox devmem,but with more usefull features。 Such as it can read a piece of memory at a time, and if can dump a piece of memory to a file, or write a file content to a piece of memory。
It is very usefull when we debug a hardware IP block。
Quoted 35 lines
Quoted 7 lines
io -v -1|2|4 -r|w [-l <len>] [-f <file>] <addr> [<value>]
-v Verbose, asks for confirmation -1|2|4 Sets memory access size in bytes (default byte) -l <len> Length in bytes of area to access (defaults toQuoted 6 lines
one access, or whole file length)
-r|w Read from or Write to memory (default read)
-f <file> File to write on memory read, or
to read on memory write
<addr> The memory address to access
<val> The value to write (implies -w)... but with additional features.
Quoted 8 lines
Examples:
io 0x1000 Reads one byte from 0x1000 io 0x1000 0x12 Writes 0x12 to location 0x1000 io -2 -l 8 0x1000 Reads 8 words from 0x1000 io -r -f dmp -l 100 200 Reads 100 bytes from addr 200 to file io -w -f img 0x10000 Writes the whole of file to memoryQuoted 7 lines
Note access size (-1|2|4) does not apply to file based accesses.
Signed-off-by Andy Yan <[email protected]>--- package/Config.in | 1 + package/io/Config.in | 6 ++++++ package/io/io.mk | 20 ++++++++++++++++++++
Quoted 6 lines
Please add yourself to the DEVELOPERS file [1] for this package. This way,
you'll get an e-mail if the package fails in the autobuilders, or when a new version is released if the package is registered on release-monitoring.org.You are also missing a hash file with the hash of the downloaded tarball and
of the license file.
Will add in V2
Quoted 55 lines
Quoted 35 lines
3 files changed, 27 insertions(+)create mode 100644 package/io/Config.in
create mode 100644package/io/io.mkpackage/Config.in +1
-0@@ -2361,6 +2361,7 @@ menu "Miscellaneous" source "package/gr-osmosdr/Config.in" source "package/gsettings-desktop-schemas/Config.in" source "package/haveged/Config.in" + source "package/io/Config.in" source "package/linux-syscall-support/Config.in" source "package/mobile-broadband-provider-info/Config.in" source "package/netdata/Config.in"package/io/Config.in new file +6
-0@@ -0,0 +1,6 @@ +config BR2_PACKAGE_IO + bool "Raw memory i/o utility" + help + A utility for read/write memory/register + + https://github.com/andyshrk/io.gitpackage/io/io.mk new file +0
-0package/io/io.mk line 7
Quoted 7 lines
package/io/io.mk new file +7
-0@@ -0,0 +1,20 @@ +################################################################################ +# +# io +# +################################################################################ + +IO_VERSION = masterWe don't want a branch, we only want a tag or commit hash.
package/io/io.mk line 8
Quoted 1 line
package/io/io.mk new file +1
-0+IO_SITE = $(call github,andyshrk,io,$(IO_VERSION))You couldn't know of course, but we're moving away from using the tarballs for
github downloads, and instead prefer the git download method. So could you change this to something like:
IO_SITE= https://github.com/andyshrk/io.gitIO_SITE_METHOD= git
Quoted 6 lines
package/io/io.mk line 11
Quoted 3 lines
package/io/io.mk new file +3
-0+IO_LICENSE = GPL-2.0+ +IO_LICENSE_FILES = COPYING.GPL +I guess this relies on
CONFIG_DEVMEMto be set in the kernel. This should be
mentioned in the Config.in help text, and ideally something like this:
I will mention it in Config.in, as sometimes we may build a rootfs without linux kernel, i am not sure we shoud add this LINUX_CONFIG_FIXUPS or not.
Thanks for your review.
Quoted 19 lines
define
IO_LINUX_CONFIG_FIXUPS$(call KCONFIG_ENABLE_OPT,CONFIG_DEVMEM)endef
package/io/io.mk line 20
Quoted 9 lines
package/io/io.mk new file +9
-0+define IO_BUILD_CMDS + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/io.c -o $(@D)/io +endef + +define IO_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/io $(TARGET_DIR)/usr/bin/io +endef + +$(eval $(generic-package))Regards,
Arnout
Quoted 6 lines
[1] https://nightly.buildroot.org/#DEVELOPERS
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 5 lines · Andy Yan
Hi Arnout,
Quoted 1 line · Arnout Vandecappelle via buildroot
Hi Andy,
[snip]
Quoted 5 lines
Quoted 2 lines
I guess this relies on
CONFIG_DEVMEMto be set in the kernel. This should be
mentioned in the Config.in help text, and ideally something like this:I will mention it in Config.in, as sometimes we may build a rootfs without linux kernel, i am not sure we shoud add this
LINUX_CONFIG_FIXUPSor not.
LINUX_CONFIG_FIXUPS is ignored if you don't build the kernel from within
buildroot, so that's fine. The main question is: is there ever a situation where you can use this tool without having CONFIG_DEVMEM set? If not, it's probably better to add the fixup.
It's a bit a tricky decision in this case however, because CONFIG_DEVMEM is a
security black hole. If you accidentally leave the io tool enabled, you're forcing the kernel to build in this antifeature...
So on second thought, probably better not to include the LINUX_CONFIG_FIXUPS.
Regards,
Arnout
Quoted 27 lines
Thanks for your review.
Quoted 25 lines
define
IO_LINUX_CONFIG_FIXUPS$(call KCONFIG_ENABLE_OPT,CONFIG_DEVMEM)endef
package/io/io.mk line 20
Quoted 9 lines
package/io/io.mk new file +9
-0+define IO_BUILD_CMDS + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/io.c -o $(@D)/io +endef + +define IO_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/io $(TARGET_DIR)/usr/bin/io +endef + +$(eval $(generic-package))Regards,
Arnout[1] https://nightly.buildroot.org/#DEVELOPERS
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Arnout,
Quoted 20 lines · 在 2024-09-24 14:28:05,"Arnout Vandecappelle via buildroot"…
Quoted 5 lines · Andy Yan
Hi Arnout,
Quoted 1 line · Arnout Vandecappelle via buildroot
Hi Andy,
[snip]
Quoted 5 lines
Quoted 2 lines
I guess this relies on
CONFIG_DEVMEMto be set in the kernel. This should be
mentioned in the Config.in help text, and ideally something like this:I will mention it in Config.in, as sometimes we may build a rootfs without linux kernel, i am not sure we shoud add this
LINUX_CONFIG_FIXUPSor not.
LINUX_CONFIG_FIXUPSis ignored if you don't build the kernel from within
buildroot, so that's fine. The main question is: is there ever a situation where you can use this tool without havingCONFIG_DEVMEMset? If not, it's probably better to add the fixup.
Quoted 5 lines
It's a bit a tricky decision in this case however, because
CONFIG_DEVMEMis a
security black hole. If you accidentally leave the io tool enabled, you're forcing the kernel to build in this antifeature...So on second thought, probably better not to include the
LINUX_CONFIG_FIXUPS.
Okay, I will follow you suggestion.
Thank you.
Quoted 33 lines
Regards,
ArnoutQuoted 27 lines
Thanks for your review.
Quoted 25 lines
define
IO_LINUX_CONFIG_FIXUPS$(call KCONFIG_ENABLE_OPT,CONFIG_DEVMEM)endef
package/io/io.mk line 20
Quoted 9 lines
package/io/io.mk new file +9
-0+define IO_BUILD_CMDS + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/io.c -o $(@D)/io +endef + +define IO_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/io $(TARGET_DIR)/usr/bin/io +endef + +$(eval $(generic-package))Regards,
Arnout[1] https://nightly.buildroot.org/#DEVELOPERS
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 4 lines
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot