diff --git a/README.md b/README.md index 2f5e189..81cfebf 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ In summary, the Arm Enterprise ACS product contains the following:
    These tests are split between UEFI and Linux (supported by corresponding kernel driver) applications that together determine whether an architectural implementation is compliant with the enterprise specifications. These tests are further described in detail. ## Release details - - Code Quality: REL v2.2 + - Code Quality: REL v2.3 - The SBSA tests are written for version 5.0 of the SBSA specification. - The SBBR tests are written for version 1.1 of the SBBR specification. - The compliance suite is not a substitute for design verification. @@ -64,6 +64,12 @@ This image comprises of two FAT file system partitions recognized by UEFI:
    Contains bootable applications and test suites. (Approximate size: 60 MB) +The PXE boot package containing the netbootable image grub-efi-bootaa64.efi can be found in: +<work_dir>/arm-enterprise-acs/luv/build/tmp/deploy/images/qemuarm64/PXEBOOT.tar.gz
    +This package may be used in PXE Booting and automatic execution of tests.
    +For more details please check this document : [pxeboot-instructions](https://github.com/ARM-software/arm-enterprise-acs/blob/master/docs/pxeboot-instructions.md).
    + + For more information, see [Yocto Project](https://www.yoctoproject.org/documentation) and [LuvOS](https://github.com/01org/luv-yocto).
    ## Test Suite Execution diff --git a/docs/build-options.md b/docs/build-options.md index 538f1a0..7b0de5c 100644 --- a/docs/build-options.md +++ b/docs/build-options.md @@ -30,7 +30,7 @@ will sync all modules Usage: ```sh -/path/to/armacs/luvos/scripts/build.sh [sbbr|sbsa|sdei|luv-live-image] [cleanall] +/path/to/armacs/luvos/scripts/build.sh [sbbr|sbsa|sdei|luv-live-image|luv-netboot-image] [cleanall] ``` /path/to/armacs/luvos/scripts/build.sh can accept upto 2 optional parameters @@ -48,6 +48,8 @@ will clean all modules $ ./luvos/scripts/build.sh
    will build all modules (no clean is done) +$ ./luvos/scripts/build.sh luv-netboot-image
    +will build netboot image ### Typical Usage Scenarios Prerequisite : The complete build is done atleast once. diff --git a/docs/pxeboot-instructions.md b/docs/pxeboot-instructions.md new file mode 100644 index 0000000..bd82ee9 --- /dev/null +++ b/docs/pxeboot-instructions.md @@ -0,0 +1,36 @@ +# Instructions for running tests using PXE Boot + +Note: Before following the steps below, please read: +https://github.com/intel/luv-yocto/wiki/Send--LUV-test-results-to-an-HTTP-server + + +1. Following a successful build, the PXE Boot Package is generated at
    + /arm-enterprise-acs/luv/build/tmp/deploy/images/qemuarm64/PXEBOOT.tar.gz + +2. ftp PXEBOOT.tar.gz to the your tftp-server root directory
    + +3. In your tftp-server root directory, unzip and untar PXEBOOT.tar.gz
    + + gunzip -cf PXEBOOT.tar.gz | tar xvf - + + This will generate the following file structure
    + - grub-efi-bootaa64.efi + - modify_luv_params_efi.py + - EFI/BOOT/sbsa/ShellSbsa.efi + +4. Run command
    + + ./modify_luv_params_efi.py -f grub-efi-bootaa64.efi -n ,64001 -u http:///cgi-bin/upload.php -p \ + +Note: \ is same as tftp server IP
    + +4. In your DHCP configuration, set
    + dhcp-boot=grub-efi-bootaa64.efi + +5. Invoke PXE Boot
    + + +Note:
    +-The results of SBSA Tests are be dispalyed on the console
    +-The results of linux tests will be uploaded to http://\
    +-Currently, SCT tests are not supported in PXE boot
    diff --git a/luvos/patches/luvos_netboot.patch b/luvos/patches/luvos_netboot.patch new file mode 100644 index 0000000..9576c11 --- /dev/null +++ b/luvos/patches/luvos_netboot.patch @@ -0,0 +1,41 @@ +diff --git a/meta-luv/classes/luv-efi.bbclass b/meta-luv/classes/luv-efi.bbclass +index 6e72d4813f..e5b83b2199 100644 +--- a/meta-luv/classes/luv-efi.bbclass ++++ b/meta-luv/classes/luv-efi.bbclass +@@ -310,7 +310,11 @@ python build_efi_cfg() { + + if re.search("aarch64", target): + cfgfile.write('menuentry \'sbbr/sbsa\' {\n') +- cfgfile.write('chainloader /EFI/BOOT/Shell.efi\n') ++ cfgfile.write('set oldroot=$root\n') ++ cfgfile.write('set root=(tftp,${PXE_IMAGE_SERVER})\n') ++ cfgfile.write('chainloader EFI/BOOT/sbsa/ShellSbsa.efi\n') ++ cfgfile.write('set root=$oldroot\n') ++ cfgfile.write('boot\n') + cfgfile.write('}\n') + + cfgfile.close() +@@ -357,6 +361,10 @@ python build_luv_cfg() { + comment = 'Add test suites if needed, to run reboot tests in LUV' + name = 'LUVCFG_reboot_tests' + luvcfg.write(insert_var(name, comment, d)) ++ ++ comment = 'The IP Address of the Server where the image of PXE boot is stored' ++ name = 'PXE_image_server' ++ luvcfg.write(insert_var(name, comment, d)) + + luvcfg.write('\n#####################################################\n') + luvcfg.write('## User should not modify any parameter below this ##\n') +diff --git a/meta-luv/recipes-core/images/luv-image.inc b/meta-luv/recipes-core/images/luv-image.inc +index 62b55d1d26..93bdd50bbe 100644 +--- a/meta-luv/recipes-core/images/luv-image.inc ++++ b/meta-luv/recipes-core/images/luv-image.inc +@@ -36,6 +36,8 @@ LUVCFG_tests_append_x86-64 = "bits,chipsec,ndctl'" + LUVCFG_tests_append_aarch64 = "'" + LUVCFG_reboot_tests = "LUV_REBOOT_TESTS=none" + LUVCFG_bits_can_run = "LUV_BITS_CAN_RUN='true'" ++PXE_image_server = "PXE_IMAGE_SERVER=none" ++ + + # Path to splash screen image + FILESEXTRAPATHS_append := "${THISDIR}/luv-live-image:" diff --git a/luvos/scripts/build.sh b/luvos/scripts/build.sh index 73482ea..98fa951 100755 --- a/luvos/scripts/build.sh +++ b/luvos/scripts/build.sh @@ -15,18 +15,25 @@ TOPDIR=`pwd` -ALLOWED_FIRST_PARAM="sbbr sbsa sdei luv-live-image cleanall" +#This parameter can be set to 0 if luv-netboot image is not needed in full build +NEED_NETBOOT_IMAGE=1 + +ALLOWED_FIRST_PARAM="sbbr sbsa sdei luv-live-image luv-netboot-image cleanall" ALLOWED_SECOND_PARAM="cleanall" NUMOFARGS=0; MODULE="" CLEANALLONLY=0 OUTPUT_FILE="$PWD/luv/build/tmp/deploy/images/qemuarm64/luv-live-image-gpt.img" +PATH_NETBOOT="$PWD/luv/build/tmp/deploy/images/qemuarm64" +NETBOOT_OUTPUT_FILE="$PWD/luv/build/tmp/deploy/images/qemuarm64/grub-efi-bootaa64.efi" +SHELLSBSA_FILE="$PWD/luv/build/tmp/deploy/images/qemuarm64/ShellSbsa.efi" +LOCAL_CONF_FILE="$TOPDIR/luv/build/conf/local.conf" display_usage() { echo - echo "Usage: $0 [sbbr|sbsa|sdei|luv-live-image] [cleanall]" + echo "Usage: $0 [sbbr|sbsa|sdei|luv-live-image|luv-netboot-image] [cleanall]" echo } @@ -56,6 +63,65 @@ validate_param() fi } +build_shell_sbsa() +{ + $TOPDIR/sbsa/scripts/buildshellsbsa.sh $TOPDIR + +} + + +build_netboot_image() +{ + if [ ! -f $LOCAL_CONF_FILE ]; then + echo "$LOCAL_CONF_FILE is not found. Cannot build luv-netboot-image" + return; + fi + + cp $LOCAL_CONF_FILE ${LOCAL_CONF_FILE}.luv-live-image + #Change local.conf + sed -i 's/^[ \t]*DISTRO.*=.*\".*\"/DISTRO = "luv-netboot"/g' ${LOCAL_CONF_FILE} + + #Apply netboot patch + echo "Applying luv_netboot patch" + cd $TOPDIR/luv + git apply $TOPDIR/luvos/patches/luvos_netboot.patch + bitbake luv-netboot-image + + #Revert to previous state + cp ${LOCAL_CONF_FILE}.luv-live-image $LOCAL_CONF_FILE + cp $LOCAL_CONF_FILE ${LOCAL_CONF_FILE}.luv-netboot-image + + #revoke the netboot patch + echo "Revoking the netboot patch" + cd $TOPDIR/luv + git apply -R $TOPDIR/luvos/patches/luvos_netboot.patch + + echo "Building netboot image is completed. The image can be found at $NETBOOT_OUTPUT_FILE" + + echo "Creating PXE boot Package" + if [ ! -f $SHELLSBSA_FILE ]; then + echo "$SHELLSBSA_FILE is not found. Cannot create PXE Boot Package " + return 1; + fi + + cd $PATH_NETBOOT + mkdir -p EFI/BOOT/sbsa + cp $SHELLSBSA_FILE $PATH_NETBOOT/EFI/BOOT/sbsa + cp $TOPDIR/luvos/scripts/modify_luv_params_efi.py $PATH_NETBOOT + + tar cvf PXEBOOT.tar grub-efi-bootaa64.efi modify_luv_params_efi.py EFI + gzip -f PXEBOOT.tar + + if [ ! -f $PATH_NETBOOT/PXEBOOT.tar.gz ]; then + echo "Creating PXE Boot Package Failed!" + return 1; + fi + + echo "PXE Boot Package is created at $PATH_NETBOOT/PXEBOOT.tar.gz" + cd $TOPDIR/luv + return 0 +} + if [ $# -gt 2 ]; then display_usage; exit; @@ -70,6 +136,7 @@ fi cd $TOPDIR/luv source oe-init-build-env + if [ $CLEANALLONLY -eq 1 ]; then echo echo -e "Are you sure to clean all modules? [Y/N]" @@ -81,6 +148,7 @@ if [ $CLEANALLONLY -eq 1 ]; then bitbake -c cleanall sbsa bitbake -c cleanall sdei bitbake -c cleanall luv-live-image + bitbake -c cleanall luv-netboot-image exit 0; else exit 0; @@ -106,8 +174,18 @@ if [ $NUMOFARGS -gt 0 ]; then then echo echo "Executing with one parameter $0 $MODULE"; + + if [ "${MODULE}" == "luv-netboot-image" ]; then + build_shell_sbsa + build_netboot_image + exit 0 + fi + bitbake $MODULE - bitbake luv-live-image + if [ "${MODULE}" != "luv-live-image" ] + then + bitbake luv-live-image + fi else exit 0 fi @@ -122,6 +200,11 @@ else bitbake sbsa bitbake sdei bitbake luv-live-image + if [ $? -eq 0 ] && [ $NEED_NETBOOT_IMAGE -eq 1 ]; then + build_shell_sbsa + build_netboot_image + fi + fi unset BB_ENV_EXTRAWHITE @@ -130,6 +213,7 @@ if [ -f $OUTPUT_FILE ]; then echo "Built image can be found at $OUTPUT_FILE" else echo "Build failed..." + exit 1; fi -exit +exit 0 diff --git a/luvos/scripts/modify_luv_params_efi.py b/luvos/scripts/modify_luv_params_efi.py new file mode 100755 index 0000000..c8bd848 --- /dev/null +++ b/luvos/scripts/modify_luv_params_efi.py @@ -0,0 +1,158 @@ +#!/usr/bin/python +# +# Copyright 2016 Intel Corporation; author Gayatri Kammela +# +# This script changes the parameters such as luv_netconsole and luv_storage +# for network debugging(netconsole) and sending the results to the +# webserver respectively, when booting LUV via netboot(luv-netboot-image.efi). +# To know the usage of this file do $ ./modify_luv_netboot_efi.py --help +# +################################################################# + +#This file is modified for the Arm Enterprise ACS project. + +import string +import argparse +import re +import os + +start_string = "## Start of luv.cfg ##\n\n" +end_string = "\n## END of luv.cfg ##" +# List of parameters which cannot be modified by user # +do_not_modify = ["LUV_BITS_CAN_RUN"] + +parser = argparse.ArgumentParser() + +class LUVConfigParam(object): + """ create objects to all optional, destination and help arguments """ + def __init__(self, short_option, long_option, dest_varname, num_args, choices, help_text): + self.short_option = short_option + self.long_option = long_option + self.dest_varname = dest_varname + self.num_args = num_args + self.choices = choices + self.help_text = help_text + +""" +list of arguments for each and every parameter in luv.cfg file. If new parameter +is added to luv.cfg, making changes only in the luv_config_params should be sufficient. + +Note: 'filename' is special as it is the only mandatory parameter +""" +luv_config_params = [LUVConfigParam("-f", "--filename", 'filename', None, None, + 'Read from the file'), + LUVConfigParam("-n", "--netconsole", 'luv_netconsole', None, None, + 'The format of the netconsole 10.11.12.13,64001'), + LUVConfigParam("-p", "--pxe", 'pxe_image_server', None, None, + 'The format of the pxe 10.11.12.14'), + LUVConfigParam("-u", "--url", 'luv_storage_url', None, None, + 'The format of url http://ipaddress/path/to/folder'), + LUVConfigParam("-d", "--disable_tests", 'luv_tests', '*', + ['bits', 'chipsec', 'fwts', 'ndctl', 'efivarfs-test', 'pstore-tests', 'kernel-efi-warnings'], + "exclude specific test suites while running LUV"), + LUVConfigParam("-r", "--reboot-tests", 'luv_reboot_tests', '*', + ['luv.pstore-tests'], "Reboot tests to run in LUV")] + +def read_luv_cfg(): + """ Read the luv.cfg file from .EFI binary and store in a list/array""" + f = open(args_lists['filename'], "rb") + s = str(f.read()) + try: + """ get the offset of the start and end lines of luv.cfg """ + start_index = s.index(start_string) + end_index = s.index(end_string) + except ValueError: + print ("Oops! something went wrong, please use a fresh binary file") + parser.exit() + + p = end_index - start_index + f.close() + f = open(args_lists['filename'], "rb") + f.seek(start_index, 0) + luv_cfg = f.read(p) + luv_cfg_lines = luv_cfg.split('\n') + + return luv_cfg_lines, end_index, start_index + +def replace_strings(): + new_rep_str = start_string + for i in luv_cfg_lines: + if re.search('^set', i): + """ + keywords is a collection of all the 'key' parameters that user intends to + change using this script + example: consider a parameter 'set Name=LUV\n', the keyword here is + 'set Name'. Such keywords are extracted from parameters using split(). + + split the line at "=" just once (1) and then retrieve the first + element [0] as in get the string just before the "=" as the keyword and + the second element[1] as in the string after the "=" as the keyval + """ + keyword= i.split('=', 1)[0] + keyval = i.split('=', 1)[1] + for a in args_lists: + if keyword[4:] == a.upper(): + if (str(args_lists[a]).lower() != 'none'): + if keyword[4:] == "LUV_TESTS": + luv_tests = keyval + for d, p in enumerate(args.luv_tests): + if p not in luv_tests: + print ("Test suite " + p + " is already disabled\n") + luv_tests = luv_tests.replace(args.luv_tests[d], '') + replace_str = keyword + "=" + luv_tests + "\n" + else: + replace_str = keyword + "=" + str(args_lists[a]).lower() + "\n" + else: + replace_str = keyword + "=" + keyval.lower() + "\n" + new_rep_str = new_rep_str + replace_str + if keyword[4:] in do_not_modify: + new_rep_str = new_rep_str + i + "\n" + + return new_rep_str + +def write_to_luv_cfg(start_index, end_index): + f = open(args_lists['filename'], "rb") + s = str(f.read()) + new_rep_str = replace_strings() + + """ check if the length of the both lines is greater than the file size """ + if len(new_rep_str) > end_index - start_index: + parser.error("Sorry can't replace the variables as they are too large!") + print (".EFI binary can not be modified! Please checkout the " + "documentation in meta-luv/README and provide valid parameters!") + else: + """ + if not, pad the file with x number of white spaces that are equal to the + difference of both lines and the length of the file itself. + """ + spaces = end_index - len(new_rep_str) - start_index + x = ' ' + """ + Padding the file with white spaces is required as we are modifying a + .EFI binary file. Failing to do so will result in unreadable binary. + """ + white_spaces = x*spaces + s = s[:start_index] + new_rep_str + white_spaces + s[end_index:] + f.close() + f = open(args_lists['filename'], "wb") + f.write(s) + f.close() + +""" Parse the arguments to the parser to populate all the options """ +for obj in luv_config_params: + parser.add_argument(obj.short_option, obj.long_option, + dest=obj.dest_varname, nargs=obj.num_args, + choices=obj.choices, help=obj.help_text) + +args = parser.parse_args() +""" convert the namespace args in to a dictionary """ +args_lists = vars(args) + +""" Check if the filename is given as argument """ +if not (args_lists['filename']): + parser.error(" Please provide filename as an argument") +""" Check if the file exists and then run the script """ +if os.path.exists(args_lists['filename']): + luv_cfg_lines, end_index, start_index = read_luv_cfg() + write_to_luv_cfg(start_index, end_index) + diff --git a/sbsa/patches/ShellSbsa.patch b/sbsa/patches/ShellSbsa.patch new file mode 100644 index 0000000..f60bf4b --- /dev/null +++ b/sbsa/patches/ShellSbsa.patch @@ -0,0 +1,221 @@ +diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c +index 577e17311b..ec63cb729c 100644 +--- a/ShellPkg/Application/Shell/Shell.c ++++ b/ShellPkg/Application/Shell/Shell.c +@@ -315,6 +315,41 @@ InternalEfiShellStartCtrlSMonitor( + } + + ++EFI_STATUS ++RunInternalCommand( ++ IN CONST CHAR16 *CmdLine, ++ IN CHAR16 *FirstParameter, ++ IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol, ++ OUT EFI_STATUS *CommandStatus ++); ++ ++ ++INTN ++EFIAPI ++ShellAppMain ( ++ IN UINTN Argc, ++ IN CHAR16 **Argv ++ ); ++ ++ ++SHELL_STATUS ++EFIAPI ++ShellCommandRunSbsa ( ++ IN EFI_HANDLE ImageHandle, ++ IN EFI_SYSTEM_TABLE *SystemTable ++ ) ++{ ++ ++ ShellAppMain ( ++ 1, ++ NULL ++ ); ++ ++ return 0; ++ ++} ++ ++ + + /** + The entry point for the application. +@@ -603,28 +638,10 @@ UefiMain ( + // + // begin the UI waiting loop + // +- do { +- // +- // clean out all the memory allocated for CONST * return values +- // between each shell prompt presentation +- // +- if (!IsListEmpty(&ShellInfoObject.BufferToFreeList.Link)){ +- FreeBufferList(&ShellInfoObject.BufferToFreeList); +- } +- +- // +- // Reset page break back to default. +- // +- ShellInfoObject.PageBreakEnabled = PcdGetBool(PcdShellPageBreakDefault); +- ASSERT (ShellInfoObject.ConsoleInfo != NULL); +- ShellInfoObject.ConsoleInfo->Enabled = TRUE; +- ShellInfoObject.ConsoleInfo->RowCounter = 0; +- +- // +- // Display Prompt +- // +- Status = DoShellPrompt(); +- } while (!ShellCommandGetExit()); ++ CHAR16 FirstParameter[] = L"sbsa"; ++ SHELL_STATUS CommandReturnedStatus; ++ BOOLEAN LastError; ++ ShellCommandRunCommandHandler(FirstParameter, &CommandReturnedStatus, &LastError); + } + if (OldConIn != NULL && ConInHandle != NULL) { + CloseSimpleTextInOnFile (gST->ConIn); +diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c +index 448f7234dd..df1ca2d98d 100644 +--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c ++++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c +@@ -16,6 +16,13 @@ + + CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands"; + EFI_HANDLE gShellLevel3HiiHandle = NULL; ++INTN ++EFIAPI ++ShellAppMain ( ++ IN UINTN Argc, ++ IN CHAR16 **Argv ++ ); ++ + + /** + return the filename to get help from is not using HII. +@@ -75,7 +82,7 @@ ShellLevel3CommandsLibConstructor ( + ShellCommandRegisterCommandName(L"pause", ShellCommandRunPause , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_PAUSE)); + ShellCommandRegisterCommandName(L"getmtc", ShellCommandRunGetMtc , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_GETMTC)); + ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP)); +- ++ ShellCommandRegisterCommandName(L"sbsa", ShellCommandRunSbsa , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TOUCH)); + ShellCommandRegisterAlias(L"type", L"cat"); + + return (EFI_SUCCESS); +diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h +index be88dd5f28..4ff5dafc66 100644 +--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h ++++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h +@@ -157,5 +157,13 @@ ShellCommandRunHelp ( + IN EFI_SYSTEM_TABLE *SystemTable + ); + ++SHELL_STATUS ++EFIAPI ++ShellCommandRunSbsa ( ++ IN EFI_HANDLE ImageHandle, ++ IN EFI_SYSTEM_TABLE *SystemTable ++ ); ++ ++ + #endif + +diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf +index a13cd9babf..8a0fed6382 100644 +--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf ++++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf +@@ -30,6 +30,7 @@ + Type.c + Touch.c + Ver.c ++ SbsaAvsMain.c + UefiShellLevel3CommandsLib.uni + UefiShellLevel3CommandsLib.c + UefiShellLevel3CommandsLib.h +@@ -39,6 +40,75 @@ + Pause.c + GetMtc.c + Help.c ++ test_pool/secure/test_s001.c ++ test_pool/secure/test_s002.c ++ test_pool/secure/test_s003.c ++ test_pool/pe/test_c001.c ++ test_pool/pe/test_c002.c ++ test_pool/pe/test_c003.c ++ test_pool/pe/test_c004.c ++ test_pool/pe/test_c005.c ++ test_pool/pe/test_c006.c ++ test_pool/pe/test_c007.c ++ test_pool/pe/test_c008.c ++ test_pool/pe/test_c009.c ++ test_pool/pe/test_c010.c ++ test_pool/pe/test_c011.c ++ test_pool/pe/test_c012.c ++ test_pool/pe/test_c013.c ++ test_pool/pe/test_c014.c ++ test_pool/pe/test_c015.c ++ test_pool/pe/test_c016.c ++ test_pool/pe/test_c017.c ++ test_pool/pe/test_c018.c ++ test_pool/pe/test_c019.c ++ test_pool/pe/test_c020.c ++ test_pool/pe/test_c021.c ++ test_pool/pe/test_c022.c ++ test_pool/pe/test_c023.c ++ test_pool/pe/test_c024.c ++ test_pool/pe/test_c025.c ++ test_pool/pe/test_c026.c ++ test_pool/pe/test_c027.c ++ test_pool/pe/test_c028.c ++ test_pool/gic/test_g001.c ++ test_pool/gic/test_g002.c ++ test_pool/gic/test_g003.c ++ test_pool/gic/test_g004.c ++ test_pool/timer_wd/test_t001.c ++ test_pool/timer_wd/test_t002.c ++ test_pool/timer_wd/test_t003.c ++ test_pool/timer_wd/test_t004.c ++ test_pool/timer_wd/test_t005.c ++ test_pool/timer_wd/test_t006.c ++ test_pool/timer_wd/test_t007.c ++ test_pool/timer_wd/test_t008.c ++ test_pool/timer_wd/test_w001.c ++ test_pool/timer_wd/test_w002.c ++ test_pool/pcie/test_p001.c ++ test_pool/pcie/test_p002.c ++ test_pool/pcie/test_p003.c ++ test_pool/io_virt/test_i001.c ++ test_pool/io_virt/test_i002.c ++ test_pool/io_virt/test_i003.c ++ test_pool/io_virt/test_i004.c ++ test_pool/io_virt/test_i005.c ++ test_pool/io_virt/test_i006.c ++ test_pool/power_wakeup/test_u001.c ++ test_pool/power_wakeup/test_u002.c ++ test_pool/peripherals/test_d001.c ++ test_pool/peripherals/test_d002.c ++ test_pool/peripherals/test_d003.c ++ test_pool/peripherals/test_m001.c ++ test_pool/peripherals/test_m002.c ++ test_pool/exerciser/test_e001.c ++ test_pool/exerciser/test_e002.c ++ test_pool/exerciser/test_e003.c ++ test_pool/exerciser/test_e004.c ++ test_pool/exerciser/test_e005.c ++ test_pool/exerciser/test_e006.c ++ test_pool/exerciser/test_e007.c ++ + + + [Packages] +@@ -60,6 +130,8 @@ + HiiLib + FileHandleLib + HandleParsingLib ++ SbsaValLib ++ SbsaPalLib + + [Guids] + gEfiFileInfoGuid ## UNDEFINED diff --git a/sbsa/scripts/buildshellsbsa.sh b/sbsa/scripts/buildshellsbsa.sh new file mode 100755 index 0000000..840f266 --- /dev/null +++ b/sbsa/scripts/buildshellsbsa.sh @@ -0,0 +1,108 @@ +#!/bin/bash +# Copyright (c) 2019, ARM Limited or its affiliates. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +TOPDIR=$1 +NETBOOT_OUTPUT_FILE_PATH="$TOPDIR/luv/build/tmp/deploy/images/qemuarm64" + +WORKDIR=`bitbake -e sbsa | grep ^WORKDIR= | awk -F'=' '{print $2}' | sed 's/\"//g'` +echo "WORKDIR is $WORKDIR" +if [ -z $WORKDIR ]; then + echo "Error: WORKDIR could not be set. Cannot proceed!" + exit 1; +fi + +echo "TOPDIR is $TOPDIR" + + +toolsdir=`ls -d ${WORKDIR}/gcc*aarch64*` + +if [ -z $toolsdir ]; then + echo "Error: There is no tools directory in ${WORKDIR}. Cannot proceed!" + exit 1; +fi + +TOOLSPATH=$toolsdir; + +echo "TOOLS PATH is $TOOLSPATH" + + +#Backup the existing Shell.efi +#This may not be needed +#mv -f ${WORKDIR}/edk2/Build/Shell/DEBUG_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/Shell.efi ${WORKDIR}/edk2/Build/Shell/DEBUG_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/BackupShell.efi + + +####ApplyPatch to change the following files +#${WORKDIR}/edk2/ShellPkg/Application/Shell/Shell.c +#${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c +#${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h +#${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf + +cd ${WORKDIR}/edk2 +echo "Apply Shell Sbsa Patch" +git apply $TOPDIR/sbsa/patches/ShellSbsa.patch + + + +##Direct copy +rm -f ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/SbsaAvsMain.c +cp ${WORKDIR}/git/uefi_app/SbsaAvsMain.c ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/ + +rm -f ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/SbsaAvs.h +cp ${WORKDIR}/git/uefi_app/SbsaAvs.h ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/ + +rm -f ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/SbsaAvs.inf +cp ${WORKDIR}/git/uefi_app/SbsaAvs.inf ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/ + + + +rm -rf ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/test_pool +cp -r ${WORKDIR}/git/test_pool ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/ + +rm -rf ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/val +cp -r ${WORKDIR}/git/val ${WORKDIR}/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/ + +cd ${WORKDIR}/edk2/ + +set -- +source edksetup.sh +export GCC49_AARCH64_PREFIX=${TOOLSPATH}/bin/aarch64-linux-gnu- +echo "GCC49_AARCH64_PREFIX = $GCC49_AARCH64_PREFIX" + +cd ${WORKDIR}/edk2/ + +#Actual Build +build -a AARCH64 -t GCC49 -p ShellPkg/ShellPkg.dsc -m ShellPkg/Application/Shell/Shell.inf + + +mv ${WORKDIR}/edk2/Build/Shell/DEBUG_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/Shell.efi ${WORKDIR}/edk2/Build/Shell/DEBUG_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/ShellSbsa.efi + +####RevokePatch +cd ${WORKDIR}/edk2 +echo "Revoke Shell Sbsa Patch" +git apply -R $TOPDIR/sbsa/patches/ShellSbsa.patch + + +if [ -f ${WORKDIR}/edk2/Build/Shell/DEBUG_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/ShellSbsa.efi ]; then + echo "ShellSbsa Build Success" +else + echo "ShellSbsa Build Failed. Please check compilation logs for details" + exit 1; +fi + +echo "Copying ShellSbsa.efi to $NETBOOT_OUTPUT_FILE_PATH" +chmod +x ${WORKDIR}/edk2/Build/Shell/DEBUG_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/ShellSbsa.efi +cp ${WORKDIR}/edk2/Build/Shell/DEBUG_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/ShellSbsa.efi $NETBOOT_OUTPUT_FILE_PATH + +exit 0;