Obsolete unused backup project such as OK6410
guowenxue
2019-08-02 65dc3d972e8281fd8625ffd37b2e67994557f88d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
# Description:  This shell script used to generate the patch file
#      Author:  GuoWenxue<guowenxue@gmail.com>
#    Changlog:
#         1,    Version 1.0.0(2011.04.01), initialize first version 
#               
 
PWD=`pwd`
PACKET_DIR=$PWD
 
# Parameter valid check
if [ $# != 2 ] ; then
    echo "+---------------------------------------------------"
    echo "|   Usage:  $0 [SRC_FOLDER] [ARCH]"
    echo "| Example:  $0 u-boot-2010.09 fl2440"
    echo "| Example:  $0 u-boot-1.3.4 at91sam9260"
    echo "+---------------------------------------------------"
    exit;
fi
 
SRC_NAME=`basename $1`
ARCH=$2
 
# Check latest source code exist or not
if [ ! -d $SRC_NAME ] ; then
    echo "+-------------------------------------------------------------------"
    echo "|  ERROR: Source code \"$SRC_NAME\" doesn't exist!"
    echo "+-------------------------------------------------------------------"
    exit;
fi
 
SRC_PACKET_PATH=$PACKET_DIR/$SRC_NAME.tar.bz2
# Check original source code packet exist or not
if [ ! -s $SRC_PACKET_PATH ] ; then
    echo "+-------------------------------------------------------------------"
    echo "| ERROR:  Orignal source code packet doesn't exist!"
    echo "| $SRC_PACKET_PATH"
    echo "+-------------------------------------------------------------------"
    exit;
fi
 
# Clean up the source code
echo "+----------------------------------------------------------"
echo "|            Clean up the new source code                  "
echo "+----------------------------------------------------------"
NEW_SRC=$SRC_NAME-$ARCH
cd $SRC_NAME
rm -f tags cscope*
make distclean
cd ..
mv $SRC_NAME $NEW_SRC
 
echo "+----------------------------------------------------------"
echo "|         Decompress original source code packet           "
echo "+----------------------------------------------------------"
ORIG_SRC=$SRC_NAME
tar -xjf $SRC_PACKET_PATH
 
# Generate the patch file
echo "+------------------------------------------------------------------------"
echo "| Generate patch file \"$NEW_SRC.patch\"                                 "
echo "+------------------------------------------------------------------------"
diff -Nuar $ORIG_SRC $NEW_SRC > $NEW_SRC.patch
 
# Rollback to the original status
rm -rf $ORIG_SRC
mv $NEW_SRC $SRC_NAME