From 1f65b900f0f17a700035dea9a76b910504f4507c Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 28 Jul 2009 17:55:35 +0100 Subject: Lib.pm: Add file_architecture command. This command detects the architecture of some types of binaries, libraries, kernel modules and initrd images. --- images/Makefile.am | 44 +++++++++++++++++++++++++++++++++++++++++--- images/README-binfiles | 13 +++++++++++++ images/bin-i586-dynamic | Bin 0 -> 4616 bytes images/bin-sparc-dynamic | Bin 0 -> 5060 bytes images/bin-win32.exe | Bin 0 -> 21617 bytes images/bin-win64.exe | Bin 0 -> 44557 bytes images/bin-x86_64-dynamic | Bin 0 -> 6484 bytes images/lib-i586.so | Bin 0 -> 3834 bytes images/lib-sparc.so | Bin 0 -> 4536 bytes images/lib-win32.dll | Bin 0 -> 16402 bytes images/lib-win64.dll | Bin 0 -> 34777 bytes images/lib-x86_64.so | Bin 0 -> 5467 bytes 12 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 images/README-binfiles create mode 100755 images/bin-i586-dynamic create mode 100755 images/bin-sparc-dynamic create mode 100755 images/bin-win32.exe create mode 100755 images/bin-win64.exe create mode 100755 images/bin-x86_64-dynamic create mode 100755 images/lib-i586.so create mode 100755 images/lib-sparc.so create mode 100755 images/lib-win32.dll create mode 100755 images/lib-win64.dll create mode 100755 images/lib-x86_64.so (limited to 'images') diff --git a/images/Makefile.am b/images/Makefile.am index 56a22fd2..d4aed552 100644 --- a/images/Makefile.am +++ b/images/Makefile.am @@ -22,7 +22,18 @@ EXTRA_DIST = \ helloworld.tar \ helloworld.tar.gz \ mbr-ext2-empty.img.gz \ - empty known-1 known-2 known-3 + empty known-1 known-2 known-3 \ + bin-i586-dynamic \ + bin-sparc-dynamic \ + bin-win32.exe \ + bin-win64.exe \ + bin-x86_64-dynamic \ + lib-i586.so \ + lib-sparc.so \ + lib-win32.dll \ + lib-win64.dll \ + lib-x86_64.so + noinst_DATA = test.sqsh @@ -37,7 +48,17 @@ squash_files_src = \ $(srcdir)/empty \ $(srcdir)/known-1 \ $(srcdir)/known-2 \ - $(srcdir)/known-3 + $(srcdir)/known-3 \ + $(srcdir)/bin-i586-dynamic \ + $(srcdir)/bin-sparc-dynamic \ + $(srcdir)/bin-win32.exe \ + $(srcdir)/bin-win64.exe \ + $(srcdir)/bin-x86_64-dynamic \ + $(srcdir)/lib-i586.so \ + $(srcdir)/lib-sparc.so \ + $(srcdir)/lib-win32.dll \ + $(srcdir)/lib-win64.dll \ + $(srcdir)/lib-x86_64.so squash_files_build = \ $(builddir)/100kallzeroes \ @@ -45,7 +66,9 @@ squash_files_build = \ $(builddir)/100kallspaces \ $(builddir)/100krandom \ $(builddir)/10klines \ - $(builddir)/initrd + $(builddir)/initrd \ + $(builddir)/initrd-x86_64.img \ + $(builddir)/initrd-x86_64.img.gz squash_files = $(squash_files_src) $(squash_files_build) @@ -86,3 +109,18 @@ $(builddir)/initrd: empty known-1 known-2 known-3 rm -f $@ $@-t for f in $^; do echo $$f; done | cpio -o -H newc | gzip --best > $@-t mv $@-t $@ + +# Create a dummy initrd with a single file called 'bin/nash' which +# is used to test the Sys::Guestfs::Lib::file_architecture function. +$(builddir)/initrd-x86_64.img: bin-x86_64-dynamic + rm -rf bin $@ $@-t + mkdir bin + cp $< bin/nash + echo bin/nash | cpio -o -H newc > $@-t + mv $@-t $@ + rm -rf bin $@-t + +$(builddir)/initrd-x86_64.img.gz: initrd-x86_64.img + rm -f $@ $@-t + gzip --best -c $< > $@-t + mv $@-t $@ diff --git a/images/README-binfiles b/images/README-binfiles new file mode 100644 index 00000000..f99fc847 --- /dev/null +++ b/images/README-binfiles @@ -0,0 +1,13 @@ +The bin-* and lib-* files are used for testing the +Sys::Guestfs::Lib::file_architecture API. + +The bin-* files are generated from empty source files (ie. +"main(){}") on the respective architectures. + +The lib-* files are generated from a (really) empty source file called +lib.c which is linked into a library using gcc -shared on the +respective architectures. + +If you are concerned that these binary files "lack source" then you +can just remove them, but you may need to patch out tests in the perl/ +directory. diff --git a/images/bin-i586-dynamic b/images/bin-i586-dynamic new file mode 100755 index 00000000..4f770633 Binary files /dev/null and b/images/bin-i586-dynamic differ diff --git a/images/bin-sparc-dynamic b/images/bin-sparc-dynamic new file mode 100755 index 00000000..138839af Binary files /dev/null and b/images/bin-sparc-dynamic differ diff --git a/images/bin-win32.exe b/images/bin-win32.exe new file mode 100755 index 00000000..db6d5758 Binary files /dev/null and b/images/bin-win32.exe differ diff --git a/images/bin-win64.exe b/images/bin-win64.exe new file mode 100755 index 00000000..98bddc02 Binary files /dev/null and b/images/bin-win64.exe differ diff --git a/images/bin-x86_64-dynamic b/images/bin-x86_64-dynamic new file mode 100755 index 00000000..033ac759 Binary files /dev/null and b/images/bin-x86_64-dynamic differ diff --git a/images/lib-i586.so b/images/lib-i586.so new file mode 100755 index 00000000..e82023a1 Binary files /dev/null and b/images/lib-i586.so differ diff --git a/images/lib-sparc.so b/images/lib-sparc.so new file mode 100755 index 00000000..7feec75e Binary files /dev/null and b/images/lib-sparc.so differ diff --git a/images/lib-win32.dll b/images/lib-win32.dll new file mode 100755 index 00000000..e1a2d2e6 Binary files /dev/null and b/images/lib-win32.dll differ diff --git a/images/lib-win64.dll b/images/lib-win64.dll new file mode 100755 index 00000000..ca94485c Binary files /dev/null and b/images/lib-win64.dll differ diff --git a/images/lib-x86_64.so b/images/lib-x86_64.so new file mode 100755 index 00000000..8cee4d20 Binary files /dev/null and b/images/lib-x86_64.so differ -- cgit