Changeset 3e828ea in mainline for tools


Ignore:
Timestamp:
2019-09-23T12:49:29Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9be2358
Parents:
9259d20 (diff), 1a4ec93f (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.
git-author:
Jiri Svoboda <jiri@…> (2019-09-22 12:49:07)
git-committer:
Jiri Svoboda <jiri@…> (2019-09-23 12:49:29)
Message:

Merge changes from master, especially Meson build

Location:
tools
Files:
3 added
5 deleted
14 edited
3 moved

Legend:

Unmodified
Added
Removed
  • tools/autocheck.awk

    r9259d20 r3e828ea  
    3333BEGIN {
    3434        filename = ARGV[1]
     35        output_lines = 0
    3536        print "// Generated file. Fix the included header if static assert fails."
    36         print "#include \"" filename "\""
     37        print "// Inlined \"" filename "\""
     38}
     39
     40{
     41        print $0
    3742}
    3843
     
    4449        }
    4550        macro_name = toupper(struct_name) "_SIZE"
    46         print "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
     51        output[output_lines++] = "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
    4752        struct_name = ""
    4853}
     
    5560
    5661                macro_name = toupper(struct_name) "_OFFSET_" toupper(member)
    57                 print "_Static_assert(" macro_name " == __builtin_offsetof(struct " struct_name ", " member "), \"\");"
     62                output[output_lines++] = "_Static_assert(" macro_name " == __builtin_offsetof(struct " struct_name ", " member "), \"\");"
    5863
    5964                macro_name = toupper(struct_name) "_SIZE_" toupper(member)
    60                 print "#ifdef " macro_name
    61                 print "_Static_assert(" macro_name " == sizeof(((struct " struct_name "){ })." member "), \"\");"
    62                 print "#endif"
     65                output[output_lines++] = "#ifdef " macro_name
     66                output[output_lines++] = "_Static_assert(" macro_name " == sizeof(((struct " struct_name "){ })." member "), \"\");"
     67                output[output_lines++] = "#endif"
    6368        }
    6469}
     
    6772        struct_name = $3
    6873}
     74
     75END {
     76        for ( i = 0; i < output_lines; i++ ) {
     77                print output[i]
     78        }
     79}
  • tools/build-ccheck.sh

    r9259d20 r3e828ea  
    1 #!/bin/bash
     1#!/bin/sh
    22#
    33# Copyright (c) 2019 Jiri Svoboda
  • tools/cc.sh

    r9259d20 r3e828ea  
    1 #! /bin/bash
     1#!/bin/sh
    22
    33#
     
    3636EOF
    3737
     38# Find out the path to the script.
     39SOURCE_DIR=`which -- "$0" 2>/dev/null`
     40# Maybe we are running bash.
     41[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
     42[ -z "$SOURCE_DIR" ] && exit 1
     43SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
     44SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
     45
    3846echo ""
    3947
    40 git grep 'Copyright ([cC])' | \
     48git -C "$SOURCE_DIR" grep 'Copyright ([cC])' | \
    4149        sed -E -n 's/^.*(Copyright \([cC]\) (20[0-9][0-9]-)?20[0-9][0-9],? [-a-zA-Z., ]*[-a-zA-Z.]$)/\1/p' | \
    4250        sed -E 's/ ( )+/ /' | \
  • tools/ccheck.sh

    r9259d20 r3e828ea  
    1 #!/bin/bash
     1#!/bin/sh
    22#
    33# Copyright (c) 2018 Jiri Svoboda
     
    3333fi
    3434
    35 if [ ."$1" == .--fix ] ; then
     35if [ ."$1" = .--fix ]; then
    3636        opt=--fix
    3737else
     
    4949        outfile="$(mktemp)"
    5050        "$ccheck" $opt $fname >"$outfile" 2>&1
    51         rc=$?
    52         if [ .$rc == .0 ]; then
     51        if [ $? -eq 0 ]; then
    5352                if [ -s "$outfile" ] ; then
    5453                        srepcnt=$((srepcnt + 1))
     
    6564done
    6665
    67 if [ $srepcnt == 0 -a $fcnt == 0 ] ; then
     66if [ $srepcnt -eq 0 ] && [ $fcnt -eq 0 ]; then
    6867        echo "Ccheck passed."
    6968else
  • tools/config.py

    r9259d20 r3e828ea  
    4242import random
    4343
    44 RULES_FILE = sys.argv[1]
     44ARGPOS_RULES = 1
     45ARGPOS_PRESETS_DIR = 2
     46ARGPOS_CHOICE = 3
     47ARGPOS_PRESET = 4
     48ARGPOS_MASK_PLATFORM = 3
     49
     50RULES_FILE = sys.argv[ARGPOS_RULES]
    4551MAKEFILE = 'Makefile.config'
    4652MACROS = 'config.h'
    47 PRESETS_DIR = 'defaults'
     53PRESETS_DIR = sys.argv[ARGPOS_PRESETS_DIR]
     54
     55class BinaryOp:
     56        def __init__(self, operator, left, right):
     57                assert operator in ('&', '|', '=', '!=')
     58
     59                self._operator = operator
     60                self._left = left
     61                self._right = right
     62
     63        def evaluate(self, config):
     64                if self._operator == '&':
     65                        return self._left.evaluate(config) and \
     66                            self._right.evaluate(config)
     67                if self._operator == '|':
     68                        return self._left.evaluate(config) or \
     69                            self._right.evaluate(config)
     70
     71                # '=' or '!='
     72                if not self._left in config:
     73                        config_val = ''
     74                else:
     75                        config_val = config[self._left]
     76                        if config_val == '*':
     77                                config_val = 'y'
     78
     79                if self._operator == '=':
     80                        return self._right == config_val
     81                return self._right != config_val
     82
     83# Expression parser
     84class CondParser:
     85        TOKEN_EOE = 0
     86        TOKEN_SPECIAL = 1
     87        TOKEN_STRING = 2
     88
     89        def __init__(self, text):
     90                self._text = text
     91
     92        def parse(self):
     93                self._position = -1
     94                self._next_char()
     95                self._next_token()
     96
     97                res = self._parse_expr()
     98                if self._token_type != self.TOKEN_EOE:
     99                        self._error("Expected end of expression")
     100                return res
     101
     102        def _next_char(self):
     103                self._position += 1
     104                if self._position >= len(self._text):
     105                        self._char = None
     106                else:
     107                        self._char = self._text[self._position]
     108                self._is_special_char = self._char in \
     109                    ('&', '|', '=', '!', '(', ')')
     110
     111        def _error(self, msg):
     112                raise RuntimeError("Error parsing expression: %s:\n%s\n%s^" %
     113                    (msg, self._text, " " * self._token_position))
     114
     115        def _next_token(self):
     116                self._token_position = self._position
     117
     118                # End of expression
     119                if self._char == None:
     120                        self._token = None
     121                        self._token_type = self.TOKEN_EOE
     122                        return
     123
     124                # '&', '|', '=', '!=', '(', ')'
     125                if self._is_special_char:
     126                        self._token = self._char
     127                        self._next_char()
     128                        if self._token == '!':
     129                                if self._char != '=':
     130                                        self._error("Expected '='")
     131                                self._token += self._char
     132                                self._next_char()
     133                        self._token_type = self.TOKEN_SPECIAL
     134                        return
     135
     136                # <var> or <val>
     137                self._token = ''
     138                self._token_type = self.TOKEN_STRING
     139                while True:
     140                        self._token += self._char
     141                        self._next_char()
     142                        if self._is_special_char or self._char == None:
     143                                break
     144
     145        def _parse_expr(self):
     146                """ <expr> ::= <or_expr> ('&' <or_expr>)* """
     147
     148                left = self._parse_or_expr()
     149                while self._token == '&':
     150                        self._next_token()
     151                        left = BinaryOp('&', left, self._parse_or_expr())
     152                return left
     153
     154        def _parse_or_expr(self):
     155                """ <or_expr> ::= <factor> ('|' <factor>)* """
     156
     157                left = self._parse_factor()
     158                while self._token == '|':
     159                        self._next_token()
     160                        left = BinaryOp('|', left, self._parse_factor())
     161                return left
     162
     163        def _parse_factor(self):
     164                """ <factor> ::= <var> <cond> | '(' <expr> ')' """
     165
     166                if self._token == '(':
     167                        self._next_token()
     168                        res = self._parse_expr()
     169                        if self._token != ')':
     170                                self._error("Expected ')'")
     171                        self._next_token()
     172                        return res
     173
     174                if self._token_type == self.TOKEN_STRING:
     175                        var = self._token
     176                        self._next_token()
     177                        return self._parse_cond(var)
     178
     179                self._error("Expected '(' or <var>")
     180
     181        def _parse_cond(self, var):
     182                """ <cond> ::= '=' <val> | '!=' <val> """
     183
     184                if self._token not in ('=', '!='):
     185                        self._error("Expected '=' or '!='")
     186
     187                oper = self._token
     188                self._next_token()
     189
     190                if self._token_type != self.TOKEN_STRING:
     191                        self._error("Expected <val>")
     192
     193                val = self._token
     194                self._next_token()
     195
     196                return BinaryOp(oper, var, val)
    48197
    49198def read_config(fname, config):
     
    59208        inf.close()
    60209
    61 def check_condition(text, config, rules):
    62         "Check that the condition specified on input line is True (only CNF and DNF is supported)"
    63 
    64         ctype = 'cnf'
    65 
    66         if (')|' in text) or ('|(' in text):
    67                 ctype = 'dnf'
    68 
    69         if ctype == 'cnf':
    70                 conds = text.split('&')
    71         else:
    72                 conds = text.split('|')
    73 
    74         for cond in conds:
    75                 if cond.startswith('(') and cond.endswith(')'):
    76                         cond = cond[1:-1]
    77 
    78                 inside = check_inside(cond, config, ctype)
    79 
    80                 if (ctype == 'cnf') and (not inside):
    81                         return False
    82 
    83                 if (ctype == 'dnf') and inside:
    84                         return True
    85 
    86         if ctype == 'cnf':
    87                 return True
    88 
    89         return False
    90 
    91 def check_inside(text, config, ctype):
    92         "Check for condition"
    93 
    94         if ctype == 'cnf':
    95                 conds = text.split('|')
    96         else:
    97                 conds = text.split('&')
    98 
    99         for cond in conds:
    100                 res = re.match(r'^(.*?)(!?=)(.*)$', cond)
    101                 if not res:
    102                         raise RuntimeError("Invalid condition: %s" % cond)
    103 
    104                 condname = res.group(1)
    105                 oper = res.group(2)
    106                 condval = res.group(3)
    107 
    108                 if not condname in config:
    109                         varval = ''
    110                 else:
    111                         varval = config[condname]
    112                         if (varval == '*'):
    113                                 varval = 'y'
    114 
    115                 if ctype == 'cnf':
    116                         if (oper == '=') and (condval == varval):
    117                                 return True
    118 
    119                         if (oper == '!=') and (condval != varval):
    120                                 return True
    121                 else:
    122                         if (oper == '=') and (condval != varval):
    123                                 return False
    124 
    125                         if (oper == '!=') and (condval == varval):
    126                                 return False
    127 
    128         if ctype == 'cnf':
    129                 return False
    130 
    131         return True
    132 
    133210def parse_rules(fname, rules):
    134211        "Parse rules file"
     
    149226
    150227                        cond = res.group(1)
     228                        if cond:
     229                                cond = CondParser(cond).parse()
    151230                        varname = res.group(2)
    152231                        vartype = res.group(3)
     
    232311                varname, vartype, name, choices, cond = rule
    233312
    234                 if cond and (not check_condition(cond, config, rules)):
     313                if cond and not cond.evaluate(config):
    235314                        continue
    236315
     
    279358
    280359        # First check that this rule would make sense
    281         if cond:
    282                 if not check_condition(cond, config, rules):
    283                         return random_choices(config, rules, start_index + 1)
     360        if cond and not cond.evaluate(config):
     361                return random_choices(config, rules, start_index + 1)
    284362
    285363        # Remember previous choices for backtracking
     
    460538
    461539        try:
    462                 version = subprocess.Popen(['git', 'log', '-1', '--pretty=%h'], stdout = subprocess.PIPE).communicate()[0].decode().strip()
     540                version = subprocess.Popen(['git', '-C', os.path.dirname(RULES_FILE), 'log', '-1', '--pretty=%h'], stdout = subprocess.PIPE).communicate()[0].decode().strip()
    463541                sys.stderr.write("ok\n")
    464542        except:
     
    487565
    488566        for varname, vartype, name, choices, cond in rules:
    489                 if cond and (not check_condition(cond, config, rules)):
     567                if cond and not cond.evaluate(config):
    490568                        continue
    491569
     
    514592        outmk.write('TIMESTAMP_UNIX = %d\n' % timestamp_unix)
    515593        outmc.write('#define TIMESTAMP_UNIX %d\n' % timestamp_unix)
    516         defs += ' "-DTIMESTAMP_UNIX=%d"\n' % timestamp_unix
     594        defs += ' "-DTIMESTAMP_UNIX=%d"' % timestamp_unix
    517595
    518596        outmk.write('TIMESTAMP = %s\n' % timestamp)
    519597        outmc.write('#define TIMESTAMP %s\n' % timestamp)
    520         defs += ' "-DTIMESTAMP=%s"\n' % timestamp
    521 
    522         outmk.write(defs)
     598        defs += ' "-DTIMESTAMP=%s"' % timestamp
     599
     600        outmk.write('%s\n' % defs)
    523601
    524602        outmk.close()
     
    604682        parse_rules(RULES_FILE, rules)
    605683
     684        if len(sys.argv) > ARGPOS_CHOICE:
     685                choice = sys.argv[ARGPOS_CHOICE]
     686        else:
     687                choice = None
     688
     689        if len(sys.argv) > ARGPOS_PRESET:
     690                preset = sys.argv[ARGPOS_PRESET]
     691        else:
     692                preset = None
     693
     694        mask_platform = (len(sys.argv) > ARGPOS_MASK_PLATFORM and sys.argv[ARGPOS_MASK_PLATFORM] == "--mask-platform")
     695
    606696        # Input configuration file can be specified on command line
    607697        # otherwise configuration from previous run is used.
    608         if len(sys.argv) >= 4:
    609                 profile = parse_profile_name(sys.argv[3])
     698        if preset is not None:
     699                profile = parse_profile_name(preset)
    610700                read_presets(profile, config)
    611701        elif os.path.exists(MAKEFILE):
     
    613703
    614704        # Default mode: check values and regenerate configuration files
    615         if (len(sys.argv) >= 3) and (sys.argv[2] == 'default'):
     705        if choice == 'default':
    616706                if (infer_verify_choices(config, rules)):
    617707                        preprocess_config(config, rules)
     
    621711        # Hands-off mode: check values and regenerate configuration files,
    622712        # but no interactive fallback
    623         if (len(sys.argv) >= 3) and (sys.argv[2] == 'hands-off'):
    624                 # We deliberately test sys.argv >= 4 because we do not want
     713        if choice == 'hands-off':
     714                # We deliberately test this because we do not want
    625715                # to read implicitly any possible previous run configuration
    626                 if len(sys.argv) < 4:
     716                if preset is None:
    627717                        sys.stderr.write("Configuration error: No presets specified\n")
    628718                        return 2
     
    637727
    638728        # Check mode: only check configuration
    639         if (len(sys.argv) >= 3) and (sys.argv[2] == 'check'):
     729        if choice == 'check':
    640730                if infer_verify_choices(config, rules):
    641731                        return 0
     
    643733
    644734        # Random mode
    645         if (len(sys.argv) == 3) and (sys.argv[2] == 'random'):
     735        if choice == 'random':
    646736                ok = random_choices(config, rules, 0)
    647737                if not ok:
     
    669759                        options = []
    670760                        opt2row = {}
    671                         cnt = 1
    672 
    673                         options.append("  --- Load preconfigured defaults ... ")
     761                        cnt = 0
     762
     763                        if not mask_platform:
     764                                cnt += 1
     765                                options.append("  --- Load preconfigured defaults ... ")
    674766
    675767                        for rule in rules:
    676768                                varname, vartype, name, choices, cond = rule
    677769
    678                                 if cond and (not check_condition(cond, config, rules)):
     770                                if cond and not cond.evaluate(config):
    679771                                        continue
     772
     773                                if mask_platform and (varname == "PLATFORM" or varname == "MACHINE" or varname == "COMPILER"):
     774                                        rule = varname, vartype, "(locked) " + name, choices, cond
    680775
    681776                                if varname == selname:
     
    725820                                        continue
    726821
    727                         if value == 0:
     822                        if value == 0 and not mask_platform:
    728823                                profile = choose_profile(PRESETS_DIR, MAKEFILE, screen, config)
    729824                                if profile != None:
     
    742837                        else:
    743838                                value = config[selname]
     839
     840                        if mask_platform and (selname == "PLATFORM" or selname == "MACHINE" or selname == "COMPILER"):
     841                                        continue
    744842
    745843                        if seltype == 'choice':
  • tools/ew.py

    r9259d20 r3e828ea  
    3333"""
    3434
     35import inspect
    3536import os
     37import platform
     38import re
     39import subprocess
    3640import sys
    37 import subprocess
    38 import autotool
    39 import platform
    4041import thread
    4142import time
    4243
    4344overrides = {}
     45
     46CONFIG = 'Makefile.config'
     47
     48TOOLS_DIR = os.path.dirname(inspect.getabsfile(inspect.currentframe()))
     49
     50def read_config():
     51        "Read HelenOS build configuration"
     52
     53        inf = open(CONFIG, 'r')
     54        config = {}
     55
     56        for line in inf:
     57                res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
     58                if (res):
     59                        config[res.group(1)] = res.group(2)
     60
     61        inf.close()
     62        return config
    4463
    4564def is_override(str):
     
    5776
    5877def termemu_detect():
    59         for termemu in ['xfce4-terminal', 'xterm']:
     78        emus = ['gnome-terminal', 'xfce4-terminal', 'xterm']
     79        for termemu in emus:
    6080                try:
    6181                        subprocess.check_output('which ' + termemu, shell = True)
     
    6484                        pass
    6585
     86        print('Could not find any of the terminal emulators %s.'%(emus))
     87        sys.exit(1)
     88
    6689def run_in_console(cmd, title):
    67         ecmd = cmd.replace('"', '\\"')
    68         cmdline = termemu_detect() + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
     90        temu = termemu_detect()
     91        if temu == 'gnome-terminal':
     92                cmdline = temu + ' -- ' + cmd
     93        else:
     94                ecmd = cmd.replace('"', '\\"')
     95                cmdline = temu + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
     96
    6997        print(cmdline)
    7098        if not is_override('dryrun'):
     
    87115
    88116def malta_options():
    89         return '-cpu 4Kc'
     117        return '-cpu 4Kc -append "console=devices/\\hw\\pci0\\00:0a.0\\com1\\a"'
     118
     119def find_firmware(name, environ_var, default_paths, extra_info=None):
     120        """Find firmware image(s)."""
     121
     122        if environ_var in os.environ:
     123                return os.environ[environ_var]
     124
     125        for path in default_paths:
     126                if os.path.exists(path):
     127                        return path
     128
     129        sys.stderr.write("Cannot find %s binary image(s)!\n" % name)
     130        sys.stderr.write(
     131            "Either set %s environment variable accordingly or place the image(s) in one of the default locations: %s.\n" %
     132            (environ_var, ", ".join(default_paths)))
     133        if extra_info is not None:
     134                sys.stderr.write(extra_info)
     135        return None
    90136
    91137def platform_to_qemu_options(platform, machine, processor):
     
    94140        elif platform == 'arm32':
    95141                return 'system-arm', '-M integratorcp'
     142        elif platform == 'arm64':
     143                # Search for the EDK2 firmware image
     144                default_paths = (
     145                        '/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom
     146                        '/usr/share/edk2/aarch64/QEMU_EFI.fd',     # Fedora
     147                        '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu
     148                )
     149                extra_info = ("Pre-compiled binary can be obtained from "
     150                    "http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-AARCH64/RELEASE_GCC49/QEMU_EFI.fd.\n")
     151                efi_path = find_firmware(
     152                    "EDK2", 'EW_QEMU_EFI_AARCH64', default_paths, extra_info)
     153                if efi_path is None:
     154                        raise Exception
     155
     156                return 'system-aarch64', \
     157                    '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path
    96158        elif platform == 'ia32':
    97159                return 'system-i386', pc_options(32)
     
    108170                if processor == 'us':
    109171                        return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"'
    110                 elif processor == 'sun4v':
    111                         default_path = '/usr/local/opensparc/image/'
    112                 try:
    113                         if os.path.exists(default_path):
    114                                 opensparc_bins = default_path
    115                         elif os.path.exists(os.environ['OPENSPARC_BINARIES']):
    116                                 opensparc_bins = os.environ['OPENSPARC_BINARIES']
    117                         else:
    118                                 raise Exception
    119                 except:
    120                         print("Cannot find OpenSPARC binary images!")
    121                         print("Either set OPENSPARC_BINARIES environment variable accordingly or place the images in %s." % (default_path))
     172
     173                # processor = 'sun4v'
     174                opensparc_bins = find_firmware(
     175                    "OpenSPARC", 'OPENSPARC_BINARIES',
     176                    ('/usr/local/opensparc/image/', ))
     177                if opensparc_bins is None:
    122178                        raise Exception
    123179
     
    127183def hdisk_mk():
    128184        if not os.path.exists('hdisk.img'):
    129                 subprocess.call('tools/mkfat.py 1048576 uspace/dist/data hdisk.img', shell = True)
     185                subprocess.call(TOOLS_DIR + '/mkfat.py 1048576 dist/data hdisk.img', shell = True)
    130186
    131187def qemu_bd_options():
     
    208264                cmdline += ' ' + options
    209265
    210         cmdline += qemu_bd_options()
    211 
     266        if (not 'hdd' in cfg.keys() or cfg['hdd']):
     267                cmdline += qemu_bd_options()
    212268        if (not 'net' in cfg.keys()) or cfg['net']:
    213269                cmdline += qemu_net_options()
     
    234290        if cfg['image'] == 'image.iso':
    235291                cmdline += ' -boot d -cdrom image.iso'
     292        elif cfg['image'] == 'image.iso@arm64':
     293                # Define image.iso cdrom backend.
     294                cmdline += ' -drive if=none,file=image.iso,id=cdrom,media=cdrom'
     295                # Define scsi bus.
     296                cmdline += ' -device virtio-scsi-device'
     297                # Define cdrom frontend connected to this scsi bus.
     298                cmdline += ' -device scsi-cd,drive=cdrom'
    236299        elif cfg['image'] == 'image.boot':
    237300                cmdline += ' -kernel image.boot'
     
    254317
    255318def ski_run(platform, machine, processor):
    256         run_in_console('ski -i tools/conf/ski.conf', 'HelenOS/ia64 on ski')
     319        run_in_console('ski -i ' + TOOLS_DIR + '/conf/ski.conf', 'HelenOS/ia64 on ski')
    257320
    258321def msim_run(platform, machine, processor):
    259322        hdisk_mk()
    260         run_in_console('msim -c tools/conf/msim.conf', 'HelenOS/mips32 on msim')
     323        run_in_console('msim -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim')
    261324
    262325def spike_run(platform, machine, processor):
     
    276339                        'xhci' : False,
    277340                        'tablet' : False
     341                }
     342        },
     343        'arm64' : {
     344                'virt' : {
     345                        'run' : qemu_run,
     346                        'image' : 'image.iso@arm64',
     347                        'audio' : False,
     348                        'console' : True,
     349                        'hdd' : False,
     350                        'net' : False,
     351                        'tablet' : False,
     352                        'usb' : False,
     353                        'xhci' : False
    278354                }
    279355        },
     
    438514                        exit()
    439515
    440         config = {}
    441         autotool.read_config(autotool.CONFIG, config)
     516        config = read_config()
    442517
    443518        if 'PLATFORM' in config.keys():
  • tools/export.sh

    • Property mode changed from 100644 to 100755
    r9259d20 r3e828ea  
     1#!/bin/sh
     2
    13#
    2 # Copyright (c) 2012 Petr Koupy
     4# Copyright (c) 2019 Jiří Zárevúcky
    35# All rights reserved.
    46#
     
    2729#
    2830
    29 USPACE_PREFIX = ../..
     31if [ "$#" -ne 1 ]; then
     32        echo "Must define export directory."
     33        exit 1
     34fi
    3035
    31 # TODO: Should be just "gui", rest is transitive dependencies.
    32 LIBS = gui draw softrend compress math
     36EXPORT_DIR="$1"
    3337
    34 BINARY = vlaunch
     38# Only (re)build files we actually want to export.
    3539
    36 IMG = image
    37 IMGS = $(IMG)s
     40EXPORT_LIBS=" \
     41        uspace/lib/libmath.a \
     42        uspace/lib/libclui.a \
     43        uspace/lib/libgui.a \
     44        uspace/lib/libdraw.a \
     45        uspace/lib/libsoftrend.a \
     46        uspace/lib/libhound.a \
     47        uspace/lib/libpcm.a \
     48        uspace/lib/libcpp.a \
     49        uspace/lib/libc.a \
     50        uspace/lib/c/libstartfiles.a \
     51        uspace/lib/libposix.a \
     52"
    3853
    39 SOURCES = \
    40         vlaunch.c \
    41         $(IMGS).s \
    42         $(IMGS)_desc.c
     54EXPORT_CONFIGS=" \
     55        meson/part/exports/config.mk \
     56        meson/part/exports/config.sh \
     57"
    4358
    44 IMAGES = \
    45         gfx/helenos.tga
     59ninja $EXPORT_LIBS $EXPORT_CONFIGS
     60ninja devel-headers
    4661
    47 PRE_DEPEND = $(IMGS).s $(IMGS).h $(IMGS)_desc.c
    48 EXTRA_CLEAN = $(IMGS).s $(IMGS).h $(IMGS)_desc.c $(IMGS).zip
    49 
    50 include $(USPACE_PREFIX)/Makefile.common
    51 
    52 $(IMGS).s: $(IMGS).zip
    53         unzip -p $< $@ > $@
    54 
    55 $(IMGS).h: $(IMGS).zip
    56         unzip -p $< $@ > $@
    57 
    58 $(IMGS)_desc.c: $(IMGS).zip
    59         unzip -p $< $@ > $@
    60 
    61 $(IMGS).zip: $(IMAGES)
    62         $(ROOT_PATH)/tools/mkarray.py $(IMGS) $(IMG) "$(AS_PROLOG)" .data $^
     62mkdir -p "$EXPORT_DIR/lib"
     63cp -t "$EXPORT_DIR/lib" $EXPORT_LIBS
     64rm -rf "$EXPORT_DIR/include"
     65cp -R dist/include "$EXPORT_DIR/include"
     66cp -t "$EXPORT_DIR" $EXPORT_CONFIGS
  • tools/grub/grub-update.sh

    r9259d20 r3e828ea  
    4040grub_rev="bc220962e366b1b46769ed6f9fa5be603ba58ab5"
    4141
     42build_ia32amd64_pc=false
     43build_ia32amd64_efi=false
     44build_arm64_efi=false
     45
    4246function grub_build()
    4347{
    44         target="$1"
    45         platform="$2"
     48        platform="$1"
     49        conf_target="$2"
     50        conf_platform="$3"
    4651
    47         ./configure --prefix="$builddir/$target-$platform" --target="$target" --with-platform="$platform" --disable-werror || exit 1
     52        ./configure --prefix="$builddir/$platform" --target="$conf_target" --with-platform="$conf_platform" --disable-werror || exit 1
    4853        make clean || exit 1
    4954        make install || exit 1
     
    5560        platform="$2"
    5661
    57         rm -rf "$helenosdir"/boot/"$gdir"/"$platform" || exit 1
    58         cp -R "$builddir"/"$platform"/lib64/grub/"$platform" "$helenosdir"/boot/"$gdir" || exit 1
    59         rm -f "$helenosdir"/boot/"$gdir"/"$platform"/*.image || exit 1
    60         rm -f "$helenosdir"/boot/"$gdir"/"$platform"/*.module || exit 1
    61         git add "$helenosdir"/boot/"$gdir"/"$platform" || exit 1
     62        echo "$grub_rev" > "$helenosdir"/boot/grub/"$gdir"/REVISION || exit 1
     63        rm -rf "$helenosdir"/boot/grub/"$gdir"/"$platform" || exit 1
     64        cp -R "$builddir"/"$platform"/lib*/grub/"$platform" "$helenosdir"/boot/grub/"$gdir" || exit 1
     65        rm -f "$helenosdir"/boot/grub/"$gdir"/"$platform"/*.image || exit 1
     66        rm -f "$helenosdir"/boot/grub/"$gdir"/"$platform"/*.module || exit 1
     67        git add "$helenosdir"/boot/grub/"$gdir"/"$platform" || exit 1
    6268}
     69
     70function show_usage()
     71{
     72        echo "Script to generate/update prebuild Grub2 in HelenOS source tree"
     73        echo
     74        echo "Syntax:"
     75        echo " $0 <target>"
     76        echo
     77        echo "Possible targets are:"
     78        echo " ia32+amd64-pc"
     79        echo " ia32+amd64-efi"
     80        echo " arm64-efi"
     81        echo " all             build all targets"
     82        echo
     83
     84        exit 3
     85}
     86
     87if [ "$#" -ne "1" ] ; then
     88        show_usage
     89fi
     90
     91case "$1" in
     92        ia32+amd64-pc)
     93                build_ia32amd64_pc=true
     94                ;;
     95        ia32+amd64-efi)
     96                build_ia32amd64_efi=true
     97                ;;
     98        arm64-efi)
     99                build_arm64_efi=true
     100                ;;
     101        all)
     102                build_ia32amd64_pc=true
     103                build_ia32amd64_efi=true
     104                build_arm64_efi=true
     105                ;;
     106        *)
     107                show_usage
     108                ;;
     109esac
    63110
    64111# Prepare a clone of Grub2 repo
     
    72119git reset --hard "$grub_rev" || exit 1
    73120
    74 echo "$grub_rev" >"$helenosdir"/boot/grub.pc/REVISION || exit 1
    75 echo "$grub_rev" > "$helenosdir"/boot/grub.efi/REVISION || exit 1
     121./autogen.sh || exit 1
    76122
    77 # Build each platform to a different directory
    78 ./autogen.sh || exit 1
    79 grub_build i386 pc
    80 grub_build i386 efi
    81 grub_build x86_64 efi
     123if $build_ia32amd64_pc ; then
     124        cd "$workdir" || exit 1
     125        grub_build i386-pc i386 pc
    82126
    83 # Extract El Torrito boot image for i386-pc
    84 cd "$helenosdir"/boot/grub.pc || exit 1
    85 rm -f pc.img || exit 1
    86 "$builddir"/i386-pc/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
     127        # Extract El Torrito boot image for i386-pc
     128        cd "$helenosdir"/boot/grub/ia32-pc || exit 1
     129        rm -f pc.img || exit 1
     130        "$builddir"/i386-pc/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
    87131
    88 # Extract El Torrito boot image for i386-efi
    89 cd "$helenosdir"/boot/grub.efi || exit 1
    90 rm -f efi.img.gz || exit 1
    91 "$builddir"/i386-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
    92 mv efi.img i386-efi.img
     132        grub_files_update ia32-pc i386-pc
     133fi
    93134
    94 # Extract El Torrito boot image for x86_64-efi
    95 cd "$helenosdir"/boot/grub.efi || exit 1
    96 rm -f efi.img.gz || exit 1
    97 "$builddir"/x86_64-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
     135if $build_ia32amd64_efi ; then
     136        cd "$workdir" || exit 1
    98137
    99 # Combine El Torrito boot images for x86_64-efi and i386-efi
    100 mkdir tmp || exit 1
    101 mcopy -ns -i i386-efi.img ::efi tmp || exit 1
    102 mcopy -s -i efi.img tmp/* :: || exit 1
    103 gzip efi.img || exit 1
    104 rm -rf tmp || exit 1
    105 rm -f i386-efi.img || exit 1
     138        # Build each platform to a different directory
     139        grub_build i386-efi i386 efi
     140        grub_build x86_64-efi x86_64 efi
    106141
    107 # Update Grub files for all platforms
    108 grub_files_update grub.pc i386-pc
    109 grub_files_update grub.efi i386-efi
    110 grub_files_update grub.efi x86_64-efi
     142        # Extract El Torrito boot image for i386-efi
     143        cd "$helenosdir"/boot/grub/ia32-efi || exit 1
     144        rm -f efi.img.gz || exit 1
     145        "$builddir"/i386-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
     146        mv efi.img i386-efi.img
     147
     148        # Extract El Torrito boot image for x86_64-efi
     149        cd "$helenosdir"/boot/grub/ia32-efi || exit 1
     150        rm -f efi.img.gz || exit 1
     151        "$builddir"/x86_64-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
     152
     153        # Combine El Torrito boot images for x86_64-efi and i386-efi
     154        mkdir tmp || exit 1
     155        mcopy -ns -i i386-efi.img ::efi tmp || exit 1
     156        mcopy -s -i efi.img tmp/* :: || exit 1
     157        gzip efi.img || exit 1
     158        rm -rf tmp || exit 1
     159        rm -f i386-efi.img || exit 1
     160
     161        # Update Grub files for all platforms
     162        grub_files_update ia32-efi i386-efi
     163        grub_files_update ia32-efi x86_64-efi
     164fi
     165
     166if $build_arm64_efi ; then
     167        cd "$workdir" || exit 1
     168
     169        # Check that the expected compiler is present on PATH
     170        if ! [ -x "$(command -v aarch64-linux-gnu-gcc)" ] ; then
     171                echo "Error: aarch64-linux-gnu-gcc is missing" >&2
     172                exit 1
     173        fi
     174
     175        grub_build arm64-efi aarch64-linux-gnu efi
     176
     177        # Extract El Torrito boot image for arm64-efi
     178        cd "$helenosdir"/boot/grub/arm64-efi || exit 1
     179        rm -f efi.img.gz || exit 1
     180        "$builddir"/arm64-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
     181        gzip efi.img || exit 1
     182
     183        grub_files_update arm64-efi arm64-efi
     184fi
    111185
    112186echo "GRUB update successful."
  • tools/grub/mkimage.sh

    r9259d20 r3e828ea  
    3939orig_dir="$(cd "$(dirname "$0")" && pwd)"
    4040grub_tools_dir="$orig_dir/grub-build/i386-pc/bin"
    41 grub_mod_dir="$orig_dir/../../boot/grub.pc/i386-pc"
     41grub_mod_dir="$orig_dir/../../boot/grub/ia32-pc/i386-pc"
    4242
    4343"$grub_tools_dir"/grub-mkimage --directory "$grub_mod_dir" \
  • tools/mkarray_for_meson.sh

    • Property mode changed from 100644 to 100755
    r9259d20 r3e828ea  
     1#!/bin/sh
     2
    13#
    2 # Copyright (c) 2010 Jiri Svoboda
     4# Copyright (c) 2019 Jiří Zárevúcky
    35# All rights reserved.
    46#
     
    2729#
    2830
    29 .PHONY: all clean
     31TOOLS_DIR=`which -- "$0" 2>/dev/null`
     32if [ -z "$TOOLS_DIR" ]; then
     33        TOOLS_DIR=`which -- "$BASH_SOURCE" 2>/dev/null`
     34fi
     35TOOLS_DIR=`dirname $TOOLS_DIR`
     36TOOLS_DIR=`cd $TOOLS_DIR && echo $PWD`
    3037
    31 include Makefile.common
    3238
    33 IMAGE_NAME = HelenOS-$(RELEASE)
    34 BIN_OUTPUT = image.bin
     39_outdir="$1"
     40_arg1="$2"
     41_arg2="$3"
     42_arg3="$4"
     43_arg4="$5"
     44_inputs=""
    3545
    36 all: $(POST_OUTPUT)
     46shift 5
    3747
    38 $(BIN_OUTPUT): $(BOOT_OUTPUT)
    39         $(OBJCOPY) -O binary $< $@
     48for file in "$@"; do
     49        _inputs="$_inputs $PWD/${file}"
     50done
    4051
    41 $(POST_OUTPUT): $(BIN_OUTPUT)
    42         $(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr $(LADDR) -saddr $(SADDR) -ostype $(UIMAGE_OS) $< $@
    43 
    44 clean:
    45         rm -f $(BIN_OUTPUT)
     52cd $_outdir
     53$TOOLS_DIR/mkarray.py "$_arg1" "$_arg2" "$_arg3" "$_arg4" $_inputs > /dev/null
  • tools/release.sh

    r9259d20 r3e828ea  
    1 #! /bin/bash
     1#!/bin/sh
    22
    33#
    4 # Copyright (c) 2010 Jakub Jermar
     4# Copyright (c) 2019 Jiří Zárevúcky
    55# All rights reserved.
    66#
     
    2929#
    3030
    31 if [ $1" " == "-h " ];
    32 then
    33         echo "Perform pre-integration hands-off build of all profiles."
    34         echo
    35         echo "Syntax:"
    36         echo " $0 [-h] [args...]"
    37         echo
    38         echo " -h        Print this help."
    39         echo " args...   All other args are passed to make (e.g. -j 6)"
    40         echo
     31# Find out the path to the script.
     32SOURCE_DIR=`which -- "$0" 2>/dev/null`
     33# Maybe we are running bash.
     34[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
     35[ -z "$SOURCE_DIR" ] && exit 1
     36SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
     37SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
    4138
    42         exit
    43 fi
    4439
    45 FAILED=""
    46 PASSED=""
    47 PROFILES=""
    48 DIRS=`find defaults/ -name Makefile.config | sed 's/^defaults\/\(.*\)\/Makefile.config/\1/' | sort`
     40echo "Running tools/build_all.sh"
    4941
    50 for D in $DIRS;
    51 do
    52         for H in $DIRS;
    53         do
    54                 if [ `echo $H | grep "^$D\/.*"`x != "x"  ];
    55                 then
    56                         continue 2
    57                 fi
    58         done
    59         PROFILES="$PROFILES $D"
    60 done
     42mkdir -p build_all
     43cd build_all
     44sh "${SOURCE_DIR}/tools/build_all.sh"
     45cd ..
    6146
    62 echo ">>> Going to build the following profiles:"
    63 echo $PROFILES
    64 
    65 for P in $PROFILES;
    66 do
    67         echo -n ">>>> Building $P... "
    68         ( make distclean && make PROFILE=$P HANDS_OFF=y "$@" ) >>/dev/null 2>>/dev/null
    69         if [ $? -ne 0 ];
    70         then
    71                 FAILED="$FAILED $P"
    72                 echo "failed."
    73         else
    74                 PASSED="$PASSED $P"
    75                 echo "ok."
    76         fi
    77 done
    78 
    79 echo ">>> Done."
     47echo
    8048echo
    8149
    82 echo ">>> The following profiles passed:"
    83 echo $PASSED
    84 echo
     50PROFILES=`sh ${SOURCE_DIR}/tools/list_profiles.sh`
     51RELEASE=`sed -n 's:^HELENOS_RELEASE \?= \?\(.*\)$:\1:p' "${SOURCE_DIR}/version"`
     52SRC_ARCHIVE="HelenOS-${RELEASE}-src.tar"
    8553
    86 echo ">>> The following profiles failed:"
    87 echo $FAILED
    88 echo
     54git -C "${SOURCE_DIR}" archive master -o "${PWD}/${SRC_ARCHIVE}"
     55bzip2 -f "${SRC_ARCHIVE}"
     56echo "Created ${SRC_ARCHIVE}.bz2"
    8957
     58for profile in $PROFILES; do
     59        image_name=`cat build_all/$profile/image_path`
     60        if [ -z "$image_name" ]; then
     61                continue
     62        fi
     63
     64        image_path="build_all/$profile/`cat build_all/$profile/image_path`"
     65        image_suffix=`echo "$image_name" | sed 's:.*\.::'`
     66
     67        release_name="HelenOS-${RELEASE}-`echo $profile | tr '/' '-'`.$image_suffix"
     68        cp "$image_path" "$release_name"
     69
     70        echo "Created $release_name"
     71done
  • tools/srepl

    r9259d20 r3e828ea  
    11#!/bin/sh
     2
     3#
     4# Copyright (c) 2019 Jiří Zárevúcky
     5# All rights reserved.
     6#
     7# Redistribution and use in source and binary forms, with or without
     8# modification, are permitted provided that the following conditions
     9# are met:
     10#
     11# - Redistributions of source code must retain the above copyright
     12#   notice, this list of conditions and the following disclaimer.
     13# - Redistributions in binary form must reproduce the above copyright
     14#   notice, this list of conditions and the following disclaimer in the
     15#   documentation and/or other materials provided with the distribution.
     16# - The name of the author may not be used to endorse or promote products
     17#   derived from this software without specific prior written permission.
     18#
     19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29#
    230
    331usage()
  • tools/toolchain.sh

    r9259d20 r3e828ea  
    1 #! /bin/bash
     1#!/bin/sh
    22
    33#
     
    6666        echo " amd64      AMD64 (x86-64, x64)"
    6767        echo " arm32      ARM 32b"
     68        echo " arm64      AArch64"
    6869        echo " ia32       IA-32 (x86, i386)"
    6970        echo " ia64       IA-64 (Itanium)"
     
    102103        echo
    103104       
    104         if [ -z "$1" ] || [ "$1" == "all" ] ; then
    105                 PLATFORMS=("amd64" "arm32" "ia32" "ia64" "mips32" "mips32eb" "ppc32" "riscv64" "sparc64")
     105        if [ -z "$1" ] || [ "$1" = "all" ] ; then
     106                PLATFORMS='amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64'
    106107        else
    107                 PLATFORMS=("$1")
     108                PLATFORMS="$1"
    108109        fi
    109110       
     
    113114        fi
    114115
    115         for i in "${PLATFORMS[@]}"
     116        for i in $PLATFORMS
    116117        do
    117118                PLATFORM="$i"
     
    120121
    121122                echo "== $PLATFORM =="
    122                 test_app_version "Binutils" "ld" "GNU\ ld\ \(GNU\ Binutils\)\ ((\.|[0-9])+)" "$BINUTILS_VERSION"
    123                 test_app_version "GCC" "gcc" "gcc\ version\ ((\.|[0-9])+)" "$GCC_VERSION"
    124                 test_app_version "GDB" "gdb" "GNU\ gdb\ \(GDB\)\s+((\.|[0-9])+)" "$GDB_VERSION"
     123                test_app_version "Binutils" "ld" "GNU ld (.*) \([.0-9]*\)" "$BINUTILS_VERSION"
     124                test_app_version "GCC" "gcc" "gcc version \([.0-9]*\)" "$GCC_VERSION"
     125                test_app_version "GDB" "gdb" "GNU gdb (.*)[[:space:]]\+\([.0-9]*\)" "$GDB_VERSION"
    125126        done
    126127
     
    139140                echo "- $PKGNAME is missing"
    140141        else
    141                 {
    142                         OUT=$(${APP} -v 2>&1)
    143                 } &> /dev/null
    144 
    145                 if [[ "$OUT" =~ $REGEX ]]; then
    146                 VERSION="${BASH_REMATCH[1]}"
    147                 if [ "$INS_VERSION" = "$VERSION" ]; then
    148                         echo "+ $PKGNAME is uptodate ($INS_VERSION)"
    149                 else
    150                         echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
    151                 fi
    152             else
    153                 echo "- $PKGNAME Unexpected output"
    154             fi
     142                VERSION=`${APP} -v 2>&1 | sed -n "s:^${REGEX}.*:\1:p"`
     143
     144                if [ -z "$VERSION" ]; then
     145                        echo "- $PKGNAME Unexpected output"
     146                        return 1
     147                fi
     148
     149                if [ "$INS_VERSION" = "$VERSION" ]; then
     150                        echo "+ $PKGNAME is uptodate ($INS_VERSION)"
     151                else
     152                        echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
     153                fi
    155154        fi
    156155}
     
    159158
    160159change_title() {
    161         echo -en "\e]0;$1\a"
     160        printf "\e]0;$1\a"
    162161}
    163162
     
    170169        fi
    171170
    172         echo -n "${TM} "
     171        printf "${TM} "
    173172        change_title "${TM}"
    174173        sleep 1
     
    221220        OUTSIDE="$1"
    222221        BASE="$2"
    223         ORIGINAL="`pwd`"
     222        ORIGINAL="$PWD"
     223
     224        cd "${BASE}"
     225        check_error $? "Unable to change directory to ${BASE}."
     226        ABS_BASE="$PWD"
     227        cd "${ORIGINAL}"
     228        check_error $? "Unable to change directory to ${ORIGINAL}."
    224229
    225230        mkdir -p "${OUTSIDE}"
    226 
    227231        cd "${OUTSIDE}"
    228232        check_error $? "Unable to change directory to ${OUTSIDE}."
    229         ABS_OUTSIDE="`pwd`"
    230 
    231         cd "${BASE}"
    232         check_error $? "Unable to change directory to ${BASE}."
    233         ABS_BASE="`pwd`"
     233
     234        while [ "${#PWD}" -gt "${#ABS_BASE}" ]; do
     235                cd ..
     236        done
     237
     238        if [ "$PWD" = "$ABS_BASE" ]; then
     239                echo
     240                echo "CROSS_PREFIX cannot reside within the working directory."
     241
     242                exit 5
     243        fi
    234244
    235245        cd "${ORIGINAL}"
    236246        check_error $? "Unable to change directory to ${ORIGINAL}."
    237 
    238         BASE_LEN="${#ABS_BASE}"
    239         OUTSIDE_TRIM="${ABS_OUTSIDE:0:${BASE_LEN}}"
    240 
    241         if [ "${OUTSIDE_TRIM}" == "${ABS_BASE}" ] ; then
    242                 echo
    243                 echo "CROSS_PREFIX cannot reside within the working directory."
    244 
    245                 exit 5
    246         fi
    247247}
    248248
     
    275275                "arm32")
    276276                        GNU_ARCH="arm"
     277                        ;;
     278                "arm64")
     279                        GNU_ARCH="aarch64"
    277280                        ;;
    278281                "ia32")
     
    341344                mkdir -p "${WORKDIR}/sysroot/include"
    342345                mkdir "${WORKDIR}/sysroot/lib"
     346                ARCH="$PLATFORM"
     347                if [ "$ARCH" = "mips32eb" ]; then
     348                        ARCH=mips32
     349                fi
     350
    343351                cp -r -L -t "${WORKDIR}/sysroot/include" \
    344352                        ${SRCDIR}/../abi/include/* \
    345                         ${SRCDIR}/../uspace/lib/c/arch/${PLATFORM}/include/* \
     353                        ${SRCDIR}/../uspace/lib/c/arch/${ARCH}/include/* \
    346354                        ${SRCDIR}/../uspace/lib/c/include/*
    347355                check_error $? "Failed to create build sysroot."
     
    497505                test_version
    498506                ;;
    499         amd64|arm32|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
     507        amd64|arm32|arm64|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
    500508                prepare
    501509                build_target "$1"
     
    505513                build_target "amd64"
    506514                build_target "arm32"
     515                build_target "arm64"
    507516                build_target "ia32"
    508517                build_target "ia64"
     
    517526                build_target "amd64"
    518527                build_target "arm32"
     528                build_target "arm64"
    519529                build_target "ia32"
    520530                build_target "ia64"
     
    528538                build_target "amd64" &
    529539                build_target "arm32" &
     540                build_target "arm64" &
    530541                build_target "ia32" &
    531542                build_target "ia64" &
     
    543554                wait
    544555
     556                build_target "arm64" &
    545557                build_target "ia32" &
     558                wait
     559
    546560                build_target "ia64" &
     561                build_target "mips32" &
    547562                wait
    548563
    549                 build_target "mips32" &
    550564                build_target "mips32eb" &
     565                build_target "ppc32" &
    551566                wait
    552567
    553                 build_target "ppc32" &
    554568                build_target "riscv64" &
    555                 wait
    556 
    557569                build_target "sparc64" &
    558570                wait
  • tools/travis.sh

    r9259d20 r3e828ea  
    5252arm32/integratorcp:arm-helenos:image.boot
    5353arm32/raspberrypi:arm-helenos:uImage.bin
     54arm64/virt:aarch64-helenos:image.iso
    5455ia32:i686-helenos:image.iso
    5556ia64/i460GX:ia64-helenos:image.boot
     
    8687    echo "Will try to run C style check."
    8788    echo
    88     make ccheck || exit 1
     89    cd tools
     90    ./build-ccheck.sh || exit 1
     91    cd ..
     92    tools/ccheck.sh || exit 1
    8993    echo "C style check passed."
    9094    exit 0
     
    153157    fi
    154158
    155 
    156159    # Build it
    157     make "PROFILE=$H_ARCH" HANDS_OFF=y || exit 1
    158     test -s "$H_OUTPUT_FILENAME" || exit 1
     160    SRCDIR="$PWD"
     161
     162    mkdir -p build/$H_ARCH || exit 1
     163    cd build/$H_ARCH
     164
     165    export PATH="/usr/local/cross/bin:$PATH"
     166
     167    $SRCDIR/configure.sh $H_ARCH || exit 1
     168    ninja || exit 1
     169    ninja image_path || exit 1
     170
     171    cd $SRCDIR
    159172
    160173    echo
     
    185198            ) >hsct.conf || exit 1
    186199
    187             "$HOME/helenos-harbours/hsct.sh" init "$H_HELENOS_HOME" || exit 1
     200            "$HOME/helenos-harbours/hsct.sh" init "$H_HELENOS_HOME" $H_ARCH || exit 1
    188201
    189202            # We cannot flood the output as Travis has limit of maximum output size
  • tools/xcw/bin/helenos-cc

    r9259d20 r3e828ea  
    3232#
    3333
     34
     35
    3436XCW="$(dirname "$0")"
    3537SRC_ROOT="$XCW/../../.."
    3638if [ -z "$EXPORT_DIR" ]; then
    37         EXPORT_DIR="$SRC_ROOT/uspace/export"
     39        EXPORT_DIR="$SRC_ROOT/build/dist"
    3840fi
    39 UARCH="$("$XCW"/helenos-bld-config --uarch)"
    40 CC="$("$XCW"/helenos-bld-config --cc)"
    41 CFLAGS="$("$XCW"/helenos-bld-config --cflags)"
    42 ENDIAN="$("$XCW"/helenos-bld-config --endian)"
    4341
    44 echo helenos-cc "$@"
    45 "$CC" \
    46     -O3 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32LE -finput-charset=UTF-8 \
    47     $CFLAGS \
    48     -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
    49     -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings -ggdb \
    50     -fno-omit-frame-pointer \
    51     -D "$ENDIAN" \
    52     "$@" \
    53     -I"$XCW"/../include \
    54     -I"$EXPORT_DIR"/include/libc \
    55     -I"$EXPORT_DIR"/include
     42HELENOS_EXPORT_ROOT="$EXPORT_DIR"
     43
     44source "${EXPORT_DIR}/config/config.sh"
     45
     46# CC is a compilation driver, so we should check which stage of compilation
     47# is actually running and select which flags to provide. This makes no
     48# difference for GCC, but e.g. clang warns when a flag is provided that is
     49# unused
     50
     51needs_cflags=true
     52needs_ldflags=true
     53
     54for flag in "$@"; do
     55        case "$flag" in
     56                -E)
     57                        needs_cflags=false
     58                        needs_ldflags=false
     59                        break
     60                        ;;
     61                -c|-S)
     62                        needs_ldflags=false
     63                        break
     64                        ;;
     65        esac
     66done
     67
     68flags="-fwide-exec-charset=UTF-32LE -finput-charset=UTF-8 -fexec-charset=UTF-8"
     69flags="$flags -isystem ${HELENOS_EXPORT_ROOT}/include/libc -idirafter ${HELENOS_EXPORT_ROOT}/include"
     70
     71if $needs_cflags; then
     72        flags="$flags -O3 \
     73            -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
     74            -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings -ggdb"
     75
     76        flags="$flags $HELENOS_CFLAGS"
     77fi
     78
     79if $needs_ldflags; then
     80        flags="$flags $HELENOS_LDFLAGS"
     81fi
     82
     83flags="$flags $@"
     84
     85if $needs_ldflags; then
     86        flags="$flags $HELENOS_LDLIBS"
     87fi
     88
     89echo "helenos-cc" "$@"
     90PATH="$HELENOS_CROSS_PATH:$PATH" "${HELENOS_TARGET}-gcc" $flags
  • tools/xcw/bin/helenos-pkg-config

    r9259d20 r3e828ea  
    3434XCW="$(dirname "$0")"
    3535SRC_ROOT="$XCW/../../.."
    36 UARCH="$("$XCW"/helenos-bld-config --uarch)"
    3736if [ -z "$EXPORT_DIR" ]; then
    38         EXPORT_DIR="$SRC_ROOT/uspace/export"
     37        EXPORT_DIR="$SRC_ROOT/build/dist"
    3938fi
    4039INCLUDE_DIR="$EXPORT_DIR/include"
  • tools/xcw/demo/Makefile

    r9259d20 r3e828ea  
    5757
    5858$(output): $(objects)
    59         $(LD) -o $@ $^ $(LIBS)
     59        $(CC) -o $@ $^ $(LIBS)
    6060
    6161%.o: %.c
Note: See TracChangeset for help on using the changeset viewer.