A better template, with some build scripts, for ArmEbPkg. New libraries are just stubs and need to get filled in. Also debugger scripts are just copies of the BeagleBoard scripts and need to be ported. Compiles with all build 3 build scripts. Cygwin RVCT via build.sh, DOS RVCT via b.bat, and DOS box CodeSourcery GCC via ba.bat.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10493 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
andrewfish 2010-05-17 18:28:48 +00:00
parent f0c855b263
commit b76848cbeb
26 changed files with 1946 additions and 37 deletions

View File

@ -27,37 +27,57 @@
SUPPORTED_ARCHITECTURES = ARM
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
#
# Add .fdf file after we get a critical mass of drivers ported over
# FLASH_DEFINITION = ArmEbPkg/ArmEbPkg.fdf
DEFINE TARGET_HACK = DEBUG
FLASH_DEFINITION = ArmEbPkg/ArmEbPkg.fdf
[LibraryClasses.common]
!if $(BUILD_TARGETS) == RELEASE
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
!else
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
# UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
!endif
ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf
EfiResetSystemLib|ArmEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
EblCmdLib|BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
#
# Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
# in the debugger will show load and unload commands for symbols. You can cut and paste this
# into the command window to load symbols. We should be able to use a script to do this, but
# the version of RVD I have does not support scipts accessing system memory.
#
# PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
# PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
DefaultExceptioHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
@ -73,13 +93,12 @@
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
# UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
SerialPortLib|ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
#
# Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
@ -90,6 +109,15 @@
# PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
SerialPortLib|ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
TimerLib|ArmEbPkg/Library/TimerLib/TimerLib.inf
SerialPortLib|ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
GdbSerialLib|ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.inf
[LibraryClasses.common.SEC]
@ -100,12 +128,58 @@
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
# 1/123 faster than Stm or Vstm version
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
[LibraryClasses.common.DXE_CORE]
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
# PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
[LibraryClasses.common.DXE_DRIVER]
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
[LibraryClasses.common.UEFI_APPLICATION]
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
[LibraryClasses.common.UEFI_DRIVER]
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
# PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
[LibraryClasses.ARM]
#
# It is not possible to prevent the ARM compiler for generic intrinsic functions.
# This library provides the instrinsic functions generate by a given compiler.
# [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
#
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@ -113,10 +187,11 @@
XCODE:*_*_ARM_ARCHCC_FLAGS == -arch armv7 -march=armv7
XCODE:*_*_ARM_ARCHASM_FLAGS == -arch armv7
XCODE:*_*_ARM_ARCHDLINK_FLAGS == -arch armv7
XCODE:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
RVCT:*_*_ARM_ARCHCC_FLAGS == --cpu 7-A
RVCT:*_*_ARM_ARCHASM_FLAGS == --cpu 7-A
RVCT:*_*_ARM_ARCHCC_FLAGS == --cpu Cortex-A8 --thumb
RVCT:*_*_ARM_ARCHASM_FLAGS == --cpu Cortex-A8
RVCT:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
################################################################################
#
@ -124,8 +199,43 @@
#
################################################################################
[PcdsFeatureFlag.common]
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE
gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE
#
# Control what commands are supported from the UI
# Turn these on and off to add features or save size
#
gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE
gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE
gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE
gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE
gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE
gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE
gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE
gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
gArmTokenSpaceGuid.PcdCpuDxeProduceDebugSupport|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
[PcdsFixedAtBuild.common]
gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmEb %a"
gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize|32
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|0
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
# DEBUG_ASSERT_ENABLED 0x01
# DEBUG_PRINT_ENABLED 0x02
@ -151,16 +261,40 @@
# DEBUG_LOADFILE 0x00020000 // UNDI Driver
# DEBUG_EVENT 0x00080000 // Event messages
# DEBUG_ERROR 0x80000000 // Error
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000004
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|""
gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
gEmbeddedTokenSpaceGuid.PcdPrePiTempMemorySize|0
gEmbeddedTokenSpaceGuid.PcdPrePiBfvBaseAddress|0
gEmbeddedTokenSpaceGuid.PcdPrePiBfvSize|0
gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|0
gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize|0
#
# Optional feature to help prevent EFI memory map fragments
# Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
# Values are in EFI Pages (4K). DXE Core will make sure that
# at least this much of each type of memory can be allocated
# from a single memory range. This way you only end up with
# maximum of two fragements for each type in the memory map
# (the memory used, and the free memory that was prereserved
# but not used).
#
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|40
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|3000
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|10
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|0x80001000
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0x87FE0000 # stack at top of memory
gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|0x20000 # 128K stack
@ -169,6 +303,14 @@
gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0x80000000
gArmTokenSpaceGuid.PcdCpuResetAddress|0x80008000
gEmbeddedTokenSpaceGuid.PcdTimerPeriod|100000
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|13000000
#
# ARM Pcds
#
gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000040000000
################################################################################
@ -177,19 +319,65 @@
#
################################################################################
[Components.common]
ArmEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
# Omap35xxPkg/Library/BeagleBoardTimerLib/BeagleBoardTimerLib.inf
# Omap35xxPkg/Library/OmapLib/OmapLib.inf
# Omap35xxPkg/Flash/Flash.inf
# Omap35xxPkg/MMCHSDxe/MMCHS.inf
# Omap35xxPkg/SmbusDxe/Smbus.inf
# Omap35xxPkg/Gpio/Gpio.inf
#
# SEC
#
ArmEbPkg/Sec/Sec.inf
#
# DXE
#
MdeModulePkg/Core/Dxe/DxeMain.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
# NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
NULL|EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf
}
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
ArmEbPkg/InterruptDxe/InterruptDxe.inf
# Omap35xxPkg/TimerDxe/TimerDxe.inf
# Omap35xxPkg/TPS65950Dxe/TPS65950.inf
#
# Semi-hosting filesystem
#
ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
#
# FAT filesystem + GPT/MBR partitioning
#
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
FatPkg/EnhancedFatDxe/Fat.inf
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
#
# Application
#
EmbeddedPkg/Ebl/Ebl.inf
#
# Bds
#
ArmEbPkg/Bds/Bds.inf
#
# Example Application
#
MdeModulePkg/Application/HelloWorld/HelloWorld.inf

251
ArmEbPkg/ArmEbPkg.fdf Executable file
View File

@ -0,0 +1,251 @@
# FLASH layout file for ARM EB.
#
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
################################################################################
#
# FD Section
# The [FD] Section is made up of the definition statements and a
# description of what goes into the Flash Device Image. Each FD section
# defines one flash "device" image. A flash device image may be one of
# the following: Removable media bootable image (like a boot floppy
# image,) an Option ROM image (that would be "flashed" into an add-in
# card,) a System "Flash" image (that would be burned into a system's
# flash) or an Update ("Capsule") image that will be used to update and
# existing system flash.
#
################################################################################
[FD.ArmEb_EFI]
####BaseAddress = 0x80208000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress #The base address of the FLASH Device.
BaseAddress = 0x80008000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress #The base address of the FLASH Device.
Size = 0x00080000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize #The size in bytes of the FLASH Device
ErasePolarity = 1
BlockSize = 0x40
NumBlocks = 0x2000
################################################################################
#
# Following are lists of FD Region layout which correspond to the locations of different
# images within the flash device.
#
# Regions must be defined in ascending order and may not overlap.
#
# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
# the pipe "|" character, followed by the size of the region, also in hex with the leading
# "0x" characters. Like:
# Offset|Size
# PcdOffsetCName|PcdSizeCName
# RegionType <FV, DATA, or FILE>
#
################################################################################
# 512 bytes of configuration header & 8 bytes of image header
0x00000000|0x00000208
0x00000208|0x0007FDF8
gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize
FV = FVMAIN_COMPACT
################################################################################
#
# FV Section
#
# [FV] section is used to define what components or modules are placed within a flash
# device file. This section also defines order the components and modules are positioned
# within the image. The [FV] section consists of define statements, set statements and
# module statements.
#
################################################################################
[FV.FvMain]
BlockSize = 0x40
NumBlocks = 0 # This FV gets compressed so make it just big enough
FvAlignment = 8 # FV alignment and FV attributes setting.
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
STICKY_WRITE = TRUE
LOCK_CAP = TRUE
LOCK_STATUS = TRUE
WRITE_DISABLED_CAP = TRUE
WRITE_ENABLED_CAP = TRUE
WRITE_STATUS = TRUE
WRITE_LOCK_CAP = TRUE
WRITE_LOCK_STATUS = TRUE
READ_DISABLED_CAP = TRUE
READ_ENABLED_CAP = TRUE
READ_STATUS = TRUE
READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Core/Dxe/DxeMain.inf
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
#
INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
#
# Semi-hosting filesystem
#
INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
#
# FAT filesystem + GPT/MBR partitioning
#
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
INF FatPkg/EnhancedFatDxe/Fat.inf
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
#
# UEFI application (Shell Embedded Boot Loader)
#
INF EmbeddedPkg/Ebl/Ebl.inf
#
# Bds
#
INF ArmEbPkg/Bds/Bds.inf
[FV.FVMAIN_COMPACT]
FvAlignment = 8
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
STICKY_WRITE = TRUE
LOCK_CAP = TRUE
LOCK_STATUS = TRUE
WRITE_DISABLED_CAP = TRUE
WRITE_ENABLED_CAP = TRUE
WRITE_STATUS = TRUE
WRITE_LOCK_CAP = TRUE
WRITE_LOCK_STATUS = TRUE
READ_DISABLED_CAP = TRUE
READ_ENABLED_CAP = TRUE
READ_STATUS = TRUE
READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
INF ArmEbPkg/Sec/Sec.inf
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
SECTION FV_IMAGE = FVMAIN
}
}
################################################################################
#
# Rules are use with the [FV] section's module INF type to define
# how an FFS file is created for a given INF file. The following Rule are the default
# rules for the different module type. User can add the customized rules to define the
# content of the FFS file.
#
################################################################################
############################################################################
# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
############################################################################
#
#[Rule.Common.DXE_DRIVER]
# FILE DRIVER = $(NAMED_GUID) {
# DXE_DEPEX DXE_DEPEX Optional |.depex
# COMPRESS PI_STD {
# GUIDED {
# PE32 PE32 |.efi
# UI STRING="$(MODULE_NAME)" Optional
# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
# }
# }
# }
#
############################################################################
[Rule.Common.SEC]
FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
TE TE Align = 8 |.efi
}
[Rule.Common.PEI_CORE]
FILE PEI_CORE = $(NAMED_GUID) {
TE TE |.efi
UI STRING ="$(MODULE_NAME)" Optional
}
[Rule.Common.PEIM]
FILE PEIM = $(NAMED_GUID) {
PEI_DEPEX PEI_DEPEX Optional |.depex
PE32 PE32 |.efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.PEIM.TIANOCOMPRESSED]
FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
PEI_DEPEX PEI_DEPEX Optional |.depex
GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
PE32 PE32 |.efi
UI STRING="$(MODULE_NAME)" Optional
}
}
[Rule.Common.DXE_CORE]
FILE DXE_CORE = $(NAMED_GUID) {
PE32 PE32 |.efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.UEFI_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional |.depex
PE32 PE32 |.efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.DXE_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional |.depex
PE32 PE32 |.efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.DXE_RUNTIME_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional |.depex
PE32 PE32 |.efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.UEFI_APPLICATION]
FILE APPLICATION = $(NAMED_GUID) {
UI STRING ="$(MODULE_NAME)" Optional
PE32 PE32 |.efi
}

71
ArmEbPkg/Bds/Bds.inf Executable file
View File

@ -0,0 +1,71 @@
#/** @file
#
# Component discription file for Bds module
#
# Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = ArmEbBds
FILE_GUID = B404835D-EB9F-41c6-BE0C-C815B4FE3437
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = BdsInitialize
[Sources.common]
BdsEntry.c
FirmwareVolume.c
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
DevicePathLib
BaseLib
HobLib
UefiRuntimeServicesTableLib
ReportStatusCodeLib
PerformanceLib
DxeServicesTableLib
MemoryAllocationLib
UefiLib
UefiBootServicesTableLib
BaseMemoryLib
DebugLib
PrintLib
UefiDriverEntryPoint
[Guids]
[Protocols]
gEfiBdsArchProtocolGuid
gEfiSimpleTextInProtocolGuid
gEfiSimpleTextOutProtocolGuid
gEfiSerialIoProtocolGuid
gEfiDevicePathProtocolGuid
gEfiSimpleFileSystemProtocolGuid
gEfiUsbIoProtocolGuid
gEfiFirmwareVolume2ProtocolGuid
[FeaturePcd]
[FixedPcd]
gEmbeddedTokenSpaceGuid.PcdPrePiStackSize
[Depex]
TRUE

246
ArmEbPkg/Bds/BdsEntry.c Executable file
View File

@ -0,0 +1,246 @@
/** @file
The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements
of the UEFI specification as it is designed to implement an embedded systmes
propriatary boot scheme.
This template assume a DXE driver produces a SerialIo protocol not using the EFI
driver module and it will attempt to connect a console on top of this.
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BdsEntry.h"
BOOLEAN gConsolePresent = FALSE;
EFI_HANDLE mBdsImageHandle = NULL;
EFI_BDS_ARCH_PROTOCOL gBdsProtocol = {
BdsEntry,
};
/**
This function uses policy data from the platform to determine what operating
system or system utility should be loaded and invoked. This function call
also optionally make the use of user input to determine the operating system
or system utility to be loaded and invoked. When the DXE Core has dispatched
all the drivers on the dispatch queue, this function is called. This
function will attempt to connect the boot devices required to load and invoke
the selected operating system or system utility. During this process,
additional firmware volumes may be discovered that may contain addition DXE
drivers that can be dispatched by the DXE Core. If a boot device cannot be
fully connected, this function calls the DXE Service Dispatch() to allow the
DXE drivers from any newly discovered firmware volumes to be dispatched.
Then the boot device connection can be attempted again. If the same boot
device connection operation fails twice in a row, then that boot device has
failed, and should be skipped. This function should never return.
@param This The EFI_BDS_ARCH_PROTOCOL instance.
@return None.
**/
VOID
EFIAPI
BdsEntry (
IN EFI_BDS_ARCH_PROTOCOL *This
)
{
EFI_STATUS Status;
UINTN NoHandles;
EFI_HANDLE *Buffer;
EFI_HANDLE FvHandle;
EFI_HANDLE ImageHandle;
EFI_HANDLE UsbDeviceHandle;
EFI_GUID NameGuid;
UINTN Size;
UINTN HandleCount;
UINTN OldHandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Index;
EFI_DEVICE_PATH_PROTOCOL *LoadImageDevicePath;
EFI_DEVICE_PATH_PROTOCOL *FileSystemDevicePath;
PERF_END (NULL, "DXE", NULL, 0);
PERF_START (NULL, "BDS", NULL, 0);
//
// Now do the EFI stuff
//
Size = 0x100;
gST->FirmwareVendor = AllocateRuntimePool (Size);
ASSERT (gST->FirmwareVendor != NULL);
UnicodeSPrint (gST->FirmwareVendor, Size, L"BeagleBoard EFI %a %a", __DATE__, __TIME__);
//
// Now we need to setup the EFI System Table with information about the console devices.
// This code is normally in the console spliter driver on platforms that support multiple
// consoles at the same time
//
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextOutProtocolGuid, NULL, &NoHandles, &Buffer);
if (!EFI_ERROR (Status)) {
// Use the first SimpleTextOut we find and update the EFI System Table
gST->ConsoleOutHandle = Buffer[0];
gST->StandardErrorHandle = Buffer[0];
Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextOutProtocolGuid, (VOID **)&gST->ConOut);
ASSERT_EFI_ERROR (Status);
gST->StdErr = gST->ConOut;
gST->ConOut->OutputString (gST->ConOut, L"BDS: Console Started!!!!\n\r");
FreePool (Buffer);
gConsolePresent = TRUE;
}
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextInProtocolGuid, NULL, &NoHandles, &Buffer);
if (!EFI_ERROR (Status)) {
// Use the first SimpleTextIn we find and update the EFI System Table
gST->ConsoleInHandle = Buffer[0];
Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextInProtocolGuid, (VOID **)&gST->ConIn);
ASSERT_EFI_ERROR (Status);
FreePool (Buffer);
}
//
// We now have EFI Consoles up and running. Print () will work now. DEBUG () and ASSERT () worked
// prior to this point as they were configured to use a more primative output scheme.
//
//
//Perform Connect
//
HandleCount = 0;
while (1) {
OldHandleCount = HandleCount;
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
break;
}
if (HandleCount == OldHandleCount) {
break;
}
for (Index = 0; Index < HandleCount; Index++) {
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
}
EfiSignalEventReadyToBoot ();
//Locate handles for SimpleFileSystem protocol
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleFileSystemProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < HandleCount; Index++) {
//Get the device path
FileSystemDevicePath = DevicePathFromHandle(HandleBuffer[Index]);
if (FileSystemDevicePath == NULL) {
continue;
}
//Check if UsbIo is on any handles in the device path.
Status = gBS->LocateDevicePath(&gEfiUsbIoProtocolGuid, &FileSystemDevicePath, &UsbDeviceHandle);
if (EFI_ERROR(Status)) {
continue;
}
//Check if Usb stick has a magic EBL file.
LoadImageDevicePath = FileDevicePath(HandleBuffer[Index], L"Ebl.efi");
Status = gBS->LoadImage (TRUE, gImageHandle, LoadImageDevicePath, NULL, 0, &ImageHandle);
if (EFI_ERROR(Status)) {
continue;
}
//Boot to Shell on USB stick.
Status = gBS->StartImage (ImageHandle, NULL, NULL);
if (EFI_ERROR(Status)) {
continue;
}
}
}
//
// Normal UEFI behavior is to process Globally Defined Variables as defined in Chapter 3
// (Boot Manager) of the UEFI specification. For this embedded system we don't do this.
//
//
// Search all the FVs for an application with a UI Section of Ebl. A .FDF file can be used
// to control the names of UI sections in an FV.
//
Status = FindApplicationMatchingUiSection (L"Ebl", &FvHandle, &NameGuid);
if (!EFI_ERROR (Status)) {
//Boot to Shell.
Status = LoadPeCoffSectionFromFv (FvHandle, &NameGuid);
if (EFI_ERROR(Status)) {
DEBUG((EFI_D_ERROR, "Boot from Shell failed. Status: %r\n", Status));
}
}
//
// EFI does not define the behaviour if all boot attemps fail and the last one returns.
// So we make a policy choice to reset the system since this BDS does not have a UI.
//
gRT->ResetSystem (EfiResetShutdown, Status, 0, NULL);
return ;
}
EFI_STATUS
EFIAPI
BdsInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
mBdsImageHandle = ImageHandle;
//
// Install protocol interface
//
Status = gBS->InstallMultipleProtocolInterfaces (
&mBdsImageHandle,
&gEfiBdsArchProtocolGuid, &gBdsProtocol,
NULL
);
ASSERT_EFI_ERROR (Status);
return Status;
}

66
ArmEbPkg/Bds/BdsEntry.h Executable file
View File

@ -0,0 +1,66 @@
/** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __BDS_ENTRY_H__
#define __BDS_ENTRY_H__
#include <PiDxe.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PrintLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/HobLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PcdLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/PerformanceLib.h>
#include <Protocol/Bds.h>
#include <Protocol/SerialIo.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/EmbeddedDevice.h>
#include <Protocol/DevicePath.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/UsbIo.h>
EFI_STATUS
LoadPeCoffSectionFromFv (
IN EFI_HANDLE FvHandle,
IN EFI_GUID *NameGuid
);
EFI_STATUS
FindApplicationMatchingUiSection (
IN CHAR16 *UiString,
OUT EFI_HANDLE *FvHandle,
OUT EFI_GUID *NameGuid
);
VOID
EFIAPI
BdsEntry (
IN EFI_BDS_ARCH_PROTOCOL *This
);
#endif

150
ArmEbPkg/Bds/FirmwareVolume.c Executable file
View File

@ -0,0 +1,150 @@
/** @file
The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements
of the UEFI specification as it is designed to implement an embedded systmes
propriatary boot scheme.
This template assume a DXE driver produces a SerialIo protocol not using the EFI
driver module and it will attempt to connect a console on top of this.
Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BdsEntry.h"
EFI_STATUS
FindApplicationMatchingUiSection (
IN CHAR16 *UiString,
OUT EFI_HANDLE *FvHandle,
OUT EFI_GUID *NameGuid
)
{
EFI_STATUS Status;
EFI_STATUS NextStatus;
UINTN NoHandles;
EFI_HANDLE *Buffer;
UINTN Index;
EFI_FV_FILETYPE FileType;
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
VOID *Key;
EFI_FV_FILE_ATTRIBUTES Attributes;
UINTN Size;
UINTN UiStringLen;
CHAR16 *UiSection;
UINT32 Authentication;
UiStringLen = 0;
if (UiString != NULL) {
DEBUG ((DEBUG_ERROR, "UiString %s\n", UiString));
UiStringLen = StrLen (UiString);
}
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &NoHandles, &Buffer);
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < NoHandles; Index++) {
Status = gBS->HandleProtocol (Buffer[Index], &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);
if (!EFI_ERROR (Status)) {
Key = AllocatePool (Fv->KeySize);
ASSERT (Key != NULL);
ZeroMem (Key, Fv->KeySize);
FileType = EFI_FV_FILETYPE_APPLICATION;
do {
NextStatus = Fv->GetNextFile (Fv, Key, &FileType, NameGuid, &Attributes, &Size);
if (!EFI_ERROR (NextStatus)) {
if (UiString == NULL) {
//
// If UiString is NULL match first application we find.
//
*FvHandle = Buffer[Index];
FreePool (Key);
return Status;
}
UiSection = NULL;
Status = Fv->ReadSection (
Fv,
NameGuid,
EFI_SECTION_USER_INTERFACE,
0,
(VOID **)&UiSection,
&Size,
&Authentication
);
if (!EFI_ERROR (Status)) {
if (StrnCmp (UiString, UiSection, UiStringLen) == 0) {
//
// We found a UiString match.
//
*FvHandle = Buffer[Index];
FreePool (Key);
FreePool (UiSection);
return Status;
}
FreePool (UiSection);
}
}
} while (!EFI_ERROR (NextStatus));
FreePool (Key);
}
}
FreePool (Buffer);
}
return EFI_NOT_FOUND;
}
EFI_DEVICE_PATH *
FvFileDevicePath (
IN EFI_HANDLE FvHandle,
IN EFI_GUID *NameGuid
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH NewNode;
DevicePath = DevicePathFromHandle (FvHandle);
EfiInitializeFwVolDevicepathNode (&NewNode, NameGuid);
return AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&NewNode);
}
EFI_STATUS
LoadPeCoffSectionFromFv (
IN EFI_HANDLE FvHandle,
IN EFI_GUID *NameGuid
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_HANDLE ImageHandle;
DevicePath = FvFileDevicePath (FvHandle, NameGuid);
Status = gBS->LoadImage (TRUE, gImageHandle, DevicePath, NULL, 0, &ImageHandle);
if (!EFI_ERROR (Status)) {
PERF_END (NULL, "BDS", NULL, 0);
Status = gBS->StartImage (ImageHandle, NULL, NULL);
}
return Status;
}

View File

@ -0,0 +1,21 @@
//
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
error = continue
unload
error = abort
setreg @CP15_CONTROL = 0x0005107E
setreg @pc=0x80008208
setreg @cpsr=0x000000D3
dis/D
readfile,raw,nowarn "ZZZZZZ/FV/BEAGLEBOARD_EFI.fd"=0x80008000

View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http:#opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
IN=`/usr/bin/cygpath -u $1`
OUT=`/usr/bin/cygpath -u $2`
/usr/bin/sed -e "s/\/cygdrive\/\(.\)/load\/a\/ni\/np \"\1:/g" \
-e 's:\\:/:g' \
-e "s/^/load\/a\/ni\/np \"/g" \
-e "s/dll /dll\" \&/g" \
$IN | /usr/bin/sort.exe --key=3 --output=$OUT

Binary file not shown.

View File

@ -0,0 +1,67 @@
//
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
error = continue
unload
error = abort
setreg @CP15_CONTROL = 0x0005107E
setreg @cpsr=0x000000D3
; General clock settings.
setmem /32 0x48307270=0x00000080
setmem /32 0x48306D40=0x00000003
setmem /32 0x48005140=0x03020A50
;Clock configuration
setmem /32 0x48004A40=0x0000030A
setmem /32 0x48004C40=0x00000015
;DPLL3 (Core) settings
setmem /32 0x48004D00=0x00370037
setmem /32 0x48004D30=0x00000000
setmem /32 0x48004D40=0x094C0C00
;DPLL4 (Peripheral) settings
setmem /32 0x48004D00=0x00370037
setmem /32 0x48004D30=0x00000000
setmem /32 0x48004D44=0x0001B00C
setmem /32 0x48004D48=0x00000009
;DPLL1 (MPU) settings
setmem /32 0x48004904=0x00000037
setmem /32 0x48004934=0x00000000
setmem /32 0x48004940=0x0011F40C
setmem /32 0x48004944=0x00000001
setmem /32 0x48004948=0x00000000
;RAM setup.
setmem /16 0x6D000010=0x0000
setmem /16 0x6D000040=0x0001
setmem /16 0x6D000044=0x0100
setmem /16 0x6D000048=0x0000
setmem /32 0x6D000060=0x0000000A
setmem /32 0x6D000070=0x00000081
setmem /16 0x6D000040=0x0003
setmem /32 0x6D000080=0x02D04011
setmem /16 0x6D000084=0x0032
setmem /16 0x6D00008C=0x0000
setmem /32 0x6D00009C=0xBA9DC4C6
setmem /32 0x6D0000A0=0x00012522
setmem /32 0x6D0000A4=0x0004E201
setmem /16 0x6D000040=0x0003
setmem /32 0x6D0000B0=0x02D04011
setmem /16 0x6D0000B4=0x0032
setmem /16 0x6D0000BC=0x0000
setmem /32 0x6D0000C4=0xBA9DC4C6
setmem /32 0x6D0000C8=0x00012522
setmem /32 0x6D0000D4=0x0004E201

View File

@ -0,0 +1,23 @@
//
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
include 'ZZZZZZ/rvi_symbols_macros.inc'
macro write_symbols_file("ZZZZZZ/rvi_symbols.tmp", 0x00000000, 0x10000000)
host "bash -o igncr ZZZZZZ/rvi_convert_symbols.sh ZZZZZZ/rvi_symbols.tmp ZZZZZZ/rvi_symbols.inc"
include 'ZZZZZZ/rvi_symbols.inc'
load /NI /NP 'ZZZZZZ/rvi_dummy.axf' ;.constdata
unload rvi_dummy.axf
delfile rvi_dummy.axf

View File

@ -0,0 +1,194 @@
//
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
define /R int compare_guid(guid1, guid2)
unsigned char *guid1;
unsigned char *guid2;
{
return strncmp(guid1, guid2, 16);
}
.
define /R unsigned char * find_system_table(mem_start, mem_size)
unsigned char *mem_start;
unsigned long mem_size;
{
unsigned char *mem_ptr;
mem_ptr = mem_start + mem_size;
do
{
mem_ptr -= 0x400000; // 4 MB
if (strncmp(mem_ptr, "IBI SYST", 8) == 0)
{
return *(unsigned long *)(mem_ptr + 8); // EfiSystemTableBase
}
} while (mem_ptr > mem_start);
return 0;
}
.
define /R unsigned char * find_debug_info_table_header(system_table)
unsigned char *system_table;
{
unsigned long configuration_table_entries;
unsigned char *configuration_table;
unsigned long index;
unsigned char debug_table_guid[16];
// Fill in the debug table's guid
debug_table_guid[ 0] = 0x77;
debug_table_guid[ 1] = 0x2E;
debug_table_guid[ 2] = 0x15;
debug_table_guid[ 3] = 0x49;
debug_table_guid[ 4] = 0xDA;
debug_table_guid[ 5] = 0x1A;
debug_table_guid[ 6] = 0x64;
debug_table_guid[ 7] = 0x47;
debug_table_guid[ 8] = 0xB7;
debug_table_guid[ 9] = 0xA2;
debug_table_guid[10] = 0x7A;
debug_table_guid[11] = 0xFE;
debug_table_guid[12] = 0xFE;
debug_table_guid[13] = 0xD9;
debug_table_guid[14] = 0x5E;
debug_table_guid[15] = 0x8B;
configuration_table_entries = *(unsigned long *)(system_table + 64);
configuration_table = *(unsigned long *)(system_table + 68);
for (index = 0; index < configuration_table_entries; index++)
{
if (compare_guid(configuration_table, debug_table_guid) == 0)
{
return *(unsigned long *)(configuration_table + 16);
}
configuration_table += 20;
}
return 0;
}
.
define /R int valid_pe_header(header)
unsigned char *header;
{
if ((header[0x00] == 'M') &&
(header[0x01] == 'Z') &&
(header[0x80] == 'P') &&
(header[0x81] == 'E'))
{
return 1;
}
return 0;
}
.
define /R unsigned long pe_headersize(header)
unsigned char *header;
{
unsigned long *size;
size = header + 0x00AC;
return *size;
}
.
define /R unsigned char *pe_filename(header)
unsigned char *header;
{
unsigned long *debugOffset;
unsigned char *stringOffset;
if (valid_pe_header(header))
{
debugOffset = header + 0x0128;
stringOffset = header + *debugOffset + 0x002C;
return stringOffset;
}
return 0;
}
.
define /R int char_is_valid(c)
unsigned char c;
{
if (c >= 32 && c < 127)
return 1;
return 0;
}
.
define /R write_symbols_file(filename, mem_start, mem_size)
unsigned char *filename;
unsigned char *mem_start;
unsigned long mem_size;
{
unsigned char *system_table;
unsigned char *debug_info_table_header;
unsigned char *debug_info_table;
unsigned long debug_info_table_size;
unsigned long index;
unsigned char *debug_image_info;
unsigned char *loaded_image_protocol;
unsigned char *image_base;
unsigned char *debug_filename;
unsigned long header_size;
int status;
system_table = find_system_table(mem_start, mem_size);
if (system_table == 0)
{
return;
}
status = fopen(88, filename, "w");
debug_info_table_header = find_debug_info_table_header(system_table);
debug_info_table = *(unsigned long *)(debug_info_table_header + 8);
debug_info_table_size = *(unsigned long *)(debug_info_table_header + 4);
for (index = 0; index < (debug_info_table_size * 4); index += 4)
{
debug_image_info = *(unsigned long *)(debug_info_table + index);
if (debug_image_info == 0)
{
break;
}
loaded_image_protocol = *(unsigned long *)(debug_image_info + 4);
image_base = *(unsigned long *)(loaded_image_protocol + 32);
debug_filename = pe_filename(image_base);
header_size = pe_headersize(image_base);
$fprintf 88, "%s 0x%08x\n", debug_filename, image_base + header_size$;
}
fclose(88);
}
.

View File

@ -0,0 +1,118 @@
//
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
error = continue
unload
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
delfile 1
error = abort

19
ArmEbPkg/Include/ArmEb/ArmEb.h Executable file
View File

@ -0,0 +1,19 @@
/*++
Copyright (c) 2010, Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
--*/
#ifndef __ARM_EB_H__
#define __ARM_EB_H__
#include <ArmEb\ArmEbUart.h>
#endif

View File

View File

@ -0,0 +1,84 @@
/** @file
Basic serial IO abstaction for GDB
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Uefi.h>
#include <Library/GdbSerialLib.h>
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
#include <Library/DebugLib.h>
#include <ArmEb/ArmEb.h>
RETURN_STATUS
EFIAPI
GdbSerialLibConstructor (
VOID
)
{
return RETURN_SUCCESS;
}
RETURN_STATUS
EFIAPI
GdbSerialInit (
IN UINT64 BaudRate,
IN UINT8 Parity,
IN UINT8 DataBits,
IN UINT8 StopBits
)
{
return RETURN_SUCCESS;
}
BOOLEAN
EFIAPI
GdbIsCharAvailable (
VOID
)
{
return FALSE;
}
CHAR8
EFIAPI
GdbGetChar (
VOID
)
{
return (CHAR8)0;
}
VOID
EFIAPI
GdbPutChar (
IN CHAR8 Char
)
{
return;
}
VOID
GdbPutString (
IN CHAR8 *String
)
{
while (*String != '\0') {
GdbPutChar (*String);
String++;
}
}

View File

@ -0,0 +1,37 @@
#/** @file
#
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = GdbSerialLib
FILE_GUID = E8EA1309-2F14-428f-ABE3-7016CE4B4305
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = GdbSerialLib
CONSTRUCTOR = GdbSerialLibConstructor
[Sources.common]
GdbSerialLib.c
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
ArmEbPkg/ArmEbPkg.dec
[LibraryClasses]
DebugLib
IoLib

View File

@ -20,12 +20,10 @@
#include <PiDxe.h>
#include <Library/PcdLib.h>
#include <Library/ArmLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/DebugLib.h>
#include <Library/EfiResetSystemLib.h>
#include <ArmEbUart.h>
#include <ArmEb/ArmEb.h>
/**
Resets the entire platform.

View File

@ -16,7 +16,7 @@
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = ArmEbResetSystemLib
FILE_GUID = DA6BF954-F0FF-4A1A-88D7-16560B9A9D20
FILE_GUID = CEFFA65C-B568-453e-9E11-B81AE683D035
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = EfiResetSystemLib
@ -26,15 +26,9 @@
ResetSystemLib.c
[Packages]
ArmPkg/ArmPkg.dec
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
ArmEbPkg/ArmEbPkg.dec
[Pcd.common]
gArmTokenSpaceGuid.PcdCpuResetAddress
gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress
[LibraryClasses]
DebugLib
BeagleBoardSystemLib

View File

@ -19,7 +19,8 @@
#include <Library/SerialPortLib.h>
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
#include <ArmEbUart.h>
#include <ArmEb/ArmEb.h>
/*

View File

@ -16,7 +16,7 @@
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = ArmEbSerialPortLib
FILE_GUID = 3019EF69-DDE6-4E23-A511-1A8C0279345A
FILE_GUID = C653196A-3BE1-4ec7-850B-DB7E0A16150F
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = SerialPortLib

View File

@ -0,0 +1,97 @@
/** @file
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Base.h>
#include <Library/BaseLib.h>
#include <Library/TimerLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
UINTN
EFIAPI
MicroSecondDelay (
IN UINTN MicroSeconds
)
{
UINT64 NanoSeconds;
NanoSeconds = MultU64x32 (MicroSeconds, 1000);
while (NanoSeconds > (UINTN)-1) {
NanoSecondDelay((UINTN)-1);
NanoSeconds -= (UINTN)-1;
}
NanoSecondDelay (NanoSeconds);
return MicroSeconds;
}
UINTN
EFIAPI
NanoSecondDelay (
IN UINTN NanoSeconds
)
{
UINT32 Delay;
UINT32 StartTime;
UINT32 CurrentTime;
UINT32 ElapsedTime;
Delay = (NanoSeconds / PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds)) + 1;
StartTime = MmioRead32 (0);
do
{
CurrentTime = 0ULL;
ElapsedTime = CurrentTime - StartTime;
} while (ElapsedTime < Delay);
NanoSeconds = ElapsedTime * PcdGet32 (PcdEmbeddedPerformanceCounterPeriodInNanoseconds);
return NanoSeconds;
}
UINT64
EFIAPI
GetPerformanceCounter (
VOID
)
{
return (UINT64)0ULL;
}
UINT64
EFIAPI
GetPerformanceCounterProperties (
OUT UINT64 *StartValue, OPTIONAL
OUT UINT64 *EndValue OPTIONAL
)
{
if (StartValue != NULL) {
// Timer starts with the reload value
*StartValue = (UINT64)0ULL;
}
if (EndValue != NULL) {
// Timer counts up to 0xFFFFFFFF
*EndValue = 0xFFFFFFFF;
}
return PcdGet64(PcdEmbeddedPerformanceCounterFrequencyInHz);
}

View File

@ -0,0 +1,44 @@
#/** @file
# Timer library implementation
#
# A non-functional instance of the Timer Library that can be used as a template
# for the implementation of a functional timer library instance. This library instance can
# also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer
# services as well as EBC modules that require timer services
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = ArmEbTimerLib
FILE_GUID = B2333114-328B-47cc-8E5E-F64E22E4B417
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = TimerLib
[Sources.common]
TimerLib.c
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
ArmEbPkg/ArmEbPkg.dec
[LibraryClasses]
DebugLib
IoLib
BaseLib
[Pcd]
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds

50
ArmEbPkg/b.bat Executable file
View File

@ -0,0 +1,50 @@
@REM Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
@REM This program and the accompanying materials
@REM are licensed and made available under the terms and conditions of the BSD License
@REM which accompanies this distribution. The full text of the license may be found at
@REM http://opensource.org/licenses/bsd-license.php
@REM
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM
@REM Example usage of this script. default is a DEBUG build
@REM b
@REM b clean
@REM b release
@REM b release clean
@REM b -v -y build.log
ECHO OFF
@REM Setup Build environment. Sets WORKSPACE and puts build in path
CALL ..\edksetup.bat
@REM Set for tools chain. Currently RVCT31
SET TARGET_TOOLS=RVCT31
SET TARGET=DEBUG
@if /I "%1"=="RELEASE" (
@REM If 1st argument is release set TARGET to RELEASE and shift arguments to remove it
SET TARGET=RELEASE
shift /1
)
SET BUILD_ROOT=%WORKSPACE%\Build\ArmEb\%TARGET%_%TARGET_TOOLS%
@REM Build the ARM EB firmware and creat an FD (FLASH Device) Image.
CALL build -p ArmEbPkg\ArmEbPkg.dsc -a ARM -t RVCT31 -b %TARGET% %1 %2 %3 %4 %5 %6 %7 %8
@if ERRORLEVEL 1 goto Exit
@if /I "%1"=="CLEAN" goto Clean
ECHO Patching ..\Debugger_scripts ...
SET DEBUGGER_SCRIPT=Debugger_scripts
@for /f %%a IN ('dir /b %DEBUGGER_SCRIPT%\*.inc %DEBUGGER_SCRIPT%\*.cmm') do (
@CALL replace %DEBUGGER_SCRIPT%\%%a %BUILD_ROOT%\%%a ZZZZZZ %BUILD_ROOT% WWWWWW %WORKSPACE%
)
:Exit
EXIT /B
:Clean

49
ArmEbPkg/ba.bat Executable file
View File

@ -0,0 +1,49 @@
@REM Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
@REM This program and the accompanying materials
@REM are licensed and made available under the terms and conditions of the BSD License
@REM which accompanies this distribution. The full text of the license may be found at
@REM http://opensource.org/licenses/bsd-license.php
@REM
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM
@REM Example usage of this script. default is a DEBUG build
@REM b
@REM b clean
@REM b release
@REM b release clean
@REM b -v -y build.log
ECHO OFF
@REM Setup Build environment. Sets WORKSPACE and puts build in path
CALL ..\edksetup.bat
@REM Set for tools chain. Currently ARMGCC
SET TARGET_TOOLS=ARMGCC
SET TARGET=DEBUG
@if /I "%1"=="RELEASE" (
@REM If 1st argument is release set TARGET to RELEASE and shift arguments to remove it
SET TARGET=RELEASE
shift /1
)
SET BUILD_ROOT=%WORKSPACE%\Build\ArmEb\%TARGET%_%TARGET_TOOLS%
@REM Build the Beagle Board firmware and creat an FD (FLASH Device) Image.
CALL build -p ArmEbPkg\ArmEbPkg.dsc -a ARM -t %TARGET_TOOLS% -b %TARGET% %1 %2 %3 %4 %5 %6 %7 %8
@if ERRORLEVEL 1 goto Exit
@if /I "%1"=="CLEAN" goto Clean
ECHO Patching ..\Debugger_scripts ...
SET DEBUGGER_SCRIPT=Debugger_scripts
@for /f %%a IN ('dir /b %DEBUGGER_SCRIPT%\*.inc %DEBUGGER_SCRIPT%\*.cmm') do (
@CALL replace %DEBUGGER_SCRIPT%\%%a %BUILD_ROOT%\%%a ZZZZZZ %BUILD_ROOT% WWWWWW %WORKSPACE%
)
:Exit
EXIT /B
:Clean

118
ArmEbPkg/build.sh Executable file
View File

@ -0,0 +1,118 @@
#!/bin/bash
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
set -e
shopt -s nocasematch
function process_debug_scripts {
if [[ -d $1 ]]; then
for filename in `ls $1`
do
sed -e "s@ZZZZZZ@$BUILD_ROOT@g" -e "s@WWWWWW@$WORKSPACE@g" \
"$1/$filename" \
> "$BUILD_ROOT/$filename"
#For ARMCYGWIN, we have to change /cygdrive/c to c:
if [[ $TARGET_TOOLS == RVCT31CYGWIN ]]
then
mv "$BUILD_ROOT/$filename" "$BUILD_ROOT/$filename"_temp
sed -e "s@/cygdrive/\(.\)@\1:@g" \
"$BUILD_ROOT/$filename"_temp \
> "$BUILD_ROOT/$filename"
rm -f "$BUILD_ROOT/$filename"_temp
fi
done
fi
}
#
# Setup workspace if it is not set
#
if [ -z "$WORKSPACE" ]
then
echo Initializing workspace
cd ..
export EDK_TOOLS_PATH=`pwd`/BaseTools
source edksetup.sh BaseTools
else
echo Building from: $WORKSPACE
fi
#
# Pick a default tool type for a given OS
#
case `uname` in
CYGWIN*)
TARGET_TOOLS=RVCT31CYGWIN
;;
Linux*)
# Not tested
TARGET_TOOLS=ARMGCC
;;
Darwin*)
Major=$(uname -r | cut -f 1 -d '.')
if [[ $Major == 9 ]]
then
# Not supported by this open source project
TARGET_TOOLS=XCODE31
else
TARGET_TOOLS=XCODE32
fi
;;
esac
TARGET=DEBUG
for arg in "$@"
do
if [[ $arg == RELEASE ]];
then
TARGET=RELEASE
fi
done
BUILD_ROOT=$WORKSPACE/Build/ArmEb/"$TARGET"_"$TARGET_TOOLS"
if [[ ! -e $EDK_TOOLS_PATH/Source/C/bin ]];
then
# build the tools if they don't yet exist
echo Building tools: $EDK_TOOLS_PATH
make -C $EDK_TOOLS_PATH
else
echo using prebuilt tools
fi
#
# Build the edk2 ArmEb code
#
if [[ $TARGET == RELEASE ]]; then
build -p $WORKSPACE/ArmEbPkg/ArmEbPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET -D DEBUG_TARGET=RELEASE $2 $3 $4 $5 $6 $7 $8
else
build -p $WORKSPACE/ArmEbPkg/ArmEbPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET $1 $2 $3 $4 $5 $6 $7 $8
fi
for arg in "$@"
do
if [[ $arg == clean ]]; then
# no need to post process if we are doing a clean
exit
elif [[ $arg == cleanall ]]; then
make -C $EDK_TOOLS_PATH clean
exit
fi
done
echo Creating debugger scripts
process_debug_scripts $WORKSPACE/ArmEbPkg/Debugger_scripts