Partager via


Oal.exe (Compact 7)

3/12/2014

The oal.exe file is the entry point into the kernel and uses the OEMGLOBAL structure to define functions and variables that the kernel needs. The oemmain.lib library implements the function OEMInitGlobals to populate this structure and to register the similar kernel structure, NKGLOBAL.

The oal.exe file links to the following libraries:

  • nkldr.lib (home of KernelStart function)
  • nkstub.lib
  • oemmain.lib (if KITL is separately linked)
  • oemmain_statickitl.lib (if KITL is statically linked)

To remove KITL from the OAL

  1. Remove any KITL stubs from the src\oal\oalexe folder.

  2. Move any KITL-related files from the src\oal\oallib folder to the src\kitl folder.

  3. Remove KITL-related file names and libraries from the src\oal\oallib\sources file.

  4. Remove the following IOCTLs from your OAL IOCTL table (oal_ioctl_tab.h):

    • IOCTL_VBRIDGE_ADD_MAC
    • IOCTL_VBRIDGE_CURRENT_PACKET_FILTER
    • IOCTL_VBRIDGE_GET_ETHERNET_MAC
    • IOCTL_VBRIDGE_GET_RX_PACKET
    • IOCTL_VBRIDGE_GET_RX_PACKET_COMPLETE
    • IOCTL_VBRIDGE_GET_TX_PACKET
    • IOCTL_VBRIDGE_GET_TX_PACKET_COMPLETE
    • IOCTL_VBRIDGE_SHARED_ETHERNET
    • IOCTL_VBRIDGE_WILD_CARD
    • IOCTL_VBRIDGE_WILD_CARD_RESET_BUFFER
    • IOCTL_VBRIDGE_WILD_CARD_VB_INITIALIZED

    These IOCTLs are now handled by kitl.dll (the KITLIoctl function).

To create and build oal.exe

  1. Start by building oal.lib by running build -c in oal\oallib.

  2. Modify the Sources file in the oal\oalexe folder.

    To do this, complete the following tasks:

    1. Change TARGETNAME from kern to oal.

    2. Remove any KITL stub source file references.

    3. Add the following TARGETLIBS:

      $(_SYSGENOAKROOT)\lib\$(_CPUDEPPATH)\NkLdr.lib
      $(_SYSGENOAKROOT)\lib\$(_CPUDEPPATH)\OEMMain.lib
      
    4. Replace nk.lib with nkstub.lib.

    5. Remove TARGETLIB entries for anything besides nkstub with NK in the name.

    6. If you are dynamically linking the KITL with the library, add $(_SYSGENOAKROOT)\lib\$(_CPUDEPPATH)\oemmain.lib \.

    7. If you are statically linking the KITL with the library, add $(_SYSGENOAKROOT)\lib\$(_CPUDEPPATH)\oemmain_statickitl.lib.

  3. Replace the call to OalKitlStart in OEMInit with the following function call:

    KITLIoctl(IOCTL_KITL_STARTUP, NULL, 0, NULL, 0, NULL);
    
  4. Replace all calls to EdbgOutputDebugString with KITLOutputDebugString.

  5. Rename SC_GetTickCount to OEMGetTickCount.

  6. In src\oal\oalexe, run build -c and note the errors. Fix the errors using the information in the following procedure "To resolve linking errors".

  7. Run the build command again and verify that oal.exe builds without any errors.

When you first build your BSP, you will inevitably encounter linking errors not covered by this guide.

To resolve linking errors

  • When you encounter a library linking error, search for the library in public\common\oak or platform\common\src.

  • If you run into unresolved functions, search the same locations for their implementations and include the missing libraries. If there is a function that you cannot find, look for an equivalent function in the NKGLOBAL and OEMGLOBAL structures.

  • If you have unresolved external symbols, you may need to copy the declarations from the existing location. For example, you may need to declare some global variables in both your OAL and KITL code.

See Also

Concepts

Separate the Kernel from OAL and KITL