Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 14th, 2012  |  syntax: Bash  |  size: 1.93 KB  |  hits: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/ash
  2.  
  3. #   This program is free software; you can redistribute it and/or modify
  4. #   it under the terms of the GNU General Public License as published by
  5. #   the Free Software Foundation; either version 2 of the License, or
  6. #   (at your option) any later version.
  7. #
  8. #   This program is distributed in the hope that it will be useful,
  9. #   but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. #   GNU General Public License for more details.
  12. #
  13. #   You should have received a copy of the GNU General Public License
  14. #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  15. #
  16. #   Zyxel NSA310 u-Boot env setup and linux installer - stage 2
  17. #   by Michal Osowiecki
  18. #
  19. #   This script will format /dev/sda2 partition,extract linux archive
  20. #   to /dev/sda2,modify uBoot env and restart box
  21. #
  22. #   You have to place these files in root of your usb stick
  23. #   uImage                 - linux kernel
  24. #   initrd.gz              - second stage initrd running nsa310.sh
  25. #   usb_key_func.sh        - autorun script
  26. #   nsa310_check_file_C0   - usb_key_func.sh verification file
  27. #   checksumfile           - checksum file  
  28. #
  29. #   nsa310.sh              - stage2 script - run from initrd
  30. #                            feel free to modify it for your distribution
  31. #   linux.tgz              - stage2 gzipped tar of your linux distributio
  32.  
  33.  
  34. echo "Formatting data partition..."
  35. mkfs.ext4 /dev/sda2
  36. mount /dev/sda1 /mnt/sda1
  37. mount /dev/sda2 /mnt/sda2
  38. mount /dev/sdb1 /mnt/sdb1
  39. cp /mnt/sdb1/uImage /mnt/sda1/
  40. cd /mnt/sda2
  41. echo "Extracting linux..."
  42. tar -xzf /mnt/sdb1/linux.tgz
  43. cd /
  44. sync
  45. umount /dev/sda1
  46. umount /dev/sda2
  47. umount /dev/sdb1
  48.  
  49. echo "Setting uBoot env.."
  50. fw_setenv arcNumber 4022
  51. fw_setenv mainlineLinux yes
  52. fw_setenv bootargs 'console=ttyS0,115200 root=/dev/sda2'
  53. fw_setenv bootcmd 'ide reset;ext2load ide 0:1 0x800000 /uImage;bootm 0x800000'
  54. sleep 3
  55. reboot -f