Changeset 97c7682 in mainline for tools


Ignore:
Timestamp:
2012-07-14T11:18:40Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
804d9b6
Parents:
0747468 (diff), f0348c8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Text conflict in boot/arch/arm32/Makefile.inc:

Trivial conflict around ifeq condition.

Text conflict in kernel/arch/arm32/include/mm/page.h:

Added defines and set_pt_levelx_present function.
COnflict looked horrible because of the armv4/v7 split.

Location:
tools
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • tools/autotool.py

    r0747468 r97c7682  
    720720                        check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
    721721               
    722                 if (config['COMPILER'] == "suncc"):
    723                         common['CC'] = "suncc"
    724                         check_app([common['CC'], "-V"], "Sun Studio Compiler", "support is experimental")
    725                         check_gcc(None, "", common, PACKAGE_GCC)
    726                         check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
    727                
    728722                if (config['COMPILER'] == "clang"):
    729723                        common['CC'] = "clang"
  • tools/checkers/clang.py

    r0747468 r97c7682  
    114114        for job in jobs:
    115115                if (not clang(rootdir, job)):
    116                         print
     116                        print()
    117117                        print("Failed job: %s" % job)
    118118                        return
  • tools/checkers/stanse.py

    r0747468 r97c7682  
    127127        for job in jobs:
    128128                if (not stanse(rootdir, job)):
    129                         print
     129                        print()
    130130                        print("Failed job: %s" % job)
    131131                        return
  • tools/checkers/vcc.py

    r0747468 r97c7682  
    204204        for job in jobs:
    205205                if (not vcc(vcc_path, rootdir, job)):
    206                         print
     206                        print()
    207207                        print("Failed job: %s" % job)
    208208                        return
    209209       
    210         print
     210        print()
    211211        print("All jobs passed")
    212212
  • tools/filldir.py

    r0747468 r97c7682  
    3737
    3838if len(sys.argv) < 3:
    39         print 'Usage: filldir <parent-dir> <count>'
     39        print('Usage: filldir <parent-dir> <count>')
    4040        exit(2)
    4141
  • tools/gentestfile.py

    r0747468 r97c7682  
    3636
    3737if len(sys.argv) < 2:
    38         print "Usage: gentestfile.py <count of 64-bit numbers to output>"
     38        print("Usage: gentestfile.py <count of 64-bit numbers to output>")
    3939        exit()
    4040
    41 m = long(sys.argv[1])
     41m = int(sys.argv[1])
    4242i = 0
    4343pow_2_64 = 2 ** 64
  • tools/imgutil.py

    r0747468 r97c7682  
    9292                if name in exclude_names:
    9393                        continue
     94               
    9495                item = ItemToPack(path, name)
     96               
    9597                if not (item.is_dir or item.is_file):
    9698                        continue
     99               
    97100                yield item
    98101
     
    102105        inf = open(item.path, 'rb')
    103106        rd = 0
     107       
    104108        while (rd < item.size):
    105109                data = bytes(inf.read(chunk_size))
    106110                yield data
    107111                rd += len(data)
     112       
    108113        inf.close()
  • tools/mkfat.py

    r0747468 r97c7682  
    168168"""
    169169
    170 LFN_ENTRY = """little:
    171         uint8_t pos
    172         uint16_t name1[5]
    173         uint8_t attr
    174         uint8_t type
    175         uint8_t csum
    176         uint16_t name2[6]
    177         uint16_t fc
    178         uint16_t name3[2]
    179 """
    180 
    181 # Global variable to hold the file names in 8.3 format. Needed to
    182 # keep track of "number" when creating a short fname from a LFN.
    183 name83_list = []
    184 
    185 def name83(fname):
    186         "Create a 8.3 name for the given fname"
    187 
    188         # FIXME: filter illegal characters
    189         parts = fname.split('.')
    190        
    191         name = ''
    192         ext = ''
    193         lfn = False
    194 
    195         if len(fname) > 11 :
     170LFN_DIR_ENTRY = """little:
     171        uint8_t seq                /* sequence number */
     172        char name1[10]             /* first part of the name */
     173        uint8_t attr               /* attributes */
     174        uint8_t rec_type           /* LFN record type */
     175        uint8_t checksum           /* LFN checksum */
     176        char name2[12]             /* second part of the name */
     177        uint16_t cluster           /* cluster */
     178        char name3[4]              /* third part of the name */
     179"""
     180
     181lchars = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
     182              'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
     183              'U', 'V', 'W', 'X', 'Y', 'Z',
     184              '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
     185              '!', '#', '$', '%', '&', '\'', '(', ')', '-', '@',
     186              '^', '_', '`', '{', '}', '~', '.'])
     187
     188def fat_lchars(name):
     189        "Filter FAT legal characters"
     190       
     191        filtered_name = b''
     192        filtered = False
     193       
     194        for char in name.encode('ascii', 'replace').upper():
     195                if char in lchars:
     196                        filtered_name += char
     197                else:
     198                        filtered_name += b'_'
     199                        filtered = True
     200       
     201        return (filtered_name, filtered)
     202
     203def fat_name83(name, name83_list):
     204        "Create a 8.3 name for the given name"
     205       
     206        ascii_name, lfn = fat_lchars(name)
     207        # Splitting works only on strings, not on bytes
     208        ascii_parts = ascii_name.decode('utf8').split('.')
     209       
     210        short_name = ''
     211        short_ext = ''
     212       
     213        if len(ascii_name) > 11:
    196214                lfn = True
    197 
    198         if len(parts) > 0:
    199                 name = parts[0]
    200                 if len(name) > 8 :
     215       
     216        if len(ascii_parts) > 0:
     217                short_name = ascii_parts[0]
     218                if len(short_name) > 8:
    201219                        lfn = True
    202 
    203         if len(parts) > 1 :
    204                 ext = parts[-1]
    205                 if len(ext) > 3 :
     220       
     221        if len(ascii_parts) > 1:
     222                short_ext = ascii_parts[-1]
     223                if len(short_ext) > 3:
    206224                        lfn = True
    207 
    208         if len(parts) > 2 :
     225       
     226        if len(ascii_parts) > 2:
    209227                lfn = True
    210 
    211         if (lfn == False) :
    212                 return (name.ljust(8)[0:8], ext.ljust(3)[0:3], False)
    213 
     228       
     229        if lfn == False:
     230                name83_list.append(short_name + '.' + short_ext)
     231                return (short_name.ljust(8)[0:8], short_ext.ljust(3)[0:3], False)
     232       
    214233        # For filenames with multiple extensions, we treat the last one
    215234        # as the actual extension. The rest of the filename is stripped
    216235        # of dots and concatenated to form the short name
    217         for _name in parts[1:-1]:
    218                 name = name + _name             
    219 
    220         global name83_list
    221         for number in range(1, 10000) :
    222                 number_str = '~' + str(number)
    223 
    224                 if len(name) + len(number_str) > 8 :
    225                         name = name[0:8 - len(number_str)]
    226 
    227                 name = name + number_str;
    228 
    229                 if (name + ext) not in name83_list :
     236        for part in ascii_parts[1:-1]:
     237                short_name += part
     238       
     239        for number in range(1, 999999):
     240                number_str = ('~' + str(number)).upper()
     241               
     242                if len(short_name) + len(number_str) > 8:
     243                        short_name = short_name[0:8 - len(number_str)]
     244               
     245                short_name += number_str;
     246               
     247                if not (short_name + '.' + short_ext) in name83_list:
    230248                        break
    231                        
    232         name83_list.append(name + ext) 
    233 
    234         return (name.ljust(8)[0:8], ext.ljust(3)[0:3], True)
    235 
    236 def get_utf16(name, l) :
    237         "Create a int array out of a string which we can store in uint16_t arrays"
    238 
    239         bs = [0xFFFF for i in range(l)]
    240 
    241         for i in range(len(name)) :
    242                 bs[i] = ord(name[i])
    243        
    244         if (len(name) < l) :
    245                 bs[len(name)] = 0;
    246        
    247         return bs
    248 
    249 def create_lfn_entry((name, index)) :
    250         entry = xstruct.create(LFN_ENTRY)
    251 
    252         entry.name1 = get_utf16(name[0:5], 5)
    253         entry.name2 = get_utf16(name[5:11], 6)
    254         entry.name3 = get_utf16(name[11:13], 2)
    255         entry.pos = index
    256 
    257         entry.attr = 0xF
    258         entry.fc = 0
    259         entry.type = 0
    260 
    261         return entry
    262 
    263 def create_dirent(name, directory, cluster, size):
     249       
     250        name83_list.append(short_name + '.' + short_ext)
     251        return (short_name.ljust(8)[0:8], short_ext.ljust(3)[0:3], True)
     252
     253def create_lfn_dirent(name, seq, checksum):
     254        "Create LFN directory entry"
     255       
     256        entry = xstruct.create(LFN_DIR_ENTRY)
     257        name_rest = name[26:]
     258       
     259        if len(name_rest) > 0:
     260                entry.seq = seq
     261        else:
     262                entry.seq = seq | 0x40
     263       
     264        entry.name1 = name[0:10]
     265        entry.name2 = name[10:22]
     266        entry.name3 = name[22:26]
     267       
     268        entry.attr = 0x0F
     269        entry.rec_type = 0
     270        entry.checksum = checksum
     271        entry.cluster = 0
     272       
     273        return (entry, name_rest)
     274
     275def lfn_checksum(name):
     276        "Calculate LFN checksum"
     277       
     278        checksum = 0
     279        for i in range(0, 11):
     280                checksum = (((checksum & 1) << 7) + (checksum >> 1) + ord(name[i])) & 0xFF
     281       
     282        return checksum
     283
     284def create_dirent(name, name83_list, directory, cluster, size):
     285        short_name, short_ext, lfn = fat_name83(name, name83_list)
    264286       
    265287        dir_entry = xstruct.create(DIR_ENTRY)
    266288       
    267         dir_entry.name, dir_entry.ext, lfn = name83(name)
    268 
    269         dir_entry.name = dir_entry.name.upper().encode('ascii')
    270         dir_entry.ext = dir_entry.ext.upper().encode('ascii')
    271 
     289        dir_entry.name = short_name
     290        dir_entry.ext = short_ext
     291       
    272292        if (directory):
    273293                dir_entry.attr = 0x30
     
    289309                dir_entry.size = size
    290310       
    291 
    292311        if not lfn:
    293312                return [dir_entry]
    294 
    295         n = len(name) / 13 + 1
    296         names = [(name[i * 13: (i + 1) * 13 + 1], i + 1) for i in range(n)]
    297 
    298         entries = sorted(map (create_lfn_entry, names), reverse = True, key = lambda e : e.pos)
    299         entries[0].pos |= 0x40
    300 
    301         fname11 = dir_entry.name + dir_entry.ext
    302 
    303         csum = 0
    304         for i in range(0, 11) :
    305                 csum = ((csum & 1) << 7) + (csum  >> 1) + ord(fname11[i])
    306                 csum = csum & 0xFF
    307        
    308         for e in entries :
    309                 e.csum = csum;
    310        
    311         entries.append(dir_entry)
    312 
     313       
     314        long_name = name.encode('utf_16_le')
     315        entries = [dir_entry]
     316       
     317        seq = 1
     318        checksum = lfn_checksum(dir_entry.name + dir_entry.ext)
     319       
     320        while len(long_name) > 0:
     321                long_entry, long_name = create_lfn_dirent(long_name, seq, checksum)
     322                entries.append(long_entry)
     323                seq += 1
     324       
     325        entries.reverse()
    313326        return entries
    314327
     
    355368       
    356369        directory = []
    357        
    358         if (not head):
     370        name83_list = []
     371       
     372        if not head:
    359373                # Directory cluster preallocation
    360374                empty_cluster = fat.index(0)
    361                 fat[empty_cluster] = 0xffff
     375                fat[empty_cluster] = 0xFFFF
    362376               
    363377                directory.append(create_dot_dirent(empty_cluster))
     
    366380                empty_cluster = 0
    367381       
    368         for item in listdir_items(root):               
     382        for item in listdir_items(root):
    369383                if item.is_file:
    370384                        rv = write_file(item, outf, cluster_size, data_start, fat, reserved_clusters)
    371                         directory.extend(create_dirent(item.name, False, rv[0], rv[1]))
     385                        directory.extend(create_dirent(item.name, name83_list, False, rv[0], rv[1]))
    372386                elif item.is_dir:
    373387                        rv = recursion(False, item.path, outf, cluster_size, root_start, data_start, fat, reserved_clusters, dirent_size, empty_cluster)
    374                         directory.extend(create_dirent(item.name, True, rv[0], rv[1]))
    375        
    376         if (head):
     388                        directory.extend(create_dirent(item.name, name83_list, True, rv[0], rv[1]))
     389       
     390        if head:
    377391                outf.seek(root_start)
    378392                for dir_entry in directory:
     
    529543       
    530544        outf.close()
    531        
     545
    532546if __name__ == '__main__':
    533547        main()
  • tools/mkuimage.py

    r0747468 r97c7682  
    124124        header.img_type = 2             # Kernel
    125125        header.compression = 0          # None
    126         header.img_name = image_name
     126        header.img_name = image_name.encode('ascii')
    127127
    128128        header_crc = calc_crc32(header.pack())
     
    140140        signed_crc = zlib.crc32(byteseq, 0)
    141141        if signed_crc < 0:
    142                 return (long(signed_crc) + (long(2) ** long(32))) # 2^32L
     142                return signed_crc + (1 << 32)
    143143        else:
    144144                return signed_crc
     
    148148def print_syntax(cmd):
    149149        print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
    150         print
     150        print()
    151151        print("\traw_image\tInput image name (raw binary data)")
    152152        print("\tuImage\t\tOutput uImage name (U-Boot image)")
    153         print
     153        print()
    154154        print("options:")
    155155        print("\t-name <name>\tImage name (default: 'Noname')")
  • tools/toolchain.sh

    r0747468 r97c7682  
    5555BINUTILS_VERSION="2.22"
    5656BINUTILS_RELEASE=""
    57 GCC_VERSION="4.7.0"
     57GCC_VERSION="4.7.1"
    5858GDB_VERSION="7.4"
    5959
     
    149149        echo " sparc64    SPARC V9"
    150150        echo " all        build all targets"
    151         echo " parallel   same as 'all', but in parallel"
     151        echo " parallel   same as 'all', but all in parallel"
     152        echo " 2-way      same as 'all', but 2-way parallel"
    152153        echo
    153154        echo "The toolchain will be installed to the directory specified by"
     
    273274       
    274275        download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "ee0f10756c84979622b992a4a61ea3f5"
    275         download_fetch "${GCC_SOURCE}" "${GCC}" "2a0f1d99fda235c29d40b561f81d9a77"
     276        download_fetch "${GCC_SOURCE}" "${GCC}" "933e6f15f51c031060af64a9e14149ff"
    276277        download_fetch "${GDB_SOURCE}" "${GDB}" "95a9a8305fed4d30a30a6dc28ff9d060"
    277278}
     
    318319       
    319320        change_title "binutils: configure (${PLATFORM})"
    320         CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls
     321        CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror
    321322        check_error $? "Error configuring binutils."
    322323       
     
    330331       
    331332        change_title "GCC: configure (${PLATFORM})"
    332         "${GCCDIR}/configure" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared --enable-lto
     333        "${GCCDIR}/configure" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared --enable-lto --disable-werror
    333334        check_error $? "Error configuring GCC."
    334335       
     
    431432                wait
    432433                ;;
     434        "2-way")
     435                prepare
     436                build_target "amd64" "amd64-linux-gnu" &
     437                build_target "arm32" "arm-linux-gnueabi" &
     438                wait
     439               
     440                build_target "ia32" "i686-pc-linux-gnu" &
     441                build_target "ia64" "ia64-pc-linux-gnu" &
     442                wait
     443               
     444                build_target "mips32" "mipsel-linux-gnu" &
     445                build_target "mips32eb" "mips-linux-gnu" &
     446                wait
     447               
     448                build_target "mips64" "mips64el-linux-gnu" &
     449                build_target "ppc32" "ppc-linux-gnu" &
     450                wait
     451               
     452                build_target "ppc64" "ppc64-linux-gnu" &
     453                build_target "sparc64" "sparc64-linux-gnu" &
     454                wait
     455                ;;
    433456        *)
    434457                show_usage
  • tools/xstruct.py

    r0747468 r97c7682  
    3232
    3333import struct
     34import sys
    3435import types
    3536
     37# Handle long integer conversions nicely in both Python 2 and Python 3
     38integer_types = (int, long) if sys.version < '3' else (int,)
     39
     40# Ensure that 's' format for struct receives correct data type depending
     41# on Python version (needed due to different way to encode into bytes)
     42ensure_string = \
     43        (lambda value: value if type(value) is str else bytes(value)) \
     44                if sys.version < '3' else \
     45        (lambda value: bytes(value, 'ascii') if type(value) is str else value)
     46
    3647ranges = {
    37         'B': ((int, long), 0x00, 0xff),
    38         'H': ((int, long), 0x0000, 0xffff),
    39         'L': ((int, long), 0x00000000, 0xffffffff),
    40         'Q': ((int, long), 0x0000000000000000, 0xffffffffffffffff),
    41         'b': ((int, long), -0x80, 0x7f),
    42         'h': ((int, long), -0x8000, 0x7fff),
    43         'l': ((int, long), -0x80000000, 0x7fffffff) ,
    44         'q': ((int, long), -0x8000000000000000, 0x7fffffffffffffff),
     48        'B': (integer_types, 0x00, 0xff),
     49        'H': (integer_types, 0x0000, 0xffff),
     50        'L': (integer_types, 0x00000000, 0xffffffff),
     51        'Q': (integer_types, 0x0000000000000000, 0xffffffffffffffff),
     52        'b': (integer_types, -0x80, 0x7f),
     53        'h': (integer_types, -0x8000, 0x7fff),
     54        'l': (integer_types, -0x80000000, 0x7fffffff) ,
     55        'q': (integer_types, -0x8000000000000000, 0x7fffffffffffffff),
    4556}
    4657
     
    7485                                        args.append(item)
    7586                        else:
     87                                if (fmt == "s"):
     88                                        value = ensure_string(value)
    7689                                check_range(variable, fmt, value)
    7790                                args.append(value)             
Note: See TracChangeset for help on using the changeset viewer.