Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1490192
  • 博文数量: 129
  • 博客积分: 1449
  • 博客等级: 上尉
  • 技术积分: 3048
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-24 18:36
文章分类

全部博文(129)

文章存档

2015年(3)

2014年(20)

2013年(65)

2012年(41)

分类: LINUX

2012-11-14 08:53:34

每个人的mac地址都不一样,这个脚本可以保证每个人生成的uboot的唯一性.

点击(此处)折叠或打开

  1. #! /bin/sh

  2. UBOOT_NAME=/tmp/tuboot.bin
  3. RAW_UBOOT_LEN=`wc -c $UBOOT_NAME | awk '{print $1 }'`
  4. NEED_PAD_LEN=$((0x1fc00-$RAW_UBOOT_LEN))
  5. #Generate a file used as pad ...
  6. dd if=/dev/zero of=/tmp/pad.bin bs=1 count=$NEED_PAD_LEN

  7. cat $UBOOT_NAME /tmp/pad.bin >/tmp/tuboot_0x1fc00.bin

  8. echo "Backup some config first,just like MAC address ..."
  9. dd if=/dev/mtd0 of=/tmp/config.bin bs=1 skip=$((0x1fc00))

  10. cat /tmp/tuboot_0x1fc00.bin /tmp/config.bin >uboot.bin

  11. #mtd -r write /uboot.bin u-boot


点击(此处)折叠或打开

  1. #!/bin/bash

  2. # blink_arg.bash -- must run as
  3. #
  4. # Blink GPIO pin on and off

  5. LEDPIN=${1-57}
  6. OFF=1
  7. ON=0
  8. # Make sure we have root access
  9. if [ $EUID -ne 0 ]; then
  10.         echo "You must be root to run this. Try 'sudo $0'"
  11.         exit
  12. fi

  13. # Clean up procedure--turn off the LED, unexport the GPIO, and exit
  14. cleanup()
  15. {
  16.         PIN=$1
  17.         echo $OFF > /sys/class/gpio/gpio$PIN/value # turn off
  18.         echo $PIN > /sys/class/gpio/unexport
  19.         echo Interrupted.
  20.         exit
  21. }

  22. # Set up--select the pin and direction. Catch Control-C SIGHUP SIGKILL
  23. echo $LEDPIN > /sys/class/gpio/export
  24. echo out > /sys/class/gpio/gpio$LEDPIN/direction
  25. trap 'cleanup $LEDPIN' 1 2 15

  26. while true
  27. do
  28.         echo $ON > /sys/class/gpio/gpio$LEDPIN/value # turn on
  29.         sleep 1
  30.         echo $OFF > /sys/class/gpio/gpio$LEDPIN/value # turn off
  31.         sleep 1
  32. done

--- Openwrt 的懒人编译脚本,送给爱跟trunk同步升级的强迫症党
老爱编译trunk最新版本的朋友用这个脚本鼠标点击运行即可,通过make menuconfig保存好默认的编译配置
更新svn后,按Y/N 选择是否运行make clean,然后开始编译了。。
复制如下内容保存成 build.sh 放到openwrt /trunk目录下。默认是16线程编译,cpu不够强大的把16改成其他数字即可,比如2~4.

点击(此处)折叠或打开

  1. #!/bin/bash

  2. svn up
  3. ./scripts/feeds update -a
  4. ./scripts/feeds install -a
  5. make defconfig

  6. echo "Make clean? Please answer yes or no."
  7. read YES_OR_NO
  8. case "$YES_OR_NO" in
  9.         yes|y|Yes|YES)
  10.                 make clean
  11.                 make V=99 -j 16
  12.         ;;

  13.         [nN]*)
  14.                 echo "DO NOT make clean!"
  15.                 make V=99 -j 16
  16.         ;;

  17.         *)
  18.                 echo "Sorry, $YES_OR_NO not recognized. Enter yes or no."
  19.                 exit 1
  20.         ;;
  21. esac


阅读(1060) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~