[RFC 1/6] meta-efibootguard: Create basic recipe structure

105 views
Skip to first unread message

Reichel Andreas

unread,
Aug 30, 2017, 7:29:45 AM8/30/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

From: Reichel Andreas <andreas.r...@siemens.com>

Create recipe structure including
* layer.conf
* license file
* yml file for kas builds

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
COPYING.GPLv2 | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
conf/layer.conf | 11 ++
kas.yml | 6 +
3 files changed, 356 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 conf/layer.conf
create mode 100644 kas.yml

diff --git a/COPYING.GPLv2 b/COPYING.GPLv2
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/COPYING.GPLv2
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..19d501c
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,11 @@
+BBPATH .= ":${LAYERDIR}"
+
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+ ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "efibootguard"
+BBFILE_PATTERN_efibootguard = "^${LAYERDIR}/"
+BBFILE_PRIORITY_efibootguard = "6"
+
+EFIBOOTGUARD_GPLv2_LICENSE = "${LAYERDIR}/COPYING.GPLv2"
+
diff --git a/kas.yml b/kas.yml
new file mode 100644
index 0000000..1205130
--- /dev/null
+++ b/kas.yml
@@ -0,0 +1,6 @@
+header:
+ version: 2
+
+repos:
+ meta-efibootguard:
+
--
2.14.1

Reichel Andreas

unread,
Aug 30, 2017, 7:29:45 AM8/30/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

From: Reichel Andreas <andreas.r...@siemens.com>

Add ToDo list for integration into yocto projects
Add an example for a .wks file to use efibootguard as boot loader.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 README.md

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6e2a469
--- /dev/null
+++ b/README.md
@@ -0,0 +1,46 @@
+# efibootguard meta layer #
+
+This layer provides basic integration of efibootguard into an existing yocto project.
+
+Steps:
+
+1. Include this meta layer into your project
+
+2. Set `EFI_PROVIDER` to "efibootguard" in your local.conf or in your
+ `conf/machine/<MACHINE>.conf`:
+```
+EFI_PROVIDER="efibootguard"
+```
+
+3. Provide a project-specific .wks file using the python source plugins
+ of this layer for image creation
+
+4. Build the roots and the hdd image using the new .wks file
+
+## Example .wks file ##
+
+```
+# short-description: Create a bootable disk image with efibootguard
+# long-description: Creates a partitioned EFI disk image,
+# using efibootguard, that the user can directly dd to boot media.
+
+# EFI partition containing efibootguard
+part --source efibootguard-efi --size 32 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label efi --part-type=EF00 --align 1024
+
+# Two root partitions for updateability, leave away 2nd if not used
+part / --source rootfs --size 1024 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --fstype=ext4 --label platform0 --align 1024
+part --source rootfs --size 1024 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --fstype=ext4 --label plaftorm1 --align 1024
+
+# Two config partitions to load boot configuration and kernel
+part --source efibootguard-boot --size 32 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label boot0 --align 1024 --part-type=0700 --sourceparams "watchdog=60,revision=2"
+part --source efibootguard-boot --size 32 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label boot1 --align 1024 --part-type=0700 --sourceparams "watchdog=60,revision=1"
+
+# Other partitions
+part --size 1024 --extra-space 0 --overhead-factor 1 --ondisk mmcblk0 --label persistent --align 1024 --fstype=ext4
+part swap --ondisk mmcblk0 --size 512 --fstype=swap --label swap --align 1024
+
+# Important for type of partition table
+bootloader --ptable gpt --append="console=ttyS1,115200n8 reboot=efi,warm rw debugshell=5 rootwait"
+```
+
+*NOTE*: The `--append` option to the bootloader gives kernel parameters that are written into the efibootguard environment file.
--
2.14.1

Reichel Andreas

unread,
Aug 30, 2017, 7:29:45 AM8/30/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

From: Reichel Andreas <andreas.r...@siemens.com>

* Activate busybox watchdog configuration if busybox
is used to have the watchdog binary.
* Install a sysV init script to feed the watchdog.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
recipes-core/busybox/busybox_%.bbappend | 11 +++++++++++
recipes-core/busybox/files/watchdog.cfg | 1 +
recipes-core/busybox/files/watchdog.sh | 17 +++++++++++++++++
3 files changed, 29 insertions(+)
create mode 100644 recipes-core/busybox/busybox_%.bbappend
create mode 100644 recipes-core/busybox/files/watchdog.cfg
create mode 100644 recipes-core/busybox/files/watchdog.sh

diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend
new file mode 100644
index 0000000..94da82e
--- /dev/null
+++ b/recipes-core/busybox/busybox_%.bbappend
@@ -0,0 +1,11 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://watchdog.cfg \
+ file://watchdog.sh"
+
+do_install_append() {
+ install -d "${D}${sysconfdir}/init.d"
+ install -m 0755 "${WORKDIR}/watchdog.sh" "${D}${sysconfdir}/init.d/watchdog.sh"
+ install -d "${D}${sysconfdir}/rcS.d"
+ ln -sf ../init.d/watchdog.sh "${D}${sysconfdir}/rcS.d/S00watchdog.sh"
+}
diff --git a/recipes-core/busybox/files/watchdog.cfg b/recipes-core/busybox/files/watchdog.cfg
new file mode 100644
index 0000000..80e211d
--- /dev/null
+++ b/recipes-core/busybox/files/watchdog.cfg
@@ -0,0 +1 @@
+CONFIG_WATCHDOG=y
diff --git a/recipes-core/busybox/files/watchdog.sh b/recipes-core/busybox/files/watchdog.sh
new file mode 100644
index 0000000..ecad50d
--- /dev/null
+++ b/recipes-core/busybox/files/watchdog.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: watchdog
+# Required-Start: mountvirtfs
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Start watchdog
+# Description:
+### END INIT INFO
+
+. /etc/default/rcS
+
+/sbin/watchdog /dev/watchdog
+
+: exit 0
+
--
2.14.1

Reichel Andreas

unread,
Aug 30, 2017, 7:29:45 AM8/30/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

From: Reichel Andreas <andreas.r...@siemens.com>

Add bitbake recipe for compilation of
* efibootguard
* efibootguard native environment utilities

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
recipes-bsp/efibootguard/efibootguard.bb | 52 ++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 recipes-bsp/efibootguard/efibootguard.bb

diff --git a/recipes-bsp/efibootguard/efibootguard.bb b/recipes-bsp/efibootguard/efibootguard.bb
new file mode 100644
index 0000000..66ba61b
--- /dev/null
+++ b/recipes-bsp/efibootguard/efibootguard.bb
@@ -0,0 +1,52 @@
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "git://github.com/siemens/efibootguard.git;protocol=https;branch=master"
+SRCREV = "e3263ab8132b8d0be3b1e5513afc4a93f287e9e5"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "gnu-efi pciutils"
+
+inherit autotools deploy
+
+COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
+
+PACKAGES = "${PN}-tools \
+ ${PN}-tools-dbg \
+ ${PN}-tools-staticdev \
+ ${PN}-tools-dev \
+ ${PN}-efi"
+
+EXTRA_OECONF = "--with-gnuefi-sys-dir=${STAGING_DIR_HOST} \
+ --with-gnuefi-include-dir=${STAGING_INCDIR}/efi \
+ --with-gnuefi-lds-dir=${STAGING_LIBDIR} \
+ --with-gnuefi-lib-dir=${STAGING_LIBDIR}"
+
+FILES_${PN}-tools = "/usr/bin"
+FILES_${PN}-tools-dbg = "/usr/src/debug"
+FILES_${PN}-tools-staticdev = "/usr/lib/lib*.a"
+FILES_${PN}-tools-dev = "/usr/include/*"
+FILES_${PN}-efi = "/usr/lib/efibootguard"
+
+do_deploy () {
+ install ${B}/efibootguard*.efi ${DEPLOYDIR}
+}
+addtask deploy before do_build after do_compile
+
+BBCLASSEXTEND = "native"
+DEPENDS_class-native = ""
+
+do_compile_class-native () {
+ oe_runmake bg_setenv
+}
+
+do_install_class-native () {
+ install -d ${D}${bindir}/
+ install -m755 ${B}/bg_setenv ${D}${bindir}/
+ ln -s bg_setenv ${D}${bindir}/bg_printenv
+}
+
+do_deploy_class-native () {
+}
+
--
2.14.1

Reichel Andreas

unread,
Aug 30, 2017, 7:29:45 AM8/30/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

From: Reichel Andreas <andreas.r...@siemens.com>

Add wic plugins for
* efibootguard EFI partition
* efibootguard config partition(s)

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
.../lib/wic/plugins/source/efibootguard-boot.py | 139 +++++++++++++++++++++
scripts/lib/wic/plugins/source/efibootguard-efi.py | 106 ++++++++++++++++
2 files changed, 245 insertions(+)
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-efi.py

diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
new file mode 100644
index 0000000..de584ba
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
@@ -0,0 +1,139 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Copyright (c) 2017, Siemens AG.
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# DESCRIPTION
+# This implements the 'bootimg-efi' source plugin class for 'wic'
+#
+# AUTHORS
+# Tom Zanussi <tom.zanussi (at] linux.intel.com>
+# Claudius Heine <ch (at] denx.de>
+# Andreas Reichel <andreas.reichel (at] tngtech.com>
+
+import os
+import shutil
+
+from wic import msger
+from wic.pluginbase import SourcePlugin
+from wic.utils.misc import get_custom_config
+from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \
+ BOOTDD_EXTRA_SPACE
+
+class EfibootguardBootPlugin(SourcePlugin):
+ """
+ Create boot partition.
+ This plugin supports efibootguard bootloader.
+ """
+
+ name = 'efibootguard-boot'
+
+ @classmethod
+ def do_configure_partition(cls, part, source_params, creator, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ native_sysroot):
+ """
+ Called before do_prepare_partition(), creates loader-specific config
+ """
+ hdddir = "%s/hdd/%s.%s" % (cr_workdir, part.label, part.lineno)
+
+ install_cmd = "install -d %s" % hdddir
+ exec_cmd(install_cmd)
+
+ bootloader = creator.ks.bootloader
+
+ cmdline = "root=%s %s\n" % \
+ (creator.rootdev, bootloader.append)
+
+ cwd = os.getcwd()
+ os.chdir(hdddir)
+ config_cmd = 'bg_setenv -f -k "C:%s:bzImage" -a "%s" -r %s -w %s' % \
+ (part.label.upper(), \
+ cmdline.strip(), \
+ source_params.get("revision", 1), \
+ source_params.get("watchdog", 5))
+
+ exec_native_cmd(config_cmd, native_sysroot)
+ os.chdir(cwd)
+
+ @classmethod
+ def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ rootfs_dir, native_sysroot):
+ """
+ Called to do the actual content population for a partition i.e. it
+ 'prepares' the partition to be incorporated into the image.
+ In this case, prepare content for an EFI (grub) boot partition.
+ """
+ if not bootimg_dir:
+ bootimg_dir = get_bitbake_var("HDDDIR")
+ if not bootimg_dir:
+ msger.error("HDDDIR not set, exiting\n")
+ os.exit(1)
+
+ # just so the result notes display it
+ creator.set_bootimg_dir(bootimg_dir)
+
+ staging_kernel_dir = kernel_dir
+
+ hdddir = "%s/hdd/%s.%s" % (cr_workdir, part.label, part.lineno)
+
+ install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \
+ (staging_kernel_dir, hdddir)
+ exec_cmd(install_cmd)
+
+ # Write label as utf-16le to EFILABEL file
+ fd = open("%s/EFILABEL" % hdddir, 'wb')
+ fd.write(part.label.upper().encode("utf-16le"))
+ fd.close()
+
+ du_cmd = "du -bks %s" % hdddir
+ out = exec_cmd(du_cmd)
+ blocks = int(out.split()[0])
+
+ # Calculate number of extra blocks to be sure that the resulting
+ # partition image has the wanted size.
+ extra_blocks = part.get_extra_block_count(blocks)
+
+ if extra_blocks < BOOTDD_EXTRA_SPACE:
+ extra_blocks = BOOTDD_EXTRA_SPACE
+
+ blocks += extra_blocks
+
+ msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
+ (extra_blocks, part.mountpoint, blocks))
+
+ # dosfs image, created by mkdosfs
+ bootimg = "%s/%s.%s.img" % (cr_workdir, part.label, part.lineno)
+
+ dosfs_cmd = "mkdosfs -F 16 -n %s -C %s %d" % (part.label.upper(), \
+ bootimg, blocks)
+
+ exec_native_cmd(dosfs_cmd, native_sysroot)
+
+ mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)
+ exec_native_cmd(mcopy_cmd, native_sysroot)
+
+ chmod_cmd = "chmod 644 %s" % bootimg
+ exec_cmd(chmod_cmd)
+
+ du_cmd = "du -Lbks %s" % bootimg
+ out = exec_cmd(du_cmd)
+ bootimg_size = out.split()[0]
+
+ part.size = int(bootimg_size)
+ part.source_file = bootimg
diff --git a/scripts/lib/wic/plugins/source/efibootguard-efi.py b/scripts/lib/wic/plugins/source/efibootguard-efi.py
new file mode 100644
index 0000000..9fe50b0
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py
@@ -0,0 +1,106 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Copyright (c) 2017, Siemens AG.
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# DESCRIPTION
+# This implements the 'bootimg-efi' source plugin class for 'wic'
+#
+# AUTHORS
+# Tom Zanussi <tom.zanussi (at] linux.intel.com>
+# Claudius Heine <ch (at] denx.de>
+# Andreas Reichel <andreas.reichel (at] tngtech.com>
+
+import os
+import os.path
+import shutil
+
+from wic import msger
+from wic.pluginbase import SourcePlugin
+from wic.utils.misc import get_custom_config
+from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \
+ BOOTDD_EXTRA_SPACE
+
+class EfibootguardEFIPlugin(SourcePlugin):
+ """
+ Create EFI partition.
+ This plugin supports the efibootguard bootloader.
+ """
+
+ name = 'efibootguard-efi'
+
+ @classmethod
+ def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ rootfs_dir, native_sysroot):
+ """
+ Called to do the actual content population for a partition i.e. it
+ 'prepares' the partition to be incorporated into the image.
+ In this case, prepare content for an EFI (grub) boot partition.
+ """
+ if not bootimg_dir:
+ bootimg_dir = get_bitbake_var("HDDDIR")
+ if not bootimg_dir:
+ msger.error("HDDDIR not set, exiting\n")
+ # just so the result notes display it
+ creator.set_bootimg_dir(bootimg_dir)
+
+ staging_kernel_dir = kernel_dir
+
+ hdddir = "%s/hdd/%s.%s" % (cr_workdir, part.label, part.lineno)
+
+ install_cmd = "install -d %s/EFI/BOOT" % hdddir
+ exec_cmd(install_cmd)
+
+ cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir)
+ exec_cmd(cp_cmd, True)
+
+ # Calculate the number of extra blocks to be sure that the
+ # resulting partition image is of the wanted size
+
+ du_cmd = "du -bks %s" % hdddir
+ out = exec_cmd(du_cmd)
+ blocks = int(out.split()[0])
+
+ extra_blocks = part.get_extra_block_count(blocks)
+
+ if extra_blocks < BOOTDD_EXTRA_SPACE:
+ extra_blocks = BOOTDD_EXTRA_SPACE
+
+ blocks += extra_blocks
+
+ msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
+ (extra_blocks, part.mountpoint, blocks))
+
+ # dosfs image, created by mkdosfs
+ efiimg = "%s/%s.%s.img" % (cr_workdir, part.label, part.lineno)
+
+ dosfs_cmd = "mkdosfs -n %s -C %s %d" % (part.label.upper(), efiimg, blocks)
+ exec_native_cmd(dosfs_cmd, native_sysroot)
+
+ mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (efiimg, hdddir)
+ exec_native_cmd(mcopy_cmd, native_sysroot)
+
+ chmod_cmd = "chmod 644 %s" % efiimg
+ exec_cmd(chmod_cmd)
+
+ du_cmd = "du -Lbks %s" % efiimg
+ out = exec_cmd(du_cmd)
+ efiimg_size = out.split()[0]
+
+ part.size = int(efiimg_size)
+ part.source_file = efiimg
--
2.14.1

Reichel Andreas

unread,
Aug 30, 2017, 7:29:45 AM8/30/17
to efibootg...@googlegroups.com, Reichel Andreas
This series creates a new meta-efibootguard layer
that provides integration of efibootguard into
existing yocto projects.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>

Reichel Andreas (6):
meta-efibootguard: Create basic recipe structure
bbclass: Add efibootguard.bbclass
wic: Add wic plugins for efibootguard
efibootguard: Add bitbake recipe
busybox: Add configure snippet for watchdog
README.md: Add instructions

COPYING.GPLv2 | 339 +++++++++++++++++++++
README.md | 46 +++
classes/efibootguard.bbclass | 78 +++++
conf/layer.conf | 11 +
kas.yml | 6 +
recipes-bsp/efibootguard/efibootguard.bb | 52 ++++
recipes-core/busybox/busybox_%.bbappend | 11 +
recipes-core/busybox/files/watchdog.cfg | 1 +
recipes-core/busybox/files/watchdog.sh | 17 ++
.../lib/wic/plugins/source/efibootguard-boot.py | 139 +++++++++
scripts/lib/wic/plugins/source/efibootguard-efi.py | 106 +++++++
11 files changed, 806 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 README.md
create mode 100644 classes/efibootguard.bbclass
create mode 100644 conf/layer.conf
create mode 100644 kas.yml
create mode 100644 recipes-bsp/efibootguard/efibootguard.bb
create mode 100644 recipes-core/busybox/busybox_%.bbappend
create mode 100644 recipes-core/busybox/files/watchdog.cfg
create mode 100644 recipes-core/busybox/files/watchdog.sh
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-efi.py

--
2.14.1

Reichel Andreas

unread,
Aug 30, 2017, 7:29:45 AM8/30/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

From: Reichel Andreas <andreas.r...@siemens.com>

Add an efibootguard.bbclass similar to gummiboot.bbclass.
This way, the EFI_PROVIDER variable can be set to 'efibootguard',
to use efibootguard as bootloader. The rest is handled by
image-live.bbclass from poky/meta layer.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
classes/efibootguard.bbclass | 78 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 classes/efibootguard.bbclass

diff --git a/classes/efibootguard.bbclass b/classes/efibootguard.bbclass
new file mode 100644
index 0000000..70f636f
--- /dev/null
+++ b/classes/efibootguard.bbclass
@@ -0,0 +1,78 @@
+# Set EFI_PROVIDER = "efibootguard" to use efibootguard on your live images instead of grub-efi
+# (images built by image-live.bbclass or image-vm.bbclass)
+
+# Authors: Claudius Heine (ch [at) denx.de)
+# Andreas Reichel (andreas.reichel.ext [at) siemens.com)
+
+do_bootimg[depends] += "${MLPREFIX}efibootguard:do_deploy"
+do_bootimg[depends] += "${MLPREFIX}efibootguard-native:do_deploy"
+do_bootdirectdisk[depends] += "${MLPREFIX}efibootguard:do_deploy"
+
+EFIDIR = "/EFI/BOOT"
+
+inherit fs-uuid
+inherit logging
+
+efi_populate() {
+ DEST=$1
+ if [ "${TARGET_ARCH}" = "i586" ]; then
+ EFI_IMAGE="efibootguardia32.efi"
+ DEST_EFI_IMAGE="bootia32.efi"
+ elif [ "${TARGET_ARCH}" = "x86_64" ]; then
+ EFI_IMAGE="efibootguardx64.efi"
+ DEST_EFI_IMAGE="bootx64.efi"
+ else
+ bbfatal "Invalid target architecture for efibootguard: ${TARGET_ARCH}. Only i586 and x86_64 are supported."
+ fi
+ install -d ${DEST}${EFIDIR}
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/${EFI_IMAGE} ${DEST}${EFIDIR}/${DEST_EFI_IMAGE}
+}
+
+efi_iso_populate() {
+ # Code copied from gummiboot.bbclass
+ iso_dir=$1
+ efi_populate $iso_dir
+ mkdir -p ${EFIIMGDIR}/${EFIDIR}
+ cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
+ cp $iso_dir/vmlinuz ${EFIIMGDIR}
+ EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
+ echo "fs0:${EFIPATH}\\${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
+ if [ -f "$iso_dir/initrd" ] ; then
+ cp $iso_dir/initrd ${EFIIMGDIR}
+ fi
+}
+
+efi_hddimg_populate() {
+ efi_populate $1
+}
+
+python build_efi_cfg() {
+ # This function is expected by image-live.bbclass
+ # If an iso is built for example as rescue medium, we only have one filesystem with efibootguard
+ # So a boot configuration is needed on this iso file system.
+ from subprocess import Popen, PIPE
+
+ skipiso = d.getVar("NOISO", True)
+ if not skipiso == "1":
+ bb.note("Generating iso default boot configuration.")
+ isodir = os.path.join(d.getVar("S", True), "iso")
+ bindir_native = d.getVar("STAGING_BINDIR_NATIVE", True);
+ bg_setenv_cmd = os.path.join(bindir_native, "bg_setenv")
+ olddir = os.getcwd()
+
+ make_isodir_cmd = ["mkdir", "-p", isodir]
+ p = Popen(make_isodir_cmd)
+
+ os.chdir(isodir)
+ p = Popen([bg_setenv_cmd, "--file", "--kernel=vmlinuz", "--watchdog=30"], \
+ stdout=PIPE, stderr=PIPE)
+ (out, err) = p.communicate()
+ os.chdir(olddir)
+ if not p.returncode == 0:
+ bb.fatal("Could not execute bg_setenv. Please make sure efibootguard-native is installed.")
+
+ bb.debug(2, "bg_setenv returned %s %s" % (out, err))
+
+ else:
+ bb.debug(2, "No iso built, no default boot configuration.")
+}
--
2.14.1

Jan Kiszka

unread,
Aug 30, 2017, 9:05:59 AM8/30/17
to [ext] Reichel Andreas, efibootg...@googlegroups.com, Cedric Hombourger
On 2017-08-30 13:29, [ext] Reichel Andreas wrote:
> This series creates a new meta-efibootguard layer
> that provides integration of efibootguard into
> existing yocto projects.

Thanks for sending the series early.

Cedric, maybe you can check if this helps with the issues you saw while
switching to efibootguard as IOT2000 boot loader. See the README for
what needs to be changed in meta-iot2000. Let us know your findings.

Jan
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

Claudius Heine

unread,
Aug 30, 2017, 9:19:29 AM8/30/17
to [ext] Reichel Andreas, efibootg...@googlegroups.com
Hi,

On 08/30/2017 01:29 PM, [ext] Reichel Andreas wrote:
> diff --git a/conf/layer.conf b/conf/layer.conf
> new file mode 100644
> index 0000000..19d501c
> --- /dev/null
> +++ b/conf/layer.conf
> @@ -0,0 +1,11 @@
> +BBPATH .= ":${LAYERDIR}"
> +
> +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
> + ${LAYERDIR}/recipes-*/*/*.bbappend"
> +
> +BBFILE_COLLECTIONS += "efibootguard"
> +BBFILE_PATTERN_efibootguard = "^${LAYERDIR}/"
> +BBFILE_PRIORITY_efibootguard = "6"
> +
> +EFIBOOTGUARD_GPLv2_LICENSE = "${LAYERDIR}/COPYING.GPLv2"

If your don't need this variable, then you should just remove it.
This line is just useful if this licence file needs to be reference from
another recipe, since the 'LAYERDIR' variable is not available in the
recipe context.

> +
> diff --git a/kas.yml b/kas.yml
> new file mode 100644
> index 0000000..1205130
> --- /dev/null
> +++ b/kas.yml
> @@ -0,0 +1,6 @@
> +header:
> + version: 2 > +
> +repos:
> + meta-efibootguard:
> +

One of the ideas of kas is to specify the dependencies with the tested
revision. This layer depends on oe-core or poky, so that should be
specified.

Cheers,
Claudius

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: c...@denx.de

Jan Kiszka

unread,
Aug 30, 2017, 9:40:35 AM8/30/17
to [ext] Claudius Heine, [ext] Reichel Andreas, efibootg...@googlegroups.com
On 2017-08-30 15:19, [ext] Claudius Heine wrote:
>> +
>> diff --git a/kas.yml b/kas.yml
>> new file mode 100644
>> index 0000000..1205130
>> --- /dev/null
>> +++ b/kas.yml
>> @@ -0,0 +1,6 @@
>> +header:
>> +  version: 2 > +
>> +repos:
>> +  meta-efibootguard:
>> +
>
> One of the ideas of kas is to specify the dependencies with the tested
> revision. This layer depends on oe-core or poky, so that should be
> specified.

Can you build a reasonable image with this layer alone? That should go
into the kas file then.

Jan

Claudius Heine

unread,
Aug 31, 2017, 5:28:31 AM8/31/17
to [ext] Reichel Andreas, efibootg...@googlegroups.com
Hi,

offline this questions came up. It might be useful to discuss it here
further:

Should 'meta-efibootguard' provide a integration so that it can be
tested with qemu_x86 in a core-image-minimal? Maybe also a slightly
bigger example image with a small script that overwrites/updates the
other partition?

If yes, then then it the 'kas.yml' might still be useful. Maybe rename
it to 'kas-example.yml' or similar.

This does not need to be part of this patch set.

Cheers,
Claudius

On 08/30/2017 01:29 PM, [ext] Reichel Andreas wrote:

Jan Kiszka

unread,
Aug 31, 2017, 6:30:42 AM8/31/17
to [ext] Claudius Heine, [ext] Reichel Andreas, efibootg...@googlegroups.com
On 2017-08-31 11:28, [ext] Claudius Heine wrote:
> Hi,
>
> offline this questions came up. It might be useful to discuss it here
> further:
>
> Should 'meta-efibootguard' provide a integration so that it can be
> tested with qemu_x86 in a core-image-minimal? Maybe also a slightly
> bigger example image with a small script that overwrites/updates the
> other partition?
>
> If yes, then then it the 'kas.yml' might still be useful. Maybe rename
> it to 'kas-example.yml' or similar.
>
> This does not need to be part of this patch set.

Ack, let's keep this in mind for later. The primary goal should be for
now enabling a demo based on the IOT2000 device.

Andreas Reichel

unread,
Sep 5, 2017, 8:37:51 AM9/5/17
to efibootg...@googlegroups.com, Reichel Andreas
From: Reichel Andreas <andreas.r...@siemens.com>

Add wic plugins for
* efibootguard EFI partition
* efibootguard config partition(s)

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
.../lib/wic/plugins/source/efibootguard-boot.py | 139 +++++++++++++++++++++
.../lib/wic/plugins/source/efibootguard-efi.py | 106 ++++++++++++++++
2 files changed, 245 insertions(+)
create mode 100644 meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-efi.py

diff --git a/meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-boot.py b/meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-boot.py
new file mode 100644
index 0000000..de584ba
--- /dev/null
+++ b/meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-boot.py
diff --git a/meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-efi.py b/meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-efi.py
new file mode 100644
index 0000000..9fe50b0
--- /dev/null
+++ b/meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-efi.py

Andreas Reichel

unread,
Sep 5, 2017, 8:37:51 AM9/5/17
to efibootg...@googlegroups.com, Reichel Andreas
From: Reichel Andreas <andreas.r...@siemens.com>

This series creates a new meta-efibootguard layer that provides
integration of efibootguard into existing yocto projects.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>

Reichel Andreas (6):
meta-efibootguard: Create basic recipe structure
bbclass: Add efibootguard.bbclass
wic: Add wic plugins for efibootguard
efibootguard: Add bitbake recipe
busybox: Add configure snippet for watchdog
README.md: Add instructions

COPYING.GPLv2 | 339 +++++++++++++++++++++
README.md | 78 +++++
meta-efibootguard/classes/efibootguard.bbclass | 88 ++++++
meta-efibootguard/conf/layer.conf | 18 ++
.../recipes-bsp/efibootguard/efibootguard.bb | 62 ++++
.../recipes-core/busybox/busybox_%.bbappend | 21 ++
.../recipes-core/busybox/files/watchdog.cfg | 1 +
.../recipes-core/busybox/files/watchdog.sh | 17 ++
.../lib/wic/plugins/source/efibootguard-boot.py | 139 +++++++++
.../lib/wic/plugins/source/efibootguard-efi.py | 106 +++++++
10 files changed, 869 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 README.md
create mode 100644 meta-efibootguard/classes/efibootguard.bbclass
create mode 100644 meta-efibootguard/conf/layer.conf
create mode 100644 meta-efibootguard/recipes-bsp/efibootguard/efibootguard.bb
create mode 100644 meta-efibootguard/recipes-core/busybox/busybox_%.bbappend
create mode 100644 meta-efibootguard/recipes-core/busybox/files/watchdog.cfg
create mode 100644 meta-efibootguard/recipes-core/busybox/files/watchdog.sh
create mode 100644 meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 meta-efibootguard/scripts/lib/wic/plugins/source/efibootguard-efi.py

--
2.14.1

Andreas Reichel

unread,
Sep 5, 2017, 8:37:51 AM9/5/17
to efibootg...@googlegroups.com, Reichel Andreas
From: Reichel Andreas <andreas.r...@siemens.com>

Add bitbake recipe for compilation of
* efibootguard
* efibootguard native environment utilities

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
.../recipes-bsp/efibootguard/efibootguard.bb | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 meta-efibootguard/recipes-bsp/efibootguard/efibootguard.bb

diff --git a/meta-efibootguard/recipes-bsp/efibootguard/efibootguard.bb b/meta-efibootguard/recipes-bsp/efibootguard/efibootguard.bb
new file mode 100644
index 0000000..8b75ff0
--- /dev/null
+++ b/meta-efibootguard/recipes-bsp/efibootguard/efibootguard.bb
@@ -0,0 +1,62 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+

Andreas Reichel

unread,
Sep 5, 2017, 8:37:51 AM9/5/17
to efibootg...@googlegroups.com, Reichel Andreas
From: Reichel Andreas <andreas.r...@siemens.com>

Add ToDo list for integration into yocto projects
Add an example for a .wks file to use efibootguard as boot loader.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
README.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 README.md

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..fce877c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,78 @@
+# EFI Boot Guard meta layer #
+
+A meta-layer for integration of `efibootguard` into a yocto project.
+
+## Development ##
+
+Mailing list:
+[efibootg...@googlegroups.com](efibootg...@googlegroups.com)
+
+Archive:
+[https://www.mail-archive.com/efibootg...@googlegroups.com](https://www.mail-archive.com/efibootg...@googlegroups.com)
+
+## Current status ##
+
+Tested with:
+
+poky (morty): 7d5822bf4cb2089687c3c9a908cf4a4ef4e9a53a
+https://git.yoctoproject.org/git/poky
+
+meta-intel: 6add41510412ca196efb3e4f949d403a8b6f35d7
+https://git.yoctoproject.org/git/meta-intel
+
+meta-intel-iot-middleware: fc8eabfa4fb54802d3f97123b9d2954450175e33
+https://git.yoctoproject.org/git/meta-intel-iot-middleware
+
+meta-nodejs: eec531e97a17bfd406f3bf76dee4057dcf5286a4
+https://github.com/imyller/meta-nodejs
+
+meta-openembedded: fe5c83312de11e80b85680ef237f8acb04b4b26e
+http://git.openembedded.org/meta-openembedded
+
+meta-iot2000: 774746e44ee248306881ffae7f02370025fda77e
+https://github.com/siemens/meta-iot2000
+
+## project integration ##

Andreas Reichel

unread,
Sep 5, 2017, 8:37:51 AM9/5/17
to efibootg...@googlegroups.com, Reichel Andreas
From: Reichel Andreas <andreas.r...@siemens.com>

* Activate busybox watchdog configuration if busybox
is used to have the watchdog binary.
* Install a sysV init script to feed the watchdog.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
.../recipes-core/busybox/busybox_%.bbappend | 21 +++++++++++++++++++++
.../recipes-core/busybox/files/watchdog.cfg | 1 +
.../recipes-core/busybox/files/watchdog.sh | 17 +++++++++++++++++
3 files changed, 39 insertions(+)
create mode 100644 meta-efibootguard/recipes-core/busybox/busybox_%.bbappend
create mode 100644 meta-efibootguard/recipes-core/busybox/files/watchdog.cfg
create mode 100644 meta-efibootguard/recipes-core/busybox/files/watchdog.sh

diff --git a/meta-efibootguard/recipes-core/busybox/busybox_%.bbappend b/meta-efibootguard/recipes-core/busybox/busybox_%.bbappend
new file mode 100644
index 0000000..0e3f7b6
--- /dev/null
+++ b/meta-efibootguard/recipes-core/busybox/busybox_%.bbappend
@@ -0,0 +1,21 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://watchdog.cfg \
+ file://watchdog.sh"
+
+do_install_append() {
+ install -d "${D}${sysconfdir}/init.d"
+ install -m 0755 "${WORKDIR}/watchdog.sh" "${D}${sysconfdir}/init.d/watchdog.sh"
+ install -d "${D}${sysconfdir}/rcS.d"
+ ln -sf ../init.d/watchdog.sh "${D}${sysconfdir}/rcS.d/S00watchdog.sh"
+}
diff --git a/meta-efibootguard/recipes-core/busybox/files/watchdog.cfg b/meta-efibootguard/recipes-core/busybox/files/watchdog.cfg
new file mode 100644
index 0000000..80e211d
--- /dev/null
+++ b/meta-efibootguard/recipes-core/busybox/files/watchdog.cfg
@@ -0,0 +1 @@
+CONFIG_WATCHDOG=y
diff --git a/meta-efibootguard/recipes-core/busybox/files/watchdog.sh b/meta-efibootguard/recipes-core/busybox/files/watchdog.sh
new file mode 100644
index 0000000..ecad50d
--- /dev/null
+++ b/meta-efibootguard/recipes-core/busybox/files/watchdog.sh

Andreas Reichel

unread,
Sep 5, 2017, 8:37:51 AM9/5/17
to efibootg...@googlegroups.com, Reichel Andreas
From: Reichel Andreas <andreas.r...@siemens.com>

Create recipe structure including
* layer.conf
* license file

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
COPYING.GPLv2 | 339 ++++++++++++++++++++++++++++++++++++++
meta-efibootguard/conf/layer.conf | 18 ++
2 files changed, 357 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 meta-efibootguard/conf/layer.conf

diff --git a/COPYING.GPLv2 b/COPYING.GPLv2
new file mode 100644
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
diff --git a/meta-efibootguard/conf/layer.conf b/meta-efibootguard/conf/layer.conf
new file mode 100644
index 0000000..3226d73
--- /dev/null
+++ b/meta-efibootguard/conf/layer.conf
@@ -0,0 +1,18 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+
+BBPATH .= ":${LAYERDIR}"
+
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+ ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "efibootguard"
+BBFILE_PATTERN_efibootguard = "^${LAYERDIR}/"
+BBFILE_PRIORITY_efibootguard = "6"
--
2.14.1

Andreas Reichel

unread,
Sep 5, 2017, 8:37:51 AM9/5/17
to efibootg...@googlegroups.com, Reichel Andreas
From: Reichel Andreas <andreas.r...@siemens.com>

Add an efibootguard.bbclass similar to gummiboot.bbclass.
This way, the EFI_PROVIDER variable can be set to 'efibootguard',
to use efibootguard as bootloader. The rest is handled by
image-live.bbclass from poky/meta layer.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
meta-efibootguard/classes/efibootguard.bbclass | 88 ++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
create mode 100644 meta-efibootguard/classes/efibootguard.bbclass

diff --git a/meta-efibootguard/classes/efibootguard.bbclass b/meta-efibootguard/classes/efibootguard.bbclass
new file mode 100644
index 0000000..7e77650
--- /dev/null
+++ b/meta-efibootguard/classes/efibootguard.bbclass
@@ -0,0 +1,88 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+

Jan Kiszka

unread,
Sep 5, 2017, 12:02:11 PM9/5/17
to [ext] Andreas Reichel, efibootg...@googlegroups.com
On 2017-09-05 14:37, [ext] Andreas Reichel wrote:
> From: Reichel Andreas <andreas.r...@siemens.com>
>
> Create recipe structure including
> * layer.conf
> * license file
>
> Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>

You still flip your name ordering between author and signed-off
statement. Please fix.

> ---
> COPYING.GPLv2 | 339 ++++++++++++++++++++++++++++++++++++++
> meta-efibootguard/conf/layer.conf | 18 ++

As already discussed offlist, it's better to start flat in the repo as
there is likely no use case for another layer aside this. Please move
and resend.

Thanks,

Andreas J. Reichel

unread,
Sep 6, 2017, 7:34:40 AM9/6/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Create recipe structure including
* layer.conf
* license file

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
COPYING.GPLv2 | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
conf/layer.conf | 18 +++
2 files changed, 357 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 conf/layer.conf

diff --git a/COPYING.GPLv2 b/COPYING.GPLv2
new file mode 100644
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..3226d73
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,18 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+

Andreas J. Reichel

unread,
Sep 6, 2017, 7:34:40 AM9/6/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add wic plugins for
* efibootguard EFI partition
* efibootguard config partition(s)

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
.../lib/wic/plugins/source/efibootguard-boot.py | 139 +++++++++++++++++++++
scripts/lib/wic/plugins/source/efibootguard-efi.py | 106 ++++++++++++++++
2 files changed, 245 insertions(+)
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-efi.py

diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
new file mode 100644
index 0000000..de584ba
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
diff --git a/scripts/lib/wic/plugins/source/efibootguard-efi.py b/scripts/lib/wic/plugins/source/efibootguard-efi.py
new file mode 100644
index 0000000..9fe50b0
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py

Andreas J. Reichel

unread,
Sep 6, 2017, 7:34:40 AM9/6/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

This series creates a new meta-efibootguard layer that provides
integration of efibootguard into existing yocto projects.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>

Andreas Reichel (6):
meta-efibootguard: Create basic recipe structure
bbclass: Add efibootguard.bbclass
wic: Add wic plugins for efibootguard
efibootguard: Add bitbake recipe
busybox: Add configure snippet for watchdog
README.md: Add instructions

COPYING.GPLv2 | 339 +++++++++++++++++++++
README.md | 78 +++++
classes/efibootguard.bbclass | 88 ++++++
conf/layer.conf | 18 ++
recipes-bsp/efibootguard/efibootguard.bb | 62 ++++
recipes-core/busybox/busybox_%.bbappend | 21 ++
recipes-core/busybox/files/watchdog.cfg | 1 +
recipes-core/busybox/files/watchdog.sh | 17 ++
.../lib/wic/plugins/source/efibootguard-boot.py | 139 +++++++++
scripts/lib/wic/plugins/source/efibootguard-efi.py | 106 +++++++
10 files changed, 869 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 README.md
create mode 100644 classes/efibootguard.bbclass
create mode 100644 conf/layer.conf
create mode 100644 recipes-bsp/efibootguard/efibootguard.bb
create mode 100644 recipes-core/busybox/busybox_%.bbappend
create mode 100644 recipes-core/busybox/files/watchdog.cfg
create mode 100644 recipes-core/busybox/files/watchdog.sh
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-efi.py

--
2.14.1

Andreas J. Reichel

unread,
Sep 6, 2017, 7:34:40 AM9/6/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

* Activate busybox watchdog configuration if busybox
is used to have the watchdog binary.
* Install a sysV init script to feed the watchdog.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
recipes-core/busybox/busybox_%.bbappend | 21 +++++++++++++++++++++
recipes-core/busybox/files/watchdog.cfg | 1 +
recipes-core/busybox/files/watchdog.sh | 17 +++++++++++++++++
3 files changed, 39 insertions(+)
create mode 100644 recipes-core/busybox/busybox_%.bbappend
create mode 100644 recipes-core/busybox/files/watchdog.cfg
create mode 100644 recipes-core/busybox/files/watchdog.sh

diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend
new file mode 100644
index 0000000..0e3f7b6
--- /dev/null
+++ b/recipes-core/busybox/busybox_%.bbappend
@@ -0,0 +1,21 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://watchdog.cfg \
+ file://watchdog.sh"
+
+do_install_append() {
+ install -d "${D}${sysconfdir}/init.d"
+ install -m 0755 "${WORKDIR}/watchdog.sh" "${D}${sysconfdir}/init.d/watchdog.sh"
+ install -d "${D}${sysconfdir}/rcS.d"
+ ln -sf ../init.d/watchdog.sh "${D}${sysconfdir}/rcS.d/S00watchdog.sh"
+}
diff --git a/recipes-core/busybox/files/watchdog.cfg b/recipes-core/busybox/files/watchdog.cfg
new file mode 100644
index 0000000..80e211d
--- /dev/null
+++ b/recipes-core/busybox/files/watchdog.cfg
@@ -0,0 +1 @@
+CONFIG_WATCHDOG=y
diff --git a/recipes-core/busybox/files/watchdog.sh b/recipes-core/busybox/files/watchdog.sh
new file mode 100644
index 0000000..ecad50d
--- /dev/null
+++ b/recipes-core/busybox/files/watchdog.sh

Andreas J. Reichel

unread,
Sep 6, 2017, 7:34:40 AM9/6/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add an efibootguard.bbclass similar to gummiboot.bbclass.
This way, the EFI_PROVIDER variable can be set to 'efibootguard',
to use efibootguard as bootloader. The rest is handled by
image-live.bbclass from poky/meta layer.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
classes/efibootguard.bbclass | 88 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
create mode 100644 classes/efibootguard.bbclass

diff --git a/classes/efibootguard.bbclass b/classes/efibootguard.bbclass
new file mode 100644
index 0000000..7e77650
--- /dev/null
+++ b/classes/efibootguard.bbclass
@@ -0,0 +1,88 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+

Andreas J. Reichel

unread,
Sep 6, 2017, 7:34:40 AM9/6/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add bitbake recipe for compilation of
* efibootguard
* efibootguard native environment utilities

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
recipes-bsp/efibootguard/efibootguard.bb | 62 ++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 recipes-bsp/efibootguard/efibootguard.bb

diff --git a/recipes-bsp/efibootguard/efibootguard.bb b/recipes-bsp/efibootguard/efibootguard.bb
new file mode 100644
index 0000000..8b75ff0
--- /dev/null
+++ b/recipes-bsp/efibootguard/efibootguard.bb
@@ -0,0 +1,62 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "git://github.com/siemens/efibootguard.git;protocol=https;branch=master"
+SRCREV = "e3263ab8132b8d0be3b1e5513afc4a93f287e9e5"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "gnu-efi pciutils"
+
+inherit autotools deploy

Andreas J. Reichel

unread,
Sep 6, 2017, 7:34:40 AM9/6/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add ToDo list for integration into yocto projects
Add an example for a .wks file to use efibootguard as boot loader.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
README.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 README.md

diff --git a/README.md b/README.md
new file mode 100644

Jan Kiszka

unread,
Sep 6, 2017, 2:15:07 PM9/6/17
to [ext] Andreas J. Reichel, efibootg...@googlegroups.com
We do have a standard authors block above already. Can we stick with it?
I would fix this up on merge.

Jan Kiszka

unread,
Sep 6, 2017, 2:17:36 PM9/6/17
to [ext] Andreas J. Reichel, efibootg...@googlegroups.com
On 2017-09-06 13:34, [ext] Andreas J. Reichel wrote:
Are you missing Intel here? The authors list below suggests this.

> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License version 2 as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License along
> +# with this program; if not, write to the Free Software Foundation, Inc.,
> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> +#
> +# DESCRIPTION
> +# This implements the 'bootimg-efi' source plugin class for 'wic'
> +#
> +# AUTHORS
> +# Tom Zanussi <tom.zanussi (at] linux.intel.com>
> +# Claudius Heine <ch (at] denx.de>
> +# Andreas Reichel <andreas.reichel (at] tngtech.com>

Is this formatting OE practice? Otherwise, I would prefer using our
default pattern consistently (copyright line, then Authors list).

Jan Kiszka

unread,
Sep 6, 2017, 2:20:29 PM9/6/17
to [ext] Andreas J. Reichel, efibootg...@googlegroups.com
On 2017-09-06 13:34, [ext] Andreas J. Reichel wrote:
Just formal nitpicking now. The repo has been created
(https://github.com/siemens/meta-efibootguard), but I didn't upload yet
until we clarified my two remarks.

Thanks,

Andreas Reichel

unread,
Sep 7, 2017, 4:30:33 AM9/7/17
to Jan Kiszka, efibootg...@googlegroups.com
The code in the file is a rewrite. Intel is replaced
because of that. But I do not know, how to proceed here correctly...
>
> > +#
> > +# This program is free software; you can redistribute it and/or modify
> > +# it under the terms of the GNU General Public License version 2 as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License along
> > +# with this program; if not, write to the Free Software Foundation, Inc.,
> > +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> > +#
> > +# DESCRIPTION
> > +# This implements the 'bootimg-efi' source plugin class for 'wic'
> > +#
> > +# AUTHORS
> > +# Tom Zanussi <tom.zanussi (at] linux.intel.com>
> > +# Claudius Heine <ch (at] denx.de>
> > +# Andreas Reichel <andreas.reichel (at] tngtech.com>
>
> Is this formatting OE practice? Otherwise, I would prefer using our
> default pattern consistently (copyright line, then Authors list).
>
Yes, this is OE practise.

> Jan
>
> --
> Siemens AG, Corporate Technology, CT RDA ITP SES-DE
> Corporate Competence Center Embedded Linux

--
Andreas Reichel
Dipl.-Phys. (Univ.)
Software Consultant

Andreas...@tngtech.com, +49-174-3180074
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterfoehring
Geschaeftsfuehrer: Henrik Klagges, Dr. Robert Dahlke, Gerhard Mueller
Sitz: Unterfoehring * Amtsgericht Muenchen * HRB 135082

Andreas Reichel

unread,
Sep 7, 2017, 4:32:38 AM9/7/17
to Jan Kiszka, efibootg...@googlegroups.com
You decide :) Either OE way (lower version), or into the block above...
I have no preferences like in the python file...
>
> Jan
>
> --
> Siemens AG, Corporate Technology, CT RDA ITP SES-DE
> Corporate Competence Center Embedded Linux

Jan Kiszka

unread,
Sep 7, 2017, 4:34:33 AM9/7/17
to Andreas Reichel, efibootg...@googlegroups.com
If it is a rewrite, leaving no worth mentioning code of the original
file behind, then Tom is no longer an author. Otherwise, leave in the
original copyright notice AND his name.

What's the file your copied at least this header from?

>>
>>> +#
>>> +# This program is free software; you can redistribute it and/or modify
>>> +# it under the terms of the GNU General Public License version 2 as
>>> +# published by the Free Software Foundation.
>>> +#
>>> +# This program is distributed in the hope that it will be useful,
>>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>> +# GNU General Public License for more details.
>>> +#
>>> +# You should have received a copy of the GNU General Public License along
>>> +# with this program; if not, write to the Free Software Foundation, Inc.,
>>> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>>> +#
>>> +# DESCRIPTION
>>> +# This implements the 'bootimg-efi' source plugin class for 'wic'
>>> +#
>>> +# AUTHORS
>>> +# Tom Zanussi <tom.zanussi (at] linux.intel.com>
>>> +# Claudius Heine <ch (at] denx.de>
>>> +# Andreas Reichel <andreas.reichel (at] tngtech.com>
>>
>> Is this formatting OE practice? Otherwise, I would prefer using our
>> default pattern consistently (copyright line, then Authors list).
>>
> Yes, this is OE practise.

OK.

Claudius Heine

unread,
Sep 7, 2017, 4:44:23 AM9/7/17
to [ext] Andreas J. Reichel, efibootg...@googlegroups.com
Hi,
Just noticed this line. This file does not implement the 'bootimg-efi'
source plugin anymore. This file I used initially as the base for this
plugin.

Andreas Reichel

unread,
Sep 7, 2017, 4:45:25 AM9/7/17
to Jan Kiszka, efibootg...@googlegroups.com
Claudius originally wrote on this version and it stems from

poky/scripts/lib/wic/plugins/source/bootimg-efi.py

Having a look at the last part of the file, we should keep Intel and
Tom Zanussi.

Andreas

Andreas J. Reichel

unread,
Sep 7, 2017, 5:06:48 AM9/7/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

This series creates a new meta-efibootguard layer that provides
integration of efibootguard into existing yocto projects.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>

Andreas Reichel (6):
meta-efibootguard: Create basic recipe structure
bbclass: Add efibootguard.bbclass
wic: Add wic plugins for efibootguard
efibootguard: Add bitbake recipe
busybox: Add configure snippet for watchdog
README.md: Add instructions

COPYING.GPLv2 | 339 +++++++++++++++++++++
README.md | 78 +++++
classes/efibootguard.bbclass | 86 ++++++
conf/layer.conf | 18 ++
recipes-bsp/efibootguard/efibootguard.bb | 63 ++++
recipes-core/busybox/busybox_%.bbappend | 22 ++
recipes-core/busybox/files/watchdog.cfg | 1 +
recipes-core/busybox/files/watchdog.sh | 17 ++
.../lib/wic/plugins/source/efibootguard-boot.py | 140 +++++++++
scripts/lib/wic/plugins/source/efibootguard-efi.py | 107 +++++++
10 files changed, 871 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 README.md
create mode 100644 classes/efibootguard.bbclass
create mode 100644 conf/layer.conf
create mode 100644 recipes-bsp/efibootguard/efibootguard.bb
create mode 100644 recipes-core/busybox/busybox_%.bbappend
create mode 100644 recipes-core/busybox/files/watchdog.cfg
create mode 100644 recipes-core/busybox/files/watchdog.sh
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-efi.py

--
2.14.1

Andreas J. Reichel

unread,
Sep 7, 2017, 5:06:50 AM9/7/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Create recipe structure including
* layer.conf
* license file

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
COPYING.GPLv2 | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
conf/layer.conf | 18 +++
2 files changed, 357 insertions(+)
create mode 100644 COPYING.GPLv2
create mode 100644 conf/layer.conf

diff --git a/COPYING.GPLv2 b/COPYING.GPLv2
new file mode 100644
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
new file mode 100644
index 0000000..3226d73
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,18 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+

Andreas J. Reichel

unread,
Sep 7, 2017, 5:06:51 AM9/7/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add an efibootguard.bbclass similar to gummiboot.bbclass.
This way, the EFI_PROVIDER variable can be set to 'efibootguard',
to use efibootguard as bootloader. The rest is handled by
image-live.bbclass from poky/meta layer.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
classes/efibootguard.bbclass | 86 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
create mode 100644 classes/efibootguard.bbclass

diff --git a/classes/efibootguard.bbclass b/classes/efibootguard.bbclass
new file mode 100644
index 0000000..c979e23
--- /dev/null
+++ b/classes/efibootguard.bbclass
@@ -0,0 +1,86 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Claudius Heine <c...@denx.de>
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+
+# Set EFI_PROVIDER = "efibootguard" to use efibootguard on your live images instead of grub-efi
+# (images built by image-live.bbclass or image-vm.bbclass)
+

Andreas J. Reichel

unread,
Sep 7, 2017, 5:06:52 AM9/7/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add wic plugins for
* efibootguard EFI partition
* efibootguard config partition(s)

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
.../lib/wic/plugins/source/efibootguard-boot.py | 140 +++++++++++++++++++++
scripts/lib/wic/plugins/source/efibootguard-efi.py | 107 ++++++++++++++++
2 files changed, 247 insertions(+)
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-boot.py
create mode 100644 scripts/lib/wic/plugins/source/efibootguard-efi.py

diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
new file mode 100644
index 0000000..8db0620
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
@@ -0,0 +1,140 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Copyright (c) 2014, Intel Corporation.
+# Copyright (c) 2017, Siemens AG.
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# DESCRIPTION
+# This implements the 'efibootguard-boot' source plugin class for 'wic'
new file mode 100644
index 0000000..0ba6b8c
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py
@@ -0,0 +1,107 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Copyright (c) 2014, Intel Corporation.
+# Copyright (c) 2017, Siemens AG.
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# DESCRIPTION
+# This implements the 'efibootguard-efi' source plugin class for 'wic'
+#
+# AUTHORS
+# Tom Zanussi <tom.zanussi (at] linux.intel.com>
+# Claudius Heine <ch (at] denx.de>
+# Andreas Reichel <andreas.reichel (at] tngtech.com>
+
+import os
+import os.path
+import shutil
+
+from wic import msger
+from wic.pluginbase import SourcePlugin
+from wic.utils.misc import get_custom_config
+from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \
+ BOOTDD_EXTRA_SPACE
+
+class EfibootguardEFIPlugin(SourcePlugin):
+ """
+ Create EFI partition.
+ This plugin supports the efibootguard bootloader.
+ """
+
+ name = 'efibootguard-efi'
+
+ @classmethod
+ def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ rootfs_dir, native_sysroot):
+ """
+ Called to do the actual content population for a partition i.e. it
+ 'prepares' the partition to be incorporated into the image.
+ In this case, prepare content for an EFI (grub) boot partition.
+ """
+ if not bootimg_dir:
+ bootimg_dir = get_bitbake_var("HDDDIR")
+ if not bootimg_dir:
+ msger.error("HDDDIR not set, exiting\n")
+ # just so the result notes display it
+ creator.set_bootimg_dir(bootimg_dir)
+
+ staging_kernel_dir = kernel_dir
+
+ hdddir = "%s/hdd/%s.%s" % (cr_workdir, part.label, part.lineno)
+
+ install_cmd = "install -d %s/EFI/BOOT" % hdddir
+ exec_cmd(install_cmd)
+
+ cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir)
+ exec_cmd(cp_cmd, True)
+
+ # Calculate the number of extra blocks to be sure that the
+ # resulting partition image is of the wanted size
+
+ du_cmd = "du -bks %s" % hdddir
+ out = exec_cmd(du_cmd)
+ blocks = int(out.split()[0])
+
+ extra_blocks = part.get_extra_block_count(blocks)
+
+ if extra_blocks < BOOTDD_EXTRA_SPACE:
+ extra_blocks = BOOTDD_EXTRA_SPACE
+
+ blocks += extra_blocks
+
+ msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
+ (extra_blocks, part.mountpoint, blocks))
+
+ # dosfs image, created by mkdosfs
+ efiimg = "%s/%s.%s.img" % (cr_workdir, part.label, part.lineno)
+
+ dosfs_cmd = "mkdosfs -n %s -C %s %d" % (part.label.upper(), efiimg, blocks)
+ exec_native_cmd(dosfs_cmd, native_sysroot)
+
+ mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (efiimg, hdddir)
+ exec_native_cmd(mcopy_cmd, native_sysroot)
+
+ chmod_cmd = "chmod 644 %s" % efiimg
+ exec_cmd(chmod_cmd)
+
+ du_cmd = "du -Lbks %s" % efiimg
+ out = exec_cmd(du_cmd)
+ efiimg_size = out.split()[0]
+
+ part.size = int(efiimg_size)
+ part.source_file = efiimg
--
2.14.1

Andreas J. Reichel

unread,
Sep 7, 2017, 5:06:53 AM9/7/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add bitbake recipe for compilation of
* efibootguard
* efibootguard native environment utilities

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
recipes-bsp/efibootguard/efibootguard.bb | 63 ++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 recipes-bsp/efibootguard/efibootguard.bb

diff --git a/recipes-bsp/efibootguard/efibootguard.bb b/recipes-bsp/efibootguard/efibootguard.bb
new file mode 100644
index 0000000..920c4dd
--- /dev/null
+++ b/recipes-bsp/efibootguard/efibootguard.bb
@@ -0,0 +1,63 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Claudius Heine <c...@denx.de>
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "git://github.com/siemens/efibootguard.git;protocol=https;branch=master"
+SRCREV = "e3263ab8132b8d0be3b1e5513afc4a93f287e9e5"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "gnu-efi pciutils"
+
+inherit autotools deploy

Andreas J. Reichel

unread,
Sep 7, 2017, 5:06:54 AM9/7/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

* Activate busybox watchdog configuration if busybox
is used to have the watchdog binary.
* Install a sysV init script to feed the watchdog.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
recipes-core/busybox/busybox_%.bbappend | 22 ++++++++++++++++++++++
recipes-core/busybox/files/watchdog.cfg | 1 +
recipes-core/busybox/files/watchdog.sh | 17 +++++++++++++++++
3 files changed, 40 insertions(+)
create mode 100644 recipes-core/busybox/busybox_%.bbappend
create mode 100644 recipes-core/busybox/files/watchdog.cfg
create mode 100644 recipes-core/busybox/files/watchdog.sh

diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend
new file mode 100644
index 0000000..8fdb540
--- /dev/null
+++ b/recipes-core/busybox/busybox_%.bbappend
@@ -0,0 +1,22 @@
+# EFI Boot Guard
+#
+# Copyright (c) Siemens AG, 2017
+#
+# Authors:
+# Claudius Heine <c...@denx.de>
+# Andreas Reichel <andreas.r...@siemens.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING.GPLv2 file in the top-level directory.
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://watchdog.cfg \
+ file://watchdog.sh"
+
+do_install_append() {
+ install -d "${D}${sysconfdir}/init.d"
+ install -m 0755 "${WORKDIR}/watchdog.sh" "${D}${sysconfdir}/init.d/watchdog.sh"
+ install -d "${D}${sysconfdir}/rcS.d"
+ ln -sf ../init.d/watchdog.sh "${D}${sysconfdir}/rcS.d/S00watchdog.sh"
+}
diff --git a/recipes-core/busybox/files/watchdog.cfg b/recipes-core/busybox/files/watchdog.cfg
new file mode 100644
index 0000000..80e211d
--- /dev/null
+++ b/recipes-core/busybox/files/watchdog.cfg
@@ -0,0 +1 @@
+CONFIG_WATCHDOG=y
diff --git a/recipes-core/busybox/files/watchdog.sh b/recipes-core/busybox/files/watchdog.sh
new file mode 100644

Andreas J. Reichel

unread,
Sep 7, 2017, 5:06:55 AM9/7/17
to efibootg...@googlegroups.com, Andreas Reichel
From: Andreas Reichel <andreas.r...@siemens.com>

Add ToDo list for integration into yocto projects
Add an example for a .wks file to use efibootguard as boot loader.

Signed-off-by: Andreas Reichel <andreas.r...@siemens.com>
---
README.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 README.md

diff --git a/README.md b/README.md
new file mode 100644

Jan Kiszka

unread,
Sep 7, 2017, 7:27:46 AM9/7/17
to [ext] Andreas J. Reichel, efibootg...@googlegroups.com
Thanks, pushed as master to https://github.com/siemens/meta-efibootguard.

We should probably like to this from efibootguard as well.
Reply all
Reply to author
Forward
0 new messages