Advertisement
Guest User

build.sh

a guest
Mar 5th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.17 KB | None | 0 0
  1. #!/bin/bash
  2. FILE="./vmlinux_initramfs"
  3.  
  4. poself=`LANG=C grep -b -a -o -P '\x7f\x45\x4c\x46\x02\x01\x01' $FILE | cut -d ":" -f 1`
  5. poshvfs=`LANG=C grep -b -a -o -P '\x48\x76\x46\x73' $FILE | cut -d ":" -f 1`
  6. dd bs=1 skip=$poself count=$(($poshvfs-$poself)) < $FILE >vmlinux
  7.  
  8. cp linux-4.10.1/vmlinux.bz2 hvfs-dir/vmlinux
  9. ./hvfsmaker.py hvfs-dir/
  10.  
  11. cat hvfs.fs >>vmlinux
  12.  
  13. headersec=`readelf -a ./vmlinux | grep "Start of section headers" | awk '{print $5}'`
  14. cursize=`du -b vmlinux | awk '{print $1}'`
  15. dd bs=1 count=$(($headersec-$cursize-200)) </dev/zero >> vmlinux
  16.  
  17. numsec=`readelf -a ./vmlinux | grep "Number of section headers" | awk '{print $5}'`
  18. sizesec=`readelf -a ./vmlinux | grep "Size of section headers" | awk '{print $5}'`
  19. poselftrailer=`LANG=C grep -b -a -o -P '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0B\x00\x00\x00\x01\x00\x00\x00' $FILE | cut -d ":" -f 1`
  20.  
  21. dd bs=1 skip=$((poselftrailer-200)) count=$((($numsec * $sizesec)+200)) < $FILE >>vmlinux
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement