Skip to content

Commit

Permalink
Merge pull request #60 from edhay/master
Browse files Browse the repository at this point in the history
Added Support for Building LUV PXE Boot Image
  • Loading branch information
prasanth-pulla committed Sep 13, 2019
2 parents be6af3c + ea9f873 commit 13bb419
Show file tree
Hide file tree
Showing 8 changed files with 662 additions and 6 deletions.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -13,7 +13,7 @@ In summary, the Arm Enterprise ACS product contains the following: <ol>
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.
Expand Down Expand Up @@ -64,6 +64,12 @@ This image comprises of two FAT file system partitions recognized by UEFI: <br /
- 'boot' <br />
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:
&lt;work_dir&gt;/arm-enterprise-acs/luv/build/tmp/deploy/images/qemuarm64/PXEBOOT.tar.gz<br />
This package may be used in PXE Booting and automatic execution of tests.<br />
For more details please check this document : [pxeboot-instructions](https://github.com/ARM-software/arm-enterprise-acs/blob/master/docs/pxeboot-instructions.md). <br />


For more information, see [Yocto Project](https://www.yoctoproject.org/documentation) and [LuvOS](https://github.com/01org/luv-yocto). <br />

## Test Suite Execution
Expand Down
4 changes: 3 additions & 1 deletion docs/build-options.md
Expand Up @@ -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
Expand All @@ -48,6 +48,8 @@ will clean all modules
$ ./luvos/scripts/build.sh<br/>
will build all modules (no clean is done)

$ ./luvos/scripts/build.sh luv-netboot-image<br/>
will build netboot image

### Typical Usage Scenarios
Prerequisite : The complete build is done atleast once.
Expand Down
36 changes: 36 additions & 0 deletions 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<br/>
<work_dir>/arm-enterprise-acs/luv/build/tmp/deploy/images/qemuarm64/PXEBOOT.tar.gz

2. ftp PXEBOOT.tar.gz to the your tftp-server root directory<br/>

3. In your tftp-server root directory, unzip and untar PXEBOOT.tar.gz<br/>

gunzip -cf PXEBOOT.tar.gz | tar xvf -

This will generate the following file structure<br/>
- grub-efi-bootaa64.efi
- modify_luv_params_efi.py
- EFI/BOOT/sbsa/ShellSbsa.efi

4. Run command<br/>

./modify_luv_params_efi.py -f grub-efi-bootaa64.efi -n <Console Log Server IP>,64001 -u http://<Apache Server IP>/cgi-bin/upload.php -p \<PXE Server IP\>

Note: \<PXE Server IP\> is same as tftp server IP<br/>

4. In your DHCP configuration, set <br/>
dhcp-boot=grub-efi-bootaa64.efi

5. Invoke PXE Boot<br/>


Note:<br/>
-The results of SBSA Tests are be dispalyed on the console<br/>
-The results of linux tests will be uploaded to http://\<Apache Server IP\><br/>
-Currently, SCT tests are not supported in PXE boot<br/>
41 changes: 41 additions & 0 deletions 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:"
92 changes: 88 additions & 4 deletions luvos/scripts/build.sh
Expand Up @@ -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
}

Expand Down Expand Up @@ -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;
Expand All @@ -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]"
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 13bb419

Please sign in to comment.