AArch64: Use ARM64 machines for LUV project compilation
by Naresh Bhat
Hi,
The LUV project is successfully compiled on ThunderX Workstation
natively. The native compilation issue is fixed long time ago and I
am really quite surprised to see nothing has been broken for both LIVE
and NETBOOT/PXE images.
Logs of LIVE/NETBOOT compilation on ThunderX2 workstation :
==============================================
ubuntu@ubuntu:/mnt/nvme0n1p3/Projects/LUV/live-image/luv-yocto/build$
bitbake luv-live-image
Loading cache: 100%
|##########################################################################################################################################################################|
Time: 0:00:00
Loaded 2111 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.40.0"
BUILD_SYS = "aarch64-linux"
NATIVELSBSTRING = "ubuntu-18.04"
TARGET_SYS = "aarch64-oe-linux"
MACHINE = "qemuarm64"
DISTRO = "luv"
DISTRO_VERSION = "2.4-dev"
TUNE_FEATURES = "aarch64"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp
meta-luv
meta-oe = "next:48976c54238dda0791e274927371265d259c0e5a"
Initialising tasks: 100%
|#####################################################################################################################################################################|
Time: 0:00:03
Sstate summary: Wanted 0 Found 0 Missed 0 Current 1039 (0% match, 100% complete)
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 3133 tasks of which 3133 didn't need to
be rerun and all succeeded.
ubuntu@ubuntu:/mnt/nvme0n1p3/Projects/LUV/live-image/luv-yocto/build$
ls -l tmp/deploy/images/qemuarm64/
total 666568
-rw-r--r-- 2 ubuntu ubuntu 1366 Jan 28 18:55
core-image-efi-initramfs-qemuarm64-20190128101929.qemuboot.conf
-rw-r--r-- 2 ubuntu ubuntu 85300376 Jan 28 18:55
core-image-efi-initramfs-qemuarm64-20190128101929.rootfs.cpio.gz
-rw-r--r-- 2 ubuntu ubuntu 33088 Jan 28 18:54
core-image-efi-initramfs-qemuarm64-20190128101929.rootfs.manifest
-rw-r--r-- 2 ubuntu ubuntu 167197 Jan 28 18:54
core-image-efi-initramfs-qemuarm64-20190128101929.testdata.json
lrwxrwxrwx 2 ubuntu ubuntu 64 Jan 28 18:55
core-image-efi-initramfs-qemuarm64.cpio.gz ->
core-image-efi-initramfs-qemuarm64-20190128101929.rootfs.cpio.gz
lrwxrwxrwx 2 ubuntu ubuntu 65 Jan 28 18:54
core-image-efi-initramfs-qemuarm64.manifest ->
core-image-efi-initramfs-qemuarm64-20190128101929.rootfs.manifest
lrwxrwxrwx 2 ubuntu ubuntu 63 Jan 28 18:55
core-image-efi-initramfs-qemuarm64.qemuboot.conf ->
core-image-efi-initramfs-qemuarm64-20190128101929.qemuboot.conf
lrwxrwxrwx 2 ubuntu ubuntu 63 Jan 28 18:54
core-image-efi-initramfs-qemuarm64.testdata.json ->
core-image-efi-initramfs-qemuarm64-20190128101929.testdata.json
-rw-r--r-- 2 ubuntu ubuntu 910336 Jan 28 18:43 grub-efi-bootaa64.efi
lrwxrwxrwx 2 ubuntu ubuntu 59 Jan 28 18:40 Image ->
Image--4.19+git0+84df9525b0-r5-qemuarm64-20190128101929.bin
-rw-r--r-- 2 ubuntu ubuntu 24719872 Jan 28 18:40
Image--4.19+git0+84df9525b0-r5-qemuarm64-20190128101929.bin
lrwxrwxrwx 2 ubuntu ubuntu 59 Jan 28 18:40 Image-qemuarm64.bin
-> Image--4.19+git0+84df9525b0-r5-qemuarm64-20190128101929.bin
-rw-r--r-- 2 ubuntu ubuntu 805 Jan 28 18:39 LUV.cer
-rw-r--r-- 2 ubuntu ubuntu 1147 Jan 28 18:39 LUV.crt
-rw------- 2 ubuntu ubuntu 1704 Jan 28 18:39 LUV.key
-rw-r--r-- 1 ubuntu ubuntu 132120576 Jan 28 18:55 luv-live-image-gpt.img
-rw-r--r-- 1 ubuntu ubuntu 132120576 Jan 28 18:55 luv-live-image-mbr.img
-rw-r--r-- 1 ubuntu ubuntu 113229824 Jan 28 18:55
luv-live-image-qemuarm64-20190128101929.hddimg
lrwxrwxrwx 1 ubuntu ubuntu 46 Jan 28 18:55
luv-live-image-qemuarm64.hddimg ->
luv-live-image-qemuarm64-20190128101929.hddimg
lrwxrwxrwx 1 ubuntu ubuntu 43 Jan 28 18:55
luv-live-image-qemuarm64.iso ->
luv-live-image-qemuarm64-20190128101929.iso
-rw-r--r-- 1 ubuntu ubuntu 16777216 Jan 28 18:55 luv-live-image-results.hddimg
-rw-r--r-- 2 ubuntu ubuntu 197603025 Jan 28 18:41
modules--4.19+git0+84df9525b0-r5-qemuarm64-20190128101929.tgz
lrwxrwxrwx 2 ubuntu ubuntu 61 Jan 28 18:41
modules-qemuarm64.tgz ->
modules--4.19+git0+84df9525b0-r5-qemuarm64-20190128101929.tgz
-rwxr-xr-x 2 ubuntu ubuntu 1189408 Jan 28 18:39 MokManager.efi
-rw-r--r-- 2 ubuntu ubuntu 1367784 Jan 28 18:39 shim.efi
ubuntu@ubuntu:/mnt/nvme0n1p3/Projects/LUV/live-image/luv-yocto/build$ lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 224
On-line CPU(s) list: 0-223
Thread(s) per core: 4
Core(s) per socket: 28
Socket(s): 2
NUMA node(s): 2
Vendor ID: Cavium
Model: 1
Model name: ThunderX2 99xx
Stepping: 0x1
BogoMIPS: 400.00
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 32768K
NUMA node0 CPU(s): 0-111
NUMA node1 CPU(s): 112-223
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32
atomics cpuid asimdrdm
ubuntu@ubuntu:/mnt/nvme0n1p3/Projects/LUV/live-image/luv-yocto/build$
ubuntu@ubuntu:/mnt/nvme0n1p3/Projects/LUV/netboot-image/luv-yocto/build$
bitbake luv-netboot-image
Loading cache: 100%
|##########################################################################################################################################################################|
Time: 0:00:00
Loaded 2111 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.40.0"
BUILD_SYS = "aarch64-linux"
NATIVELSBSTRING = "ubuntu-18.04"
TARGET_SYS = "aarch64-oe-linux"
MACHINE = "qemuarm64"
DISTRO = "luv-netboot"
DISTRO_VERSION = "2.4-dev"
TUNE_FEATURES = "aarch64"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp
meta-luv
meta-oe = "next:48976c54238dda0791e274927371265d259c0e5a"
Initialising tasks: 100%
|#####################################################################################################################################################################|
Time: 0:00:03
Sstate summary: Wanted 925 Found 0 Missed 925 Current 107 (0% match,
10% complete)
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 3090 tasks of which 803 didn't need to
be rerun and all succeeded.
ubuntu@ubuntu:/mnt/nvme0n1p3/Projects/LUV/netboot-image/luv-yocto/build$
You can use ThunderX Workstation or any other AArch64 machines for the
LUV project builds.
Thanks and Regards
-Naresh Bhat
3 years, 4 months
[PATCH] meta-luv/utils: Introduce a script that creates bootable USB stick with LUV
by Sai Praneeth Prakhya
Commit 34d5d0cbce11 ("luv-live-image: Support both MBR and GPT type live
images") introduced luv-live-image-gpt.img. When a bootable USB stick is
created by dd'ing luv-live-image-gpt.img the following warning messages are
seen in dmesg
GPT:Primary header thinks Alt. header is not at the end of the disk
GPT:Alternate GPT header not at the end of the disk
Kernel spits these warning messages because luv-live-image recipe creates
GPT headers (Primary and Alternate) on luv-live-image-gpt.img file and not
on the real disk that was flashed with luv-live-image-gpt.img file. To fix
these errors the GPT headers should be created at the beginning and ending
of the real disk. This issue cannot be fixed with the present setup because
prior to creating luv-live-image-gpt.img file there is no way to know the
size of block device that LUV would be flashed onto. Hence, introduce
flash_luv.sh that can be used by a user to create a bootable USB stick with
LUV after he has decided upon the block device.
Please note that only GPT image is affected with this issue and
flash_luv.sh is not needed if booting luv-live-image-mbr.img or
luv-netboot-image.
Cc: Naresh Bhat <naresh.bhat(a)linaro.org>
Cc: Megha Dey <megha.dey(a)linux.intel.com>
Cc: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya(a)intel.com>
---
meta-luv/README | 53 +++++++++++++++
meta-luv/utils/flash_luv.sh | 128 ++++++++++++++++++++++++++++++++++++
2 files changed, 181 insertions(+)
create mode 100755 meta-luv/utils/flash_luv.sh
diff --git a/meta-luv/README b/meta-luv/README
index e6fc155428bf..941e772d0aa6 100644
--- a/meta-luv/README
+++ b/meta-luv/README
@@ -66,6 +66,7 @@ Table of Contents
VII. Other LUV boot parameters
VIII. Submitting results to a remote location
IX. Add parameters to disable/enable the testsuites independently
+ X. Create bootable GPT LUV USB stick
I. Setting LUV build system
@@ -334,3 +335,55 @@ Add a parameter in luv.cfg called "LUV_TESTS" that stores a set of strings,
each string representing the individual testsuites. All the testsuites are
enabled by default and disable a testsuite by removing the string that
represents the testsuite when needed.
+
+X. Create bootable GPT LUV USB stick
+====================================
+
+What is flash_luv.sh?
+---------------------
+flash_luv.sh is a bash script that creates a bootable block device (Eg: USB
+stick) with LUV. It takes 3 arguments as inputs and the third argument is
+optional.
+
+Why do we need flash_luv.sh when we already have luv-live-image-gpt.img?
+------------------------------------------------------------------------
+When a bootable USB stick is created by dd'ing luv-live-image-gpt.img the
+following warning messages are seen in dmesg
+
+ GPT:Primary header thinks Alt. header is not at the end of the disk.
+ GPT:Alternate GPT header not at the end of the disk
+
+These errors happen because luv-live-image recipe creates GPT headers (Primary
+and Alternate) on luv-live-image-gpt.img file and not on the real disk that was
+flashed with luv-live-image-gpt.img file. To fix these errors the GPT headers
+should be created at the beginning and ending of the real disk. This issue
+cannot be fixed with the present setup because prior to creating
+luv-live-image-gpt.img file there is no way to know the size of block device
+that LUV would be flashed into. Hence, have a script do that when the user has
+decided upon the block device.
+
+How to run?
+-----------
+sudo ./flash_luv.sh sdX relative-path-to-luv-boot-image [LUV_results_size]
+
+Please note that only a sudoer could run this script because it flashes LUV onto
+a block device.
+
+Detailed explanation about arguments:
+-------------------------------------
+The first argument is a block device. Typically it's denoted as sdX. "lsblk" can
+be used to find out the name of block device. Please note that it's user's
+responsibility to give the right block device. Giving a wrong block device (eg:
+HDD/SSD that has OS) would overwrite that device with LUV.
+
+The second argument is relative path to *LUV boot image* and not luv-live-image.
+The latter has both boot and results partition packed into a single .img file
+while the former has only boot partition. Typically, after building LUV, the
+boot image can be found at
+build/tmp/deploy/images/qemux86-64/luv-live-image-qemux86-64.hddimg.
+
+The third argument is the size of LUV results partition in MiB. If the requested
+size is invalid (Eg: greater than block device size) or if the argument is not
+given then all the available space i.e. the space left after boot partition is
+allocated to LUV results partition. A valid LUV results partition size is
+between 1MiB and space left after boot partition is allocated.
diff --git a/meta-luv/utils/flash_luv.sh b/meta-luv/utils/flash_luv.sh
new file mode 100755
index 000000000000..f577b22580cc
--- /dev/null
+++ b/meta-luv/utils/flash_luv.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+
+if ! [ $(id -u) = 0 ]
+then
+ echo "You should run this script with root priviliges"
+ exit
+fi
+
+if ! [ -b /dev/${1} ]
+then
+ echo "Please provide a valid sdX entry to use"
+ exit
+fi
+
+if [ -z "${2}" ]
+then
+ echo "LUV boot image cannot be empty"
+ exit
+fi
+
+if ! [ -r ${2} ]
+then
+ echo "Please provide a readable LUV boot image"
+ exit
+fi
+
+BOOT_HDDIMG=$(du -L -h --apparent-size ${2} | cut -f 1 | tr -dc '0-9.')
+BOOT_HDDIMG_CEILED=$(python -c "from math import ceil; print ceil($BOOT_HDDIMG)")
+LUV_BOOT_SIZE=${BOOT_HDDIMG_CEILED%.*}
+
+if [ $LUV_BOOT_SIZE -le 0 ]
+then
+ echo "LUV boot image size should be greater than zero"
+ exit
+fi
+
+#1MiB is left before LUV results partition and 1MiB is left after LUV boot
+#partition because the default size that parted tool uses is MiB and using this
+#will inherently take care of alignment issues, if any arises.
+LUV_RESULTS_START=1
+GAURD_BAND=$(expr 2 \* $LUV_RESULTS_START)
+
+ONE_MIB=$(expr 1024 \* 1024)
+BLOCKDEV_SIZE_IN_BYTES=$(blockdev --getsize64 /dev/${1})
+BLOCKDEV_SIZE_IN_MIB=$(expr $BLOCKDEV_SIZE_IN_BYTES / $ONE_MIB)
+MAX_LUV_RESULTS_SIZE=$(expr $BLOCKDEV_SIZE_IN_MIB - $GAURD_BAND - $LUV_BOOT_SIZE)
+
+LUV_RESULTS_SIZE=$MAX_LUV_RESULTS_SIZE
+if [ -z "${3}" ]
+then
+ echo "LUV Results size not provided, using $MAX_LUV_RESULTS_SIZE MiB"
+elif [ ${3} -ge 1 ] && [ ${3} -le ${MAX_LUV_RESULTS_SIZE} ]
+then
+ LUV_RESULTS_SIZE=${3}
+else
+ echo "LUV Results size invalid, using $MAX_LUV_RESULTS_SIZE MiB"
+fi
+
+#Partitions might not always be in sequence like sda1 and sda2, they could also
+#be numbered as sda1 and sda5. So, instead of looping from 1 to the
+#highest_partition, get the list of all partitions in a device. Use
+#/proc/partitions to get this list and not "ls -al /dev/sdX" because the later
+#might have stale values.
+
+PARTITIONS=$(cat /proc/partitions | grep "${1}." | awk '{print $(NF)}')
+if [ -n "$PARTITIONS" ]
+then
+ for i in $PARTITIONS;
+ do
+ #Partitions should be unmounted before deleting them
+ #Unmount partitions only if they are already mounted
+ MOUNTPOINT=$(lsblk | grep ${i} | awk '{print $(NF)}')
+ if [ -n "$MOUNTPOINT" ]
+ then
+ umount ${MOUNTPOINT}
+ fi
+ PARTITION_NAME="${i}"
+ DEVICE_NAME="${1}"
+ PARTITION_NUM=${PARTITION_NAME#"$DEVICE_NAME"}
+ parted -s /dev/${1} rm ${PARTITION_NUM}
+ done
+fi
+
+#Remove any /dev/sdX stale files (these might get created if flashing doesn't
+#happen as expected)
+NUM_STALE_FILES=$(expr `ls -al /dev/sdb* | wc | awk '{print $1}'` - 1)
+if [ $NUM_STALE_FILES -gt 0 ]
+then
+ STALE_FILES=$(ls -al /dev/${1}[0-9] | awk '{print $(NF)}')
+ for i in $STALE_FILES;
+ do
+ rm -rf $i
+ done
+fi
+
+#Use FAT32 instead of FAT16 as it supports higher file sizes. Other Linux file
+#systems like ext2 and ext3 are not being recognized as "fsX" by EFI shell.
+FAT_SIZE=32
+LUV_RESULTS_UUID=05D61523
+LUV_RESULTS_PARTITION_NUM=1
+LUV_BOOT_PARTITION_NUM=2
+LUV_RESULTS_END=$(expr $LUV_RESULTS_START + $LUV_RESULTS_SIZE)
+LUV_BOOT_END=$(expr $LUV_RESULTS_END + $LUV_BOOT_SIZE)
+
+parted -s --align optimal /dev/${1} mklabel gpt
+
+parted -s --align optimal /dev/${1} mkpart primary "${LUV_RESULTS_START}MiB" \
+"${LUV_RESULTS_END}MiB"
+
+parted -s --align optimal /dev/${1} mkpart primary "${LUV_RESULTS_END}MiB" \
+"${LUV_BOOT_END}MiB"
+
+parted -s /dev/${1} set ${LUV_RESULTS_PARTITION_NUM} boot off
+
+#"sync", so that the partition changes are flushed to device from buffers
+sync
+
+mkdosfs -i ${LUV_RESULTS_UUID} -n "LUV-RESULTS" -F ${FAT_SIZE} \
+/dev/${1}${LUV_RESULTS_PARTITION_NUM}
+
+#No need to name LUV boot partition as the .hddimg already has one
+mkdosfs -F ${FAT_SIZE} /dev/${1}${LUV_BOOT_PARTITION_NUM}
+
+#"sync", so that the file system changes are flushed to device from buffers
+sync
+
+dd if=${2} of=/dev/${1}${LUV_BOOT_PARTITION_NUM}
+sync
--
2.19.1
3 years, 5 months
[PATCH] meta-luv/utils/: Update script to modify LUV parameters
by Megha Dey
The existing modify_luv_netboot_efi.py script only helps the user modify
the netconsole parameters in the luv netboot image. This patch updates
the script to help users modify the other LUV parameters.
Signed-off-by: Megha Dey <megha.dey(a)linux.intel.com>
---
meta-luv/utils/modify_luv_netboot_efi.py | 158 -------------------------------
meta-luv/utils/modify_luv_params_efi.py | 153 ++++++++++++++++++++++++++++++
2 files changed, 153 insertions(+), 158 deletions(-)
delete mode 100755 meta-luv/utils/modify_luv_netboot_efi.py
create mode 100755 meta-luv/utils/modify_luv_params_efi.py
diff --git a/meta-luv/utils/modify_luv_netboot_efi.py b/meta-luv/utils/modify_luv_netboot_efi.py
deleted file mode 100755
index 2f02302..0000000
--- a/meta-luv/utils/modify_luv_netboot_efi.py
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/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
-#
-#################################################################
-
-import string
-import argparse
-import re
-import os
-
-parser = argparse.ArgumentParser()
-start_string = "## Start of luv.cfg ##\n\n"
-end_string = "\n## END of luv.cfg ##"
-
-class LUVConfigParam(object):
- """ create objects to all optional, destination and help arguments """
- def __init__(self,short_option, long_option, dest_varname, help_text):
- self.short_option = short_option
- self.long_option = long_option
- self.dest_varname = dest_varname
- 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 manadatory parameter
-"""
-luv_config_params = [LUVConfigParam("-f", "--file", 'filename',
- 'Read from the file'),
- LUVConfigParam("-n", "--netconsole", 'luv_netconsole',
- 'The format of the netconsole 10.11.12.13,64001'),
- LUVConfigParam("-u", "--url", 'luv_storage_url',
- 'The format of url http://ipaddress/path/to/folder'),
- LUVConfigParam("-v", "--verbose", 'verbose',
- 'press -v for help')]
-
-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')
- """
- keywords is a collection of all the 'key' parameters that user intend 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 "="
- """
- keywords = []
- for i in luv_cfg_lines:
- if re.search('^set', i):
- keyword = i.split('=', 1)[0]
- keywords.append(keyword)
-
- return keywords, end_index, start_index
-
-def replace_strings(keywords):
- """
- define a new string that will replace the concatenation of strings
- after we modify the parameters with given values
- """
- new_rep_str = start_string
- """
- Match for the substrings in luv.cfg with the parameters that are
- being passed to parser.
-
- lower() is used to find the match for case insensitive strings and when
- a substring is found matched it returns the offset which is always greater
- than 0
- """
- for k in keywords:
- for a in args_lists:
- if (k.lower().find(a.lower()) > 0):
- """
- check if the arguments are passed for each parameter in luv.cfg.
- If not then replace that parameter with a string "none"
- """
- if (args_lists[a]) is None:
- replace_str = k + "=" + "none" + "\n"
- print ("No " + a + " parameter found! Please provide one "
- "if you intend to use the feature")
- new_rep_str = new_rep_str + replace_str
- print ("Modifying .EFI binary without setting the " + a +
- " parameter!. If you may want this feature, provide "
- "one and rerun the script")
- else:
- replace_str = k + "=" + str(args_lists[a])+"\n"
- print (k + " to " + str(args_lists[a]))
- new_rep_str = new_rep_str + replace_str
-
- 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(keywords)
- """ 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, 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']):
- keywords, end_index, start_index = read_luv_cfg()
- write_to_luv_cfg(start_index, end_index)
diff --git a/meta-luv/utils/modify_luv_params_efi.py b/meta-luv/utils/modify_luv_params_efi.py
new file mode 100755
index 0000000..e89e808
--- /dev/null
+++ b/meta-luv/utils/modify_luv_params_efi.py
@@ -0,0 +1,153 @@
+#!/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
+#
+#################################################################
+
+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("-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)
--
2.7.4
3 years, 5 months
[PATCH] luv-test: Do not use tty as standard output for x86
by Megha Dey
Commit b12bf16 "luv-test: update standard output for luv" updated
the default standard output of LUV to ttyS0 for x86 and ttyAMA0
for ARM architectures. However, after this change it was observed that
on some x86 systems, systemd fails to use ttyS0 as Standard Output and
the system appears to hang.
By reverting the above commit, we no longer see this issue, but we do
not see test-suite logs for ARM architecture on the serial console.
Hence, selectively revert the above patch for x86 architecture.
This patch resolves the issue:
https://github.com/intel/luv-yocto/issues/130
Signed-off-by: Megha Dey <megha.dey(a)linux.intel.com>
---
meta-luv/recipes-core/luv-test/luv-test.bb | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/meta-luv/recipes-core/luv-test/luv-test.bb b/meta-luv/recipes-core/luv-test/luv-test.bb
index e6263d9..452204e 100644
--- a/meta-luv/recipes-core/luv-test/luv-test.bb
+++ b/meta-luv/recipes-core/luv-test/luv-test.bb
@@ -46,20 +46,6 @@ SRC_URI += "file://luv-test-manager \
RDEPENDS_${PN}+= "kernel-modules curl iputils iproute2 bash init-ifupdown dhcp-client gzip"
-def get_target_arch(d):
- import re
- target = d.getVar('TARGET_ARCH', True)
- if target == "x86_64":
- return '/dev/ttyS0'
- elif re.match('i.86', target):
- return '/dev/ttyS0'
- elif re.match('aarch64', target):
- return '/dev/ttyAMA0'
- else:
- raise bb.parse.SkipPackage("TARGET_ARCH %s not supported!" % target)
-
-tty_console = "${@get_target_arch(d)}"
-
do_install_append() {
install -d ${D}${sbindir}/
install -d ${D}${sysconfdir}/init.d/
@@ -101,15 +87,25 @@ do_install_append() {
install -m 0644 ${WORKDIR}/luv-test-manager.service ${D}${systemd_unitdir}/system
sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/luv-test-manager.service
- sed -i -e 's,LUV_TTY_CONSOLE,${tty_console},g' ${D}${systemd_unitdir}/system/luv-test-manager.service
install -m 0644 ${WORKDIR}/luv-netconsole.service ${D}${systemd_unitdir}/system
sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/luv-netconsole.service
- sed -i -e 's,LUV_TTY_CONSOLE,${tty_console},g' ${D}${systemd_unitdir}/system/luv-netconsole.service
install -m 0644 ${WORKDIR}/luv-crash-handler.service ${D}${systemd_unitdir}/system
sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/luv-crash-handler.service
- sed -i -e 's,LUV_TTY_CONSOLE,${tty_console},g' ${D}${systemd_unitdir}/system/luv-crash-handler.service
+
+ if [ "${TARGET_ARCH}" = "aarch64" ]; then
+ sed -i -e 's,LUV_TTY_CONSOLE,/dev/ttyAMA0,g' ${D}${systemd_unitdir}/system/luv-test-manager.service
+ sed -i -e 's,LUV_TTY_CONSOLE,/dev/ttyAMA0,g' ${D}${systemd_unitdir}/system/luv-netconsole.service
+ sed -i -e 's,LUV_TTY_CONSOLE,/dev/ttyAMA0,g' ${D}${systemd_unitdir}/system/luv-crash-handler.service
+ else
+ sed -i -e '/^StandardOutput/ d' ${D}${systemd_unitdir}/system/luv-test-manager.service
+ sed -i -e '/^StandardOutput/ d' ${D}${systemd_unitdir}/system/luv-netconsole.service
+ sed -i -e '/^StandardOutput/ d' ${D}${systemd_unitdir}/system/luv-crash-handler.service
+ sed -i -e '/^TTYPath/ d' ${D}${systemd_unitdir}/system/luv-test-manager.service
+ sed -i -e '/^TTYPath/ d' ${D}${systemd_unitdir}/system/luv-netconsole.service
+ sed -i -e '/^TTYPath/ d' ${D}${systemd_unitdir}/system/luv-crash-handler.service
+ fi
install -m 0644 ${WORKDIR}/luv-reboot-poweroff.service ${D}${systemd_unitdir}/system
sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/luv-reboot-poweroff.service
--
2.7.4
3 years, 5 months
[PATCH] fwts: Update fwts to v19.01.00
by Naresh Bhat
Update FWTS to version v19.01.00
Signed-off-by: Naresh Bhat <naresh.bhat(a)linaro.org>
---
meta-luv/recipes-core/fwts/fwts_git.bb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta-luv/recipes-core/fwts/fwts_git.bb b/meta-luv/recipes-core/fwts/fwts_git.bb
index a3c105384f..f62b9bf681 100644
--- a/meta-luv/recipes-core/fwts/fwts_git.bb
+++ b/meta-luv/recipes-core/fwts/fwts_git.bb
@@ -4,9 +4,9 @@ HOMEPAGE = "https://wiki.ubuntu.com/Kernel/Reference/fwts"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://src/main.c;beginline=1;endline=16;md5=31da590f3e9f3bd34dcdb9e4db568519"
-PV = "V18.11.00+git${SRCPV}"
+PV = "V19.01.00+git${SRCPV}"
-SRCREV = "be475359aa91728e952117af764bab39b1528c68"
+SRCREV = "987bbba8c2a9d86afe5c557524520920b12d1e8a"
SRC_URI = "git://kernel.ubuntu.com/hwe/fwts.git \
file://luv-parser-fwts \
"
--
2.17.1
3 years, 5 months