Advertisement
vinadoros

qemu-user-static

Jun 22nd, 2015
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.89 KB | None | 0 0
  1. # Maintainer: Sergio Tridente <tioduke at gmail dot com >
  2. # Contributor: Steven Noonan <steven@uplinklabs.net>
  3.  
  4. pkgname=qemu-user-static
  5. pkgver=2.3
  6. pkgrel=1
  7. pkgdesc="A generic and open source processor emulator which achieves a good emulation speed by using dynamic translation, statically linked."
  8. arch=('i686' 'x86_64')
  9. license=('GPL2' 'LGPL2.1')
  10. url="http://wiki.qemu.org/Index.html"
  11. depends=()
  12. optdepends=('binfmt-support: to allow handling foreign ELF binaries and executing them via qemu')
  13. conflicts=()
  14. _arch=i386
  15. [ "$CARCH" = 'x86_64' ] && _arch=amd64
  16. _debsrc=${pkgname}_${pkgver}+dfsg-6a_${_arch}.deb
  17. source=(http://ftp.debian.org/debian/pool/main/q/qemu/${_debsrc})
  18. sha1sums=('aab940002044c9543a8aaf4502622b03fd06e153')
  19. [ "$CARCH" = 'i686' ] && sha1sums=('51eaaca22d6ccf969623453190cffa62c79de480')
  20.  
  21. prepare() {
  22. cd "$srcdir"
  23. ar p ${_debsrc} data.tar.xz | bsdtar xf -
  24. }
  25.  
  26. package() {
  27. cd "$pkgdir"
  28. mkdir -p "$pkgdir"/usr/bin/
  29. mkdir -p "$pkgdir"/usr/share/man/
  30. mkdir -p "$pkgdir"/var/lib/binfmts/
  31.  
  32. cp "$srcdir"/usr/bin/* "$pkgdir"/usr/bin/
  33. cp "$srcdir"/usr/share/man/man1 "$pkgdir"/usr/share/man/ -r
  34.  
  35. create_binfmts
  36. }
  37.  
  38. create_binfmts() {
  39. aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
  40. aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  41. alpha_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90'
  42. alpha_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  43. arm_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00'
  44. arm_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  45. armeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28'
  46. armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  47. cris_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x4c\x00'
  48. cris_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  49. m68k_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04'
  50. m68k_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  51. microblaze_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xba\xab'
  52. microblaze_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  53. mips_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08'
  54. mips_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  55. mipsel_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
  56. mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  57. ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14'
  58. ppc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  59. ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
  60. ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  61. ppc64abi32_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
  62. ppc64abi32_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  63. s390x_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'
  64. s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  65. sh4_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00'
  66. sh4_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  67. sh4eb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a'
  68. sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  69. sparc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02'
  70. sparc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  71. sparc32plus_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12'
  72. sparc32plus_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  73. sparc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b'
  74. sparc64_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  75.  
  76. # Drop support for emulating amd64 on i386, http://bugs.debian.org/604712
  77. fmts="aarch64 alpha arm armeb cris m68k microblaze mips mipsel ppc ppc64 ppc64abi32 s390x sh4 sh4eb sparc sparc32plus sparc64"
  78.  
  79. for fmt in $fmts ; do
  80. eval "magic=\"\$${fmt}_magic\" mask=\"\$${fmt}_mask\""
  81. cat >> "${pkgdir}/var/lib/binfmts/qemu-$fmt" << EOF
  82. qemu-user-static
  83. magic
  84. 0
  85. $magic
  86. $mask
  87. /usr/bin/qemu-$fmt-static
  88.  
  89. yes
  90.  
  91. EOF
  92. done
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement