xxd tool is nice when you want to get hex output from a file. Dump whole flash from the device:
$ xxd /dev/mtdX Capture the output from terminal (I used tee), do some basic vim magic and on host pc recreate binary: $ xxd -r /name/of/hex/dump /name/of/output/binary/file Package is also cleaned up. Signed-off-by: Luka Perkov <open...@lukaperkov.net> --- utils/vim/Makefile | 73 +++++++++++++++++------------ utils/vim/files/vimrc | 23 +++++---- utils/vim/files/vimrc.full | 40 ++++++++-------- utils/vim/patches/001-cross_compile.patch | 9 ++-- 4 files changed, 79 insertions(+), 66 deletions(-) diff --git a/utils/vim/Makefile b/utils/vim/Makefile index 230b5d4..277fd30 100644 --- a/utils/vim/Makefile +++ b/utils/vim/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2010 OpenWrt.org +# Copyright (C) 2006-2012 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -50,6 +50,13 @@ define Package/vim-help TITLE+= (help files) endef +define Package/xxd + SECTION:=utils + CATEGORY:=Utilities + TITLE:=make a hexdump or do the reverse + URL:=http://www.vim.org/ +endef + define Package/vim-full/conffiles /usr/share/vim/vimrc endef @@ -59,25 +66,29 @@ define Package/vim/conffiles endef define Package/vim/description - Vim is an almost compatible version of the UNIX editor Vi. - (Tiny build) + Vim is an almost compatible version of the UNIX editor Vi. + (Tiny build) endef define Package/vim-full/description - Vim is an almost compatible version of the UNIX editor Vi. - (Normal build) + Vim is an almost compatible version of the UNIX editor Vi. + (Normal build) endef define Package/vim-runtime/description - Vim is an almost compatible version of the UNIX editor Vi. - (Runtime files) + Vim is an almost compatible version of the UNIX editor Vi. + (Runtime files) endef define Package/vim-help/description - Vim is an almost compatible version of the UNIX editor Vi. - (Help files) + Vim is an almost compatible version of the UNIX editor Vi. + (Help files) +endef + +define Package/xxd/description + xxd creates a hex dump of a given file or standard input, it can also convert + a hex dump back to its original binary form. endef - CONFIGURE_ARGS += \ --disable-gui \ @@ -90,25 +101,24 @@ CONFIGURE_ARGS += \ --with-tlib=ncurses CONFIGURE_VARS += \ - vim_cv_getcwd_broken=no \ - vim_cv_memmove_handles_overlap=yes \ - vim_cv_stat_ignores_slash=yes \ - vim_cv_tgetent=zero \ - vim_cv_terminfo=yes \ - vim_cv_toupper_broken=no \ - vim_cv_tty_group=root \ - vim_cv_tty_mode=0620 + vim_cv_getcwd_broken=no \ + vim_cv_memmove_handles_overlap=yes \ + vim_cv_stat_ignores_slash=yes \ + vim_cv_tgetent=zero \ + vim_cv_terminfo=yes \ + vim_cv_toupper_broken=no \ + vim_cv_tty_group=root \ + vim_cv_tty_mode=0620 ifneq ($(CONFIG_PACKAGE_vim),) define Build/Compile/vim $(call Build/Configure/Default, \ - --with-features=tiny \ - --disable-multibyte \ - ) + --with-features=tiny \ + --disable-multibyte \ + ) $(MAKE) -C $(PKG_BUILD_DIR) clean $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - all + DESTDIR="$(PKG_INSTALL_DIR)" all $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_tiny endef endif @@ -116,13 +126,12 @@ endif ifneq ($(CONFIG_PACKAGE_vim-full),) define Build/Compile/vim-full $(call Build/Configure/Default, \ - --with-features=normal \ - --enable-multibyte \ + --with-features=normal \ + --enable-multibyte \ ) $(MAKE) -C $(PKG_BUILD_DIR) clean $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - all + DESTDIR="$(PKG_INSTALL_DIR)" all $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_normal endef endif @@ -134,9 +143,6 @@ define Build/Compile/vim-runtime rm -rf $(PKG_INSTALL_DIR)/usr/man endef -define Build/Configure -endef - define Build/Compile $(call Build/Compile/vim) $(call Build/Compile/vim-full) @@ -167,8 +173,13 @@ define Package/vim-help/install tar -C $(1) -xf $(PKG_BUILD_DIR)/docs.tar endef +define Package/xxd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/xxd/xxd $(1)/usr/bin +endef + $(eval $(call BuildPackage,vim)) $(eval $(call BuildPackage,vim-full)) $(eval $(call BuildPackage,vim-runtime)) $(eval $(call BuildPackage,vim-help)) - +$(eval $(call BuildPackage,xxd)) diff --git a/utils/vim/files/vimrc b/utils/vim/files/vimrc index 792d680..00b952d 100644 --- a/utils/vim/files/vimrc +++ b/utils/vim/files/vimrc @@ -1,13 +1,12 @@ -set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -set ignorecase " Do case insensitive matching -set incsearch " Incremental search -set autowrite " Automatically save before commands like :next and :make -set nocompatible " Use Vim defaults instead of 100% vi compatibility -set backspace=indent,eol,start " more powerful backspacing -set autoindent " always set autoindenting on -set linebreak " Don't wrap words by default -set textwidth=0 " Don't wrap lines by default -set ruler " show the cursor position all the time - +set showcmd " show (partial) command in status line +set showmatch " show matching brackets +set ignorecase " do case insensitive matching +set incsearch " incremental search +set autowrite " automatically save before commands like :next and :make +set nocompatible " use vim defaults instead of 100% vi compatibility +set backspace=indent,eol,start " more powerful backspacing +set autoindent " always set autoindenting on +set linebreak " don't wrap words by default +set textwidth=0 " don't wrap lines by default +set ruler " show the cursor position all the time diff --git a/utils/vim/files/vimrc.full b/utils/vim/files/vimrc.full index 65322f8..114cf07 100644 --- a/utils/vim/files/vimrc.full +++ b/utils/vim/files/vimrc.full @@ -1,24 +1,24 @@ -set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -set ignorecase " Do case insensitive matching -set incsearch " Incremental search -set autowrite " Automatically save before commands like :next and :make -set nocompatible " Use Vim defaults instead of 100% vi compatibility -set backspace=indent,eol,start " more powerful backspacing -set autoindent " always set autoindenting on -set linebreak " Don't wrap words by default -set textwidth=0 " Don't wrap lines by default -set ruler " show the cursor position all the time +set showcmd " show (partial) command in status line +set showmatch " show matching brackets +set ignorecase " do case insensitive matching +set incsearch " incremental search +set autowrite " automatically save before commands like :next and :make +set nocompatible " use Vim defaults instead of 100% vi compatibility +set backspace=indent,eol,start " more powerful backspacing +set autoindent " always set autoindenting on +set linebreak " don't wrap words by default +set textwidth=0 " don't wrap lines by default +set ruler " show the cursor position all the time if filereadable(expand("$VIMRUNTIME/syntax/synload.vim")) - syntax on + syntax on endif if has("syntax") && &term =~ "xterm" - set t_Co=8 - if has("terminfo") - set t_Sf=<Esc>[3%p1%dm - set t_Sb=<Esc>[4%p1%dm - else - set t_Sf=<Esc>[3%dm - set t_Sb=<Esc>[4%dm - endif + set t_Co=8 + if has("terminfo") + set t_Sf=<Esc>[3%p1%dm + set t_Sb=<Esc>[4%p1%dm + else + set t_Sf=<Esc>[3%dm + set t_Sb=<Esc>[4%dm + endif endif diff --git a/utils/vim/patches/001-cross_compile.patch b/utils/vim/patches/001-cross_compile.patch index 37ce89f..553dde7 100644 --- a/utils/vim/patches/001-cross_compile.patch +++ b/utils/vim/patches/001-cross_compile.patch @@ -1,6 +1,6 @@ ---- vim73.org/src/auto/configure 2010-11-29 10:47:27.396117333 +0000 -+++ vim73/src/auto/configure 2010-11-29 10:48:52.301117332 +0000 -@@ -11641,34 +11641,8 @@ +--- a/src/auto/configure ++++ b/src/auto/configure +@@ -11641,34 +11641,8 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking uint32_t is 32 bits" >&5 $as_echo_n "checking uint32_t is 32 bits... " >&6; } @@ -33,3 +33,6 @@ -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + + + _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel