- output = os.path.join('Bin', 'ResetVector')\r
- output += '.' + arch\r
- if debugType is not None:\r
- output += '.' + debugType\r
- output += '.raw'\r
- commandLine = (\r
- 'nasm',\r
- '-D', 'ARCH_%s' % arch.upper(),\r
- '-D', 'DEBUG_%s' % str(debugType).upper(),\r
- '-o', output,\r
- 'Vtf0.nasmb',\r
- )\r
- ret = RunCommand(commandLine)\r
- print '\tASM\t' + output\r
- if ret != 0: sys.exit(ret)\r
-\r
- commandLine = (\r
- 'python',\r
- 'Tools/FixupForRawSection.py',\r
- output,\r
- )\r
- print '\tFIXUP\t' + output\r
- ret = RunCommand(commandLine)\r
- if ret != 0: sys.exit(ret)\r
+ for pageTable in PAGE_TABLES.keys():\r
+ ret = True\r
+ if arch.lower() == X64.lower():\r
+ directory = os.path.join('Bin', X64, pageTable)\r
+ else:\r
+ directory = os.path.join('Bin', IA32)\r
+\r
+ # output raw binary name with arch type\r
+ fileName = 'ResetVector' + '.' + arch\r
+\r
+ if debugType is not None:\r
+ fileName += '.' + debugType\r
+ fileName += FILE_FORMAT\r
+\r
+ output = os.path.join(directory, fileName)\r
+\r
+ # if the directory not exists then create it\r
+ if not os.path.isdir(directory):\r
+ os.makedirs(directory)\r
+\r
+ # Prepare the command to execute the nasmb\r
+ commandLine = (\r
+ 'nasm',\r
+ '-D', 'ARCH_%s' % arch.upper(),\r
+ '-D', 'DEBUG_%s' % str(debugType).upper(),\r
+ '-D', PAGE_TABLES[pageTable].upper(),\r
+ '-o', output,\r
+ 'Vtf0.nasmb',\r
+ )\r
+\r
+ print(f"Command : {' '.join(commandLine)}")\r
+\r
+ try:\r
+ ret = RunCommand(commandLine)\r
+ except FileNotFoundError:\r
+ print("NASM not found")\r
+ except:\r
+ pass\r
+\r
+ if ret != 0:\r
+ print(f"something went wrong while executing {commandLine[-1]}")\r
+ sys.exit()\r
+ print('\tASM\t' + output)\r
+\r
+ commandLine = (\r
+ 'python',\r
+ 'Tools/FixupForRawSection.py',\r
+ output,\r
+ )\r
+ print('\tFIXUP\t' + output)\r
+ ret = RunCommand(commandLine)\r
+ if ret != 0: sys.exit(ret)\r