[PATCH v3 1/2] bits_git.bb: Add patch that enables network debug in BITS
by Gayatri Kammela
Include a patch that enables the debugging via network feature using
TCP/IP protocol in the bits recipe.
The testsuites that run after the kernel boots have debug via network
feature(also known as netconsole)already, leaving BITS alone. With this
patch LUV will have fully functional network debugging feature.
The usage of netconsole in BITS is similar to netconsole in luv except,
that BITS does not have UDP support yet.
example(on the remote side): $ netcat -l <port number>
Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
---
Changes since v2:
1)Renamed and modified luv_netconsole_log.py to be more readable
Changes since v1:
1) Included the patch that actually enables the netconsole in bits in one single patch.
2) Updated the README to include the steps to use netconsole in bits.
...y-Enable-logging-debugging-in-bits-via-ne.patch | 125 +++++++++++++++++++++
meta-luv/recipes-bsp/bits/bits_git.bb | 1 +
2 files changed, 126 insertions(+)
create mode 100644 meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch
diff --git a/meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch b/meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch
new file mode 100644
index 000000000000..218814794ede
--- /dev/null
+++ b/meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch
@@ -0,0 +1,125 @@
+From 8338ffd85be0d82231b609b48ee27751a9c8a6da Mon Sep 17 00:00:00 2001
+From: Gayatri Kammela <gayatri.kammela(a)intel.com>
+Date: Wed, 19 Apr 2017 15:21:10 -0700
+Subject: [PATCH] Bits-init.py: Enable logging/debugging in bits via network
+
+BITS has socket module implemented, with which the host machine(where
+the BITS testsuite is running) can now, able to communicate with the
+remote machine via TCP/IP protocol.
+
+Leveraging the feature of communication with the remote machine for our
+debugging purposes can be useful especially, when there is no serial
+cable available.
+
+Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
+---
+ python/init.py | 2 ++
+ python/luv_netconsole_log.py | 83 ++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 85 insertions(+)
+ create mode 100644 python/luv_netconsole_log.py
+
+diff --git a/python/init.py b/python/init.py
+index b2a97b2ed80b..e2a63c5df0cf 100644
+--- a/python/init.py
++++ b/python/init.py
+@@ -28,6 +28,8 @@
+
+ """Python initialization, to run at BITS startup."""
+
++import luv_netconsole_log
++luv_netconsole_log.enable_netconsole()
+ import _bits
+
+ start = _bits._time()
+diff --git a/python/luv_netconsole_log.py b/python/luv_netconsole_log.py
+new file mode 100644
+index 000000000000..4fe42f015e29
+--- /dev/null
++++ b/python/luv_netconsole_log.py
+@@ -0,0 +1,83 @@
++"""
++Copyright(c) 2017 Intel Corporation; author Gayatri Kammela
++
++This module will enable the network logging/debugging via netcat using TCP
++server. To use this feature do $netcat -l <port number> on the remote machine
++
++"""
++
++""" log bits via network."""
++
++import socket
++import re
++import sys
++import redirect
++
++file = "/luv.cfg"
++buffer_stdout = sys.stdout
++""" create a socket to send out the stdout to TCP server """
++sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
++""" timeout 10 seconds """
++sock.settimeout(10)
++print ("Waiting for user to listen to BITS in remote server ..."
++ " 10 seconds remaining .. use netcat -l <port> ")
++
++def get_netconsole_params():
++ """ read the luv.cfg file and retrieve netconsole parameters """
++ f = open(file, "r")
++ s = f.read()
++ f.close()
++ line = s.split('\n')
++
++ for i in line:
++ """ search for the LUV_NETCONSOLE in luv.cfg to retrieve the values """
++ if re.search('LUV_NETCONSOLE=', i):
++ p = i.split('=',1)[1]
++ break
++
++ return p
++
++def check_valid_params(p):
++ """ check if the retrieved parameters are valid """
++ ipaddress = p.split(',',1)[0]
++ """ check if the ip address is valid using inet_aton() """
++ try:
++ socket.inet_aton(ipaddress)
++ except socket.error:
++ print("no valid ipaddress is given, provide a valid one!")
++
++ port_num = p.split(',',1)[1]
++ """ check if the given port is an integer and if it is valid/unreserved """
++ if (len(port_num) >= 4):
++ try:
++ port = int(p.split(',',1)[1])
++ except ValueError:
++ print ("invalid port number!")
++ else:
++ print("Port number should be intergers, not characters!")
++
++ return ipaddress, port
++
++def check_connection(ipaddress, port):
++ """ check if the remote is able to connect to the host using ipaddress """
++ try:
++ check_remote = socket.gethostbyname( ipaddress )
++ """ connect to the remote server using the ipaddress and port given """
++ sock.connect((check_remote, port))
++ sock.send("Starting BITS ...\n")
++ """ create a file at the socket using makefile() and tee the stdout """
++ """ to the file. makefile() accepts arguments just like open() """
++ """ makefile([mode, [bufsize]]) -- return a file object for the"""
++ """ socket [*] - from _socket.py module"""
++ file = sock.makefile('w', 0)
++ sys.stdout = redirect.Tee(buffer_stdout, file)
++ except socket.error:
++ sock.close()
++ print ("Could not connect to the remote machine! "
++ "Please verify the connectivity on both sides")
++
++def enable_netconsole():
++ """ enable the netconsole in bits """
++ p = get_netconsole_params()
++ ipaddress, port = check_valid_params(p)
++ check_connection(ipaddress, port)
+--
+2.7.4
+
diff --git a/meta-luv/recipes-bsp/bits/bits_git.bb b/meta-luv/recipes-bsp/bits/bits_git.bb
index cd4e261c9984..b847567201f9 100644
--- a/meta-luv/recipes-bsp/bits/bits_git.bb
+++ b/meta-luv/recipes-bsp/bits/bits_git.bb
@@ -51,6 +51,7 @@ SRC_URI = "gitsm://github.com/biosbits/bits.git;protocol=http \
file://luv-test-bits \
file://luv-parser-bits \
file://0001-only-output-to-log.patch;apply=no \
+ file://Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch \
"
S = "${WORKDIR}/git"
--
2.7.4
5 years, 1 month
[PATCH v2 2/2] README: Update README for netconsole usage in Bits
by Gayatri Kammela
Usage of netconsole in LUV varies from Bits. Update README
accordingly.
Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
---
meta-luv/README | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/meta-luv/README b/meta-luv/README
index 59a00d63b2e4..27cb25bdb1b8 100644
--- a/meta-luv/README
+++ b/meta-luv/README
@@ -168,6 +168,21 @@ that are being sent:
example:
$ netcat -l -u 64001
+Usage in Bits
+------------
+So far luv-netconsole feature is utilized only to get all the kernel log
+messages and no debug info relevant to BIOS/UEFI could be captured.
+luv-netconsole in LUV supports sending of messages via UDP, whereas Bits only
+supports sending the debug ingfo via TCP socket. Thus, the usage of netconsole
+in Bits varies slightly than in LUV.
+
+on the remote machine, use netcat as usual and since UDP is not supported, get
+rid of '-u' option.
+
+ $ netcat -l <port number> (or) nc -l <port number>
+example:
+ $ netcat -l 64001
+
Steps on how to get IP address and choose port number
-----------------------------------------------------
On your terminal do
--
2.7.4
5 years, 1 month
[PATCH] recipes-core/images: Remove ip command line parameter from the image recipes
by Gayatri Kammela
Remove "ip=dhcp" parameter from the command line as this is no longer
required.
Cc: Ricardo Neri <ricardo.neri(a)intel.com>
Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
---
meta-luv/recipes-core/images/luv-live-image.bb | 2 +-
meta-luv/recipes-core/images/luv-netboot-image.bb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta-luv/recipes-core/images/luv-live-image.bb b/meta-luv/recipes-core/images/luv-live-image.bb
index 540c7475df60..f39b4319857e 100644
--- a/meta-luv/recipes-core/images/luv-live-image.bb
+++ b/meta-luv/recipes-core/images/luv-live-image.bb
@@ -15,7 +15,7 @@ MACHINE_FEATURES += "efi"
CMDLINE_USERSPACE = "systemd.log_target=null plymouth.ignore-serial-consoles"
# Kernel commandline for luv live image boot
-CMDLINE = "${CMDLINE_USERSPACE} debug crashkernel=512M,high ip=dhcp log_buf_len=1M efi=debug"
+CMDLINE = "${CMDLINE_USERSPACE} debug crashkernel=512M,high log_buf_len=1M efi=debug"
COMMON_CMDLINE_x86 = " console=ttyS0,115200 console=ttyPCH0,115200"
diff --git a/meta-luv/recipes-core/images/luv-netboot-image.bb b/meta-luv/recipes-core/images/luv-netboot-image.bb
index a72c79f0a630..84f3883dc82b 100644
--- a/meta-luv/recipes-core/images/luv-netboot-image.bb
+++ b/meta-luv/recipes-core/images/luv-netboot-image.bb
@@ -17,7 +17,7 @@ PCBIOS_append = "0"
CMDLINE_USERSPACE = "systemd.log_target=null plymouth.ignore-serial-consoles"
# Kernel commandline for luv net boot
-CMDLINE = "${CMDLINE_USERSPACE} debug crashkernel=512M,high ip=dhcp log_buf_len=1M efi=debug luv.netboot"
+CMDLINE = "${CMDLINE_USERSPACE} debug crashkernel=512M,high log_buf_len=1M efi=debug luv.netboot"
COMMON_CMDLINE_x86 = " console=ttyS0,115200 console=ttyPCH0,115200"
--
2.7.4
5 years, 1 month
[PATCH] modify_luv_netboot_efi.py: Replace the blank space with string none
by Gayatri Kammela
Modify_luv_netboot_efi.py script modifies the parameters by taking them
as arguments and when such parameters are not passed, the script
just replace them a blank space to make the EFi bootable. Since
LUV_STORAGE_URL has been disabled by default, it makes sense to modify
the parameter as string none rather than a blank space when no argument
is passed.
Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
---
meta-luv/utils/modify_luv_netboot_efi.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta-luv/utils/modify_luv_netboot_efi.py b/meta-luv/utils/modify_luv_netboot_efi.py
index 694285681de9..2f023026ec87 100755
--- a/meta-luv/utils/modify_luv_netboot_efi.py
+++ b/meta-luv/utils/modify_luv_netboot_efi.py
@@ -96,10 +96,10 @@ def replace_strings(keywords):
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 an blank space
+ If not then replace that parameter with a string "none"
"""
if (args_lists[a]) is None:
- replace_str = k + "=" + " " + "\n"
+ 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
--
2.7.4
5 years, 1 month
[PATCH v3] recipes-core/: Disable LUV_STORAGE_URL parameter by default in luv.cfg
by Gayatri Kammela
LUV_STORAGE_URL in luv.cfg has a default value which meant to indicate
the format of the url to be given by user. However, the script that
saves and submit the results takes the default value as a parameter when
user didn't wish to use the feature.
The default value is not valid and thus it makes sense to disable this
parameter by default value "none", leaving the script run only if
user provides the url.
Cc: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
---
Changes since v2:
1) Added additional layer of logic to prevent the script from running when
there is no luv_storage parameter.
Changes since v1:
1)Modified the logic that looks for luv_storage=none instead of generic none.
meta-luv/recipes-core/images/luv-live-image.bb | 2 +-
meta-luv/recipes-core/images/luv-netboot-image.bb | 2 +-
.../recipes-core/luv-test/luv-test/submit_results | 46 ++++++++++++++--------
3 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/meta-luv/recipes-core/images/luv-live-image.bb b/meta-luv/recipes-core/images/luv-live-image.bb
index 50cad08ee9ef..540c7475df60 100644
--- a/meta-luv/recipes-core/images/luv-live-image.bb
+++ b/meta-luv/recipes-core/images/luv-live-image.bb
@@ -31,7 +31,7 @@ CMDLINE_append_x86 = "${COMMON_CMDLINE_x86}"
CMDLINE_append_x86-64 = "${COMMON_CMDLINE_x86}"
LUVCFG_netconsole = "LUV_NETCONSOLE=10.11.12.13,64001"
-LUVCFG_storage_url = "LUV_STORAGE_URL=http://ipaddress/cgi-bin/upload.php"
+LUVCFG_storage_url = "LUV_STORAGE_URL=none"
python() {
import re
diff --git a/meta-luv/recipes-core/images/luv-netboot-image.bb b/meta-luv/recipes-core/images/luv-netboot-image.bb
index 93ac1978dc1e..a72c79f0a630 100644
--- a/meta-luv/recipes-core/images/luv-netboot-image.bb
+++ b/meta-luv/recipes-core/images/luv-netboot-image.bb
@@ -33,7 +33,7 @@ CMDLINE_append_x86 = "${COMMON_CMDLINE_x86}"
CMDLINE_append_x86-64 = "${COMMON_CMDLINE_x86}"
LUVCFG_netconsole = "LUV_NETCONSOLE=10.11.12.13,64001"
-LUVCFG_storage_url = "LUV_STORAGE_URL=http://ipaddress/cgi-bin/upload.php"
+LUVCFG_storage_url = "LUV_STORAGE_URL=none"
HDDDIR = "${S}/hddimg"
diff --git a/meta-luv/recipes-core/luv-test/luv-test/submit_results b/meta-luv/recipes-core/luv-test/luv-test/submit_results
index 8288e5f19f20..19d102ac68ea 100644
--- a/meta-luv/recipes-core/luv-test/luv-test/submit_results
+++ b/meta-luv/recipes-core/luv-test/luv-test/submit_results
@@ -6,35 +6,45 @@
# zip folder and then upload to a given webserver.
#####################################################################
-# Gather results in a compressed tarball
-
plymouth_write() {
/bin/plymouth display-message --text="{1}"
}
-get_tar_luv_results()
+# check if the url is valid
+get_luv_url()
{
+ # check if luv-storage exists in grub.cfg
grep -q luv_storage /proc/cmdline
if [ $? -eq 0 ]; then
- tar -zcf /tmp/luv-results-$tstamp.tar.gz ${LUV_SAVE_RESULTS_DIR}
- luv_tar_results=/tmp/luv-results-$tstamp.tar.gz
+ # check if luv-storage is disabled by default
+ grep -q 'luv_storage=none' /proc/cmdline
+ if [ $? -eq 1 ]; then
+ # retrieve the contents of the variable luv_storage
+ storage_url=$(cat /proc/cmdline | sed -e 's/^.*luv_storage=//' -e 's/ .*$//')
+ valid_exp='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
+ if ! [[ ${storage_url} =~ $valid_exp ]] ; then
+ echo $alert_url_missing
+ plymouth_write "MSG $alert_url_missing"
+ halt
+ else
+ return 0
+ fi
+ else
+ return 1
+ fi
else
return 1
fi
}
-# check if the url is valid
-get_luv_url()
+# Gather results in a compressed tarball
+get_tar_luv_results()
{
- # retrieve the contents of the variable luv_storage
- storage_url=$(cat /proc/cmdline | sed -e 's/^.*luv_storage=//' -e 's/ .*$//')
- valid_exp='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
- if ! [[ ${storage_url} =~ $valid_exp ]] ; then
- echo $alert_url_missing
- plymouth_write "MSG $alert_url_missing"
- halt
+ tar -zcf /tmp/luv-results-$tstamp.tar.gz ${LUV_SAVE_RESULTS_DIR}
+ if [ $? -eq 0 ]; then
+ luv_tar_results=/tmp/luv-results-$tstamp.tar.gz
else
- return 0
+ return 1
fi
}
@@ -44,10 +54,12 @@ alert_url_missing="No valid URL is provided to save the results! Please provide
LUV_SAVE_RESULTS_DIR=$1
tstamp=$(date +"%Y-%m-%d--%H-%M-%S")
-get_tar_luv_results
+get_luv_url
if [ $? -eq 0 ]; then
- get_luv_url
+ get_tar_luv_results
if [ $? -eq 0 ]; then
curl -F "uploadedfile=@${luv_tar_results}" ${storage_url}
fi
+else
+ exit
fi
--
2.7.4
5 years, 1 month
[PATCH V3] luv-test : remove MSG parameter from plymouth_write
by Megha Dey
The plymouth_write function needs one one argument- the message to be
printed. With the earlier psplash_write, we needed the MSG parameter
followed by the message to be displayed. This MSG parameter wasn't removed
while migrating from psplash to plymouth. Also, the plymouth_write function
needs to be updated so that it actually prints the argument, not {1}.
V2->V3
remove the halt after plymouth_write
V1->V2:
plymouth_write function is updated to actually print the argument, not {1}
Signed-off-by: Megha Dey <megha.dey(a)linux.intel.com>
---
meta-luv/recipes-core/luv-test/luv-test/submit_results | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/meta-luv/recipes-core/luv-test/luv-test/submit_results b/meta-luv/recipes-core/luv-test/luv-test/submit_results
index 8288e5f..e3a5d3d 100644
--- a/meta-luv/recipes-core/luv-test/luv-test/submit_results
+++ b/meta-luv/recipes-core/luv-test/luv-test/submit_results
@@ -9,7 +9,7 @@
# Gather results in a compressed tarball
plymouth_write() {
- /bin/plymouth display-message --text="{1}"
+ /bin/plymouth display-message --text="${1}"
}
get_tar_luv_results()
@@ -31,8 +31,7 @@ get_luv_url()
valid_exp='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
if ! [[ ${storage_url} =~ $valid_exp ]] ; then
echo $alert_url_missing
- plymouth_write "MSG $alert_url_missing"
- halt
+ plymouth_write "$alert_url_missing"
else
return 0
fi
--
1.9.1
5 years, 1 month
[PATCH v3 2/2] README: Update README for netconsole usage in Bits
by Gayatri Kammela
Usage of netconsole in LUV varies from Bits. Update README
accordingly.
Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
---
meta-luv/README | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/meta-luv/README b/meta-luv/README
index 59a00d63b2e4..27cb25bdb1b8 100644
--- a/meta-luv/README
+++ b/meta-luv/README
@@ -168,6 +168,21 @@ that are being sent:
example:
$ netcat -l -u 64001
+Usage in Bits
+------------
+So far luv-netconsole feature is utilized only to get all the kernel log
+messages and no debug info relevant to BIOS/UEFI could be captured.
+luv-netconsole in LUV supports sending of messages via UDP, whereas Bits only
+supports sending the debug ingfo via TCP socket. Thus, the usage of netconsole
+in Bits varies slightly than in LUV.
+
+on the remote machine, use netcat as usual and since UDP is not supported, get
+rid of '-u' option.
+
+ $ netcat -l <port number> (or) nc -l <port number>
+example:
+ $ netcat -l 64001
+
Steps on how to get IP address and choose port number
-----------------------------------------------------
On your terminal do
--
2.7.4
5 years, 2 months
[PATCH v2 1/2] bits_git.bb: Add patch that enables network debug in BITS
by Gayatri Kammela
Include a patch that enables the debugging via network feature using
TCP/IP protocol in the bits recipe.
The testsuites that run after the kernel boots have debug via network
feature(also known as netconsole)already, leaving BITS alone. With this
patch LUV will have fully functional network debugging feature.
The usage of netconsole in BITS is similar to netconsole in luv except,
that BITS does not have UDP support yet.
example(on the remote side): $ netcat -l <port number>
Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
---
Changes since v1:
1) Included the patch that actually enables the netconsole in bits in one single patch.
2) Updated the README to include the steps to use netconsole in bits.
...y-Enable-logging-debugging-in-bits-via-ne.patch | 136 +++++++++++++++++++++
meta-luv/recipes-bsp/bits/bits_git.bb | 1 +
2 files changed, 137 insertions(+)
create mode 100644 meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch
diff --git a/meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch b/meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch
new file mode 100644
index 000000000000..d26d3d3ebc7a
--- /dev/null
+++ b/meta-luv/recipes-bsp/bits/bits/Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch
@@ -0,0 +1,136 @@
+From 3533b6351fa306275a034553570d7ab0fdd0d0e0 Mon Sep 17 00:00:00 2001
+From: Gayatri Kammela <gayatri.kammela(a)intel.com>
+Date: Thu, 13 Apr 2017 15:48:30 -0700
+Subject: [PATCH] Bits-init.py: Enable logging/debugging in bits via network
+
+BITS has socket module implemented, with which the host machine(where
+the BITS testsuite is running) can now, able to communicate with the
+remote machine via TCP/IP protocol.
+
+Leveraging the feature of communication with the remote machine for our
+debugging purposes can be useful especially, when there is no serial
+cable available.
+
+Signed-off-by: Gayatri Kammela <gayatri.kammela(a)intel.com>
+---
+ python/init.py | 2 ++
+ python/network_log.py | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 96 insertions(+)
+ create mode 100644 python/network_log.py
+
+diff --git a/python/init.py b/python/init.py
+index b2a97b2ed80b..b48b89f45175 100644
+--- a/python/init.py
++++ b/python/init.py
+@@ -28,6 +28,8 @@
+
+ """Python initialization, to run at BITS startup."""
+
++import network_log
++network_log.enable_netconsole()
+ import _bits
+
+ start = _bits._time()
+diff --git a/python/network_log.py b/python/network_log.py
+new file mode 100644
+index 000000000000..8a697eed5d5f
+--- /dev/null
++++ b/python/network_log.py
+@@ -0,0 +1,94 @@
++## Copyright (c) 2017, Intel Corporation
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are met:
++#
++# * Redistributions of source code must retain the above copyright notice,
++# this list of conditions and the following disclaimer.
++# * Redistributions in binary form must reproduce the above copyright notice,
++# this list of conditions and the following disclaimer in the documentation
++# and/or other materials provided with the distribution.
++# * Neither the name of Intel Corporation nor the names of its contributors
++# may be used to endorse or promote products derived from this software
++# without specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
++# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
++# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
++# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++""" log bits via network."""
++
++import socket
++import re
++import sys
++import redirect
++
++""" create a socket to send out the stdout to TCP server """
++buffer_stdout = sys.stdout
++sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
++""" timeout 10 seconds """
++sock.settimeout(10)
++
++""" read the luv.cfg file and create a list """
++def read_n_parse_luv_cfg():
++ f = open("/luv.cfg", "r")
++ s = f.read()
++ f.close()
++ line = s.split('\n')
++
++ """ search for the LUV_NETCONSOLE in luv.cfg to retrive the values """
++ for i in line:
++ if re.search('LUV_NETCONSOLE=', i):
++ p = i.split('=',1)[1]
++
++ return p
++
++""" check if the ip address is valid using inet_aton() """
++def get_ip_n_port(p):
++ ipaddress = p.split(',',1)[0]
++ try:
++ socket.inet_aton(ipaddress)
++ except socket.error:
++ print("no valid ipaddress is given, provide a valid one!")
++
++ """ check if the given port is an integer and if it is valid/unreserved """
++ port_num = p.split(',',1)[1]
++ if (len(port_num) >= 4):
++ try:
++ port = int(p.split(',',1)[1])
++ except ValueError:
++ print ("invalid port number!")
++
++ return ipaddress, port
++
++""" check if the remote is able to connect to the host using ipaddress """
++def connect_remote(ipaddress, port):
++ try:
++ check_remote = socket.gethostbyname( ipaddress )
++ """ connect to the remote server using the ipaddress and port given """
++ sock.connect((check_remote, port))
++ sock.send("Starting BITS ...\n")
++ """ create a file at the socket using makefile() and tee the stdout """
++ """ to the file. makefile() accepts arguments just like open() """
++ """ makefile([mode, [bufsize]]) -- return a file object for the"""
++ """ socket [*] - from _socket.py module"""
++ file = sock.makefile('w', 0)
++ sys.stdout = redirect.Tee(buffer_stdout, file)
++ except socket.error:
++ sock.close()
++ print ("Could not connect to the remote machine! "
++ "Please verify the connectivity on both sides")
++
++""" enable the netconsole in bits """
++def enable_netconsole():
++ p = read_n_parse_luv_cfg()
++ ipaddress, port = get_ip_n_port(p)
++ connect_remote(ipaddress, port)
+--
+2.7.4
+
diff --git a/meta-luv/recipes-bsp/bits/bits_git.bb b/meta-luv/recipes-bsp/bits/bits_git.bb
index cd4e261c9984..b847567201f9 100644
--- a/meta-luv/recipes-bsp/bits/bits_git.bb
+++ b/meta-luv/recipes-bsp/bits/bits_git.bb
@@ -51,6 +51,7 @@ SRC_URI = "gitsm://github.com/biosbits/bits.git;protocol=http \
file://luv-test-bits \
file://luv-parser-bits \
file://0001-only-output-to-log.patch;apply=no \
+ file://Bits-init.py-Enable-logging-debugging-in-bits-via-ne.patch \
"
S = "${WORKDIR}/git"
--
2.7.4
5 years, 2 months
[Patch V2] luv-test : remove MSG parameter from plymouth_write
by Megha Dey
The plymouth_write function needs one one argument- the message to be
printed. With the earlier psplash_write, we needed the MSG parameter
followed by the message to be displayed. This MSG parameter wasn't removed
while migrating from psplash to plymouth. Also, the plymouth_write function
needs to be updated so that it actually prints the argument, not {1}.
V1->V2:
plymouth_write function is updated to actually print the argument, not {1}
Signed-off-by: Megha Dey <megha.dey(a)linux.intel.com>
---
meta-luv/recipes-core/luv-test/luv-test/submit_results | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta-luv/recipes-core/luv-test/luv-test/submit_results b/meta-luv/recipes-core/luv-test/luv-test/submit_results
index 8288e5f..449829a 100644
--- a/meta-luv/recipes-core/luv-test/luv-test/submit_results
+++ b/meta-luv/recipes-core/luv-test/luv-test/submit_results
@@ -9,7 +9,7 @@
# Gather results in a compressed tarball
plymouth_write() {
- /bin/plymouth display-message --text="{1}"
+ /bin/plymouth display-message --text="${1}"
}
get_tar_luv_results()
@@ -31,7 +31,7 @@ get_luv_url()
valid_exp='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
if ! [[ ${storage_url} =~ $valid_exp ]] ; then
echo $alert_url_missing
- plymouth_write "MSG $alert_url_missing"
+ plymouth_write "$alert_url_missing"
halt
else
return 0
--
1.9.1
5 years, 2 months
[PATCH V2] kernel-efi-warnings: Check dmesg for errors while parsing EFI_MEMORY_ATTRIBUTES_TABLE
by Sai Praneeth Prakhya
From: Sai Praneeth <sai.praneeth.prakhya(a)intel.com>
Kernel patches that enable support for EFI_MEMORY_ATTRIBUTES table for
x86 will be merged into kernel_v4.11. These kernel patches validate
EFI_MEMORY_ATTRIBUTES_TABLE published by firmware before updating memory
regions. Hence, any errors in the table would be detected by kernel and
will be printed out to dmesg. So, it's good to look at dmesg for these
errors that indicate buggy implementation of EFI_MEMORY_ATTRIBUTES table
by firmware.
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya(a)intel.com>
Changes since V1:
None, V1 was missed in the last release, hence sending again.
---
.../kernel-efi-warnings/kernel-efi-warnings | 68 ++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/meta-luv/recipes-core/kernel_efi_warnings/kernel-efi-warnings/kernel-efi-warnings b/meta-luv/recipes-core/kernel_efi_warnings/kernel-efi-warnings/kernel-efi-warnings
index 2e55e0b26109..2af05627c2c5 100644
--- a/meta-luv/recipes-core/kernel_efi_warnings/kernel-efi-warnings/kernel-efi-warnings
+++ b/meta-luv/recipes-core/kernel_efi_warnings/kernel-efi-warnings/kernel-efi-warnings
@@ -78,3 +78,71 @@ PTTRN="\[Firmware Info\]"
DESC="Check for informative messages issued by the Linux kernel about the firmware."
test_dmesg "${TEST}" "${DESC}" "${PTTRN}"
+
+# Check if the entries in EFI_MEMORY_ATTRIBUTES table have appropriate type.
+# According to UEFI spec, all entries in EFI_MEMORY_ATTRIBUTES table should
+# be either RuntimeServiceCode or RuntimeServiceData. All other types indicate
+# buggy firmware.
+
+TEST="Kernel_MEM_ATTR_TYPE"
+PTTRN="efi: memattr: Entry type should be RuntimeServiceCode/Data"
+DESC="Check if the entries in EFI_MEMORY_ATTRIBUTES table have appropriate type."
+
+test_dmesg "${TEST}" "${DESC}" "${PTTRN}"
+
+# Check if the entries in EFI_MEMORY_ATTRIBUTES table have appropriate attributes
+# set. Presently, UEFI spec defines only three attributes for entries in
+# EFI_MEMORY_ATTRIBUTES table and they are RO (Read Only), XP (eXecute Protect)
+# and EFI_MEMORY_RUNTIME. Any other attribute set for these entries indicate
+# buggy firmware.
+
+TEST="Kernel_MEM_ATTR_ATTR"
+PTTRN="efi: memattr: Entry attributes invalid: RO and XP bits both cleared"
+DESC="Check if the entries in EFI_MEMORY_ATTRIBUTES table have appropriate attributes."
+
+test_dmesg "${TEST}" "${DESC}" "${PTTRN}"
+
+# Check for alignment of entries in EFI_MEMORY_ATTRIBUTES table. UEFI spec,
+# mentions that all EFI_MEMORY_DESCRIPTORS that require virtual mapping
+# must be aligned on a 4KiB boundary and must be a multiple of 4KiB in size.
+# So, unaligned regions indicate buggy firmware.
+
+TEST="Kernel_MEM_ATTR_ALGN"
+PTTRN="efi: memattr: Entry address region misaligned"
+DESC="Check for alignment of entries in EFI_MEMORY_ATTRIBUTES table."
+
+test_dmesg "${TEST}" "${DESC}" "${PTTRN}"
+
+# Check for entries that describe multiple entries of EFI Memory Map.
+# UEFI spec mentions that every entry in EFI_MEMORY_ATTRIBUTES table must
+# be a sub-region of, or equal to, a entry in EFI Memory Map. This means
+# that, a entry in EFI_MEMORY_ATTRIBUTES table which describes more than
+# one entry in EFI Memory Map is a bug and hence indicates buggy firmware.
+
+TEST="Kernel_MEM_ATTR_OVLP"
+PTTRN="efi: memattr: Entry covers multiple EFI memory map regions"
+DESC="Check for entries that describe multiple entries of EFI Memory Map."
+
+test_dmesg "${TEST}" "${DESC}" "${PTTRN}"
+
+# Check if entry type is same in EFI_MEMORY_ATTRIBUTES and EFI Memory Map.
+# UEFI spec defines that "Type" field of an entry in EFI_MEMORY_ATTRIBUTES table
+# should match with the "Type" field of the same entry found in EFI Memory Map.
+# Any mismatch between entries "Type" field indicates buggy firmware.
+
+TEST="Kernel_MEM_ATTR_TYMA"
+PTTRN="efi: memattr: Entry type deviates from EFI memory map region type"
+DESC="Check if entry type is same in EFI_MEMORY_ATTRIBUTES and EFI Memory Map."
+
+test_dmesg "${TEST}" "${DESC}" "${PTTRN}"
+
+# Check if the entries published in EFI_MEMORY_ATTRIBUTES table match with
+# atleast one entry in EFI Memory Map. This is not stated directly in the
+# UEFI spec but can be inferred easily. This check makes sure that all the
+# entries in EFI_MEMORY_ATTRIBUTES table are derived from EFI Memory Map.
+
+TEST="Kernel_MEM_ATTR_MISS"
+PTTRN="efi: memattr: No matching entry found in the EFI memory map"
+DESC="Check if entry is present in EFI Memory Map."
+
+test_dmesg "${TEST}" "${DESC}" "${PTTRN}"
--
2.1.4
5 years, 2 months