u-boot1.1.6移植之Diff比较(改进版)

49 fun_diff()
 50 {
 51 #board/san2440/lowlevel_init.S
 52 #board/san2440/san2440.c
 53 #include/configs/san2440.h
 54 #cpu/arm920t/start.S
 55
 56 #include/s3c24x0.h
 57 #cpu/arm920t/s3c24x0/interrupts.c
 58 #cpu/arm920t/s3c24x0/serial.c
 59 #cpu/arm920t/s3c24x0/speed.c
 60 #cpu/arm920t/s3c24x0/usb_ohci.c
 61 #cpu/arm920t/s3c24x0/usb.c
 62 #cpu/arm920t/s3c24x0/i2c.c
 63 #drivers/usb/usb_ohci.c
 64 #drivers/rtc/s3c24x0_rtc.c
 65 #lib_arm/board.c
 66 old="sanEmbeded/u-boot-1.1.6"
 67 new="EmbedSky/u-boot-1.1.6"
 68 config_file="patch/patch-uboot.config"
 69
 70 patch_file=(`sed 's/^.*////g' "$config_file"`)
 71 patch_file_number=`cat "$config_file" | wc -l`
 72 patch_file_number_1=`expr $patch_file_number - 1`
 73
 74 for i in `seq 0 $patch_file_number_1`
 75 do
 76  patch_order=`expr $i + 1`
 77  patch_path=`sed -n ${patch_order}p $config_file`
 78  printRed "${patch_file[i]}"
 79  printBlue "$patch_order"
 80  printBlue "$patch_path"
 81
 82  old_file=`echo $patch_path | awk '{print $1}'`
 83  new_file=`echo $patch_path | awk '{print $2}'`
 84
 85  #if [ ! -f "$old/$old_file" ]
 86  #then
 87  #  printRed "file:$old/$old_file doesn't exit"
 88  #fi
 89
 90  #if [ ! -f "$new/$new_file" ]
 91  #then
 92  #       printRed "file:$new/$new_file doesn't exit"
 93  #fi
 94  if [ ! -d $old/$old_file ]
 95  then
 96
 97   tmp_dir="san/u-boot-1.1.6"
 98   old_file_dir=`dirname $old_file`
 99   old_file_basename=`basename $old_file`
100   mkdir -p $tmp_dir/$old_file_dir
101
102   if [ "$new_file" = "" ]
103   then
104     printRed "diff -Nurw $old/$old_file $tmp_dir/$old_file_dir/$old_file_basename"
105     cp $new/$old_file $tmp_dir/$old_file_dir/$old_file_basename 将文件单独拷贝出来
106     diff -Nurw "$old"/"$old_file" "$tmp_dir"/"$old_file_dir"/"$old_file_basename" >> patch/$old_file_basename.pa tch
107   else
108
109     new_file_dir=`dirname $new_file`
110     new_file_basename=`basename $new_file`
111
112     cp $new/$new_file $tmp_dir/$old_file_dir/$old_file_basename
113
114     printRed "diff -Nurw $old/$old_file $tmp_dir/$old_file_dir/$old_file_basename"
115     diff -Nurw "$old"/"$old_file" "$tmp_dir"/"$old_file_dir"/"$old_file_basename" >> patch/$old_file_basename.patch
116     ##diff -Nurw $old/$old_file $new/$new_file > patch/${patch_file[i]}.patch
117     ##diff -Nurw "$old"/"$patch_path" "$new"/"$patch_path" > patch/${patch_file[i]}.patch
118     ##diff -Nurw "$old"/"$patch_path" "$new"/"$patch_path" >> patch/patch-for-uboot1.1.6.patch
119   fi
120
121  else
122     printRed "no need to deal with dir!"
123     #mkdir -p san/$old_file && cp -rf $new/$new_file/* san/$old_file
124  fi
125 done
126 }

 

Diff配置文件patch/patch-uboot.config

 

1 board/san2440           board/EmbedSky
2 cpu/arm920t/s3c24x0
3 include/s3c24x0.h
4 board/san2440/san2440.c         board/EmbedSky/EmbedSky.c
5 board/san2440/lowlevel_init.S   board/EmbedSky/lowlevel_init.S
6 board/san2440/flash.c           board/EmbedSky/flash.c
7 board/san2440/Makefile          board/EmbedSky/Makefile
8 board/san2440/u-boot.lds        board/EmbedSky/u-boot.lds
9 board/san2440/config.mk         board/EmbedSky/config.mk
10 include/configs/san2440.h       include/configs/EmbedSky.h
11 cpu/arm920t/start.S
12 rtc/s3c24x0_rtc.c
 13 lib_arm/board.c

你可能感兴趣的:(c,File,Path,patch,fun)