Advertisement
metalx1000

Setup aboriginal cross compiler mipsel

Jun 5th, 2015
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.34 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. arch="mipsel" #armv6l
  4. arch-static="mipsel"  #arm
  5. static="/usr/bin/qemu-${arch-static}-static"
  6. native="native-compiler-$arch"
  7. rootfs="root-filesystem-$arch"
  8. url="http://www.landley.net/code/aboriginal/downloads/binaries/root-filesystem/"
  9.  
  10. if [ ! -f "$static" ]
  11. then
  12.   sudo apt-get install qemu-user-static
  13. fi
  14.  
  15. mkdir "$arch"
  16. cd "$arch"
  17.  
  18. echo "Getting ${url}${native}.tar.gz"
  19. wget -c "${url}${native}.tar.gz"
  20. echo "Getting ${url}${rootfs}.tar.gz"
  21. wget -c "${url}${rootfs}.tar.gz"
  22.  
  23. tar xvzf ${native}.tar.gz
  24. tar xvzf ${rootfs}.tar.gz
  25.  
  26. cd "$rootfs"
  27. sudo cp -r ../${native}/* ./
  28. #rm ../${native}* -fr
  29. #rm ../${rootfs}.tar.gz
  30.  
  31. cp "$static" bin
  32. cd usr/bin
  33. find . -maxdepth 1 -type l -exec rm -f {} \;
  34. rm busybox
  35. wget "http://www.busybox.net/downloads/binaries/latest/busybox-$arch" -O busybox
  36. chmod +x busybox
  37. busybox  --help | \
  38. sed -e '1,/^Currently defined functions:/d' \
  39.     -e 's/[ \t]//g' -e 's/,$//' -e 's/,/\n/g' | \
  40. while read app ; do
  41.   if [ "$app" != "" ]; then
  42.     printf "linking %-12s ...\n" "$app"
  43.     ln -sf "./busybox" "$app"
  44.     ls -ld "$app"
  45.   fi
  46. done
  47. cd ../../
  48.  
  49. cat << EOF > hello.c
  50. #include<stdio.h>
  51.  
  52. main()
  53. {  
  54.     printf("Hello World\n");
  55.  
  56. }
  57. EOF
  58.  
  59. echo "Entering $arch chroot environment..."
  60. echo "Run the following to test compiler:"
  61. echo "gcc -static hello.c -o hello"
  62. sudo chroot . sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement