Commit Graph

103 Commits

Author SHA1 Message Date
Benjamin Gilbert
7bab03e772 Merge pull request #638 from bgilbert/reinject
Add script to inject kernel/GRUB/shim
2017-02-02 17:39:08 -08:00
Benjamin Gilbert
5541e1521e Merge pull request #639 from bgilbert/other-boards
build_image: Correctly disable verity on unsupported boards
2017-02-02 17:18:22 -08:00
Benjamin Gilbert
b11d3a7c1d build_image: Correctly disable verity on unsupported boards
Fixes up missing bit from e630a36e50.
2017-02-02 17:08:01 -08:00
Benjamin Gilbert
e65d5101cf build_image: Extract and upload GRUB/shim EFI images for signing
On arm64, extract only GRUB, since there is no shim.  On dev builds,
extract neither.
2017-02-02 17:00:15 -08:00
Benjamin Gilbert
5443a101f7 build_image: Move one message to logging framework 2017-02-02 16:51:58 -08:00
David Michael
e630a36e50 Revert "build_image: Remove disable_read_write variable"
This reverts commit a7ffba9a9f.

The build_image script can build multiple formats.  When our
releases and automated builds are creating developer containers and
production images from the same command, the verity flag would be
disabled while building the container and remain disabled when building
the production image.  This resulted in no verity in all our builds.
2017-02-02 15:08:43 -08:00
Michael Marineau
74edf63449 Merge pull request #611 from glevand/for-merge-arm64-verity
scripts: Add arm64 verity support
2017-01-30 11:07:21 -08:00
Benjamin Gilbert
e878dc51ea build_image: Include {ignition,bootengine} in {packages,licenses}.txt
They're not in the root fs, but they are in the initramfs.  Handle this
by augmenting the package list with packages that are both

- build dependencies of coreos-kernel, and
- configured to cause rebuilds of coreos-kernel when their sub-slot
  changes.
2017-01-18 16:37:37 -08:00
Geoff Levand
2839b73177 build_image: Add arm64 rootfs verification
Signed-off-by: Geoff Levand <geoff@infradead.org>
2016-12-13 13:46:05 -08:00
Geoff Levand
4ca0c5bc19 build_image: Cleanup enable_rootfs_verification
To clean things up and prepare for arrm64 support move
all the enable_rootfs_verification processing into one
location and add some comments.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2016-12-13 13:46:05 -08:00
Geoff Levand
0ef44633ef build_image: Remove enable_verity flag
To make verity work both enable_rootfs_verification and enable_verity
need to be set.  Without one verity just gets half enabled.  Remove
the enable_verity flag and do the full verity setup when
enable_rootfs_verification is set.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2016-12-13 13:46:05 -08:00
Geoff Levand
a7ffba9a9f build_image: Remove disable_read_write variable
The disable_read_write variable was just a copy of FLAGS_enable_rootfs_verification,
so to make things less confusing just use FLAGS_enable_rootfs_verification.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2016-12-13 13:46:05 -08:00
David Michael
2dfab3fd79 build_library: remove extract_docs()
Since coreos-doc was removed from coreos-overlay, there are no more
files in /usr/share/coreos/doc, causing this function to fail.
2016-11-09 11:44:11 -08:00
Michael Marineau
4ed9a1a2a5 build_image: disable verity again
The Xen loader in GRUB never received support for our hacky scheme of
adding the verity hash to the kernel cmdline. Disable till that's fixed.

Partially reverts 2016567 and 533b1b9.
2016-10-10 14:08:05 -07:00
Michael Marineau
257121f734 Merge pull request #591 from marineam/utf-8
build_image: generate C.UTF-8 locale
2016-10-10 12:39:18 -07:00
Michael Marineau
533b1b9b02 build_image: always enable verity when /usr is read-only
Consolidates two very similar flags into one and fix an issue where
verity could get enabled in the GRUB config when rootfs verification was
turned off (e.g. on arm64 which cannot use verity yet).
2016-09-30 15:35:10 -07:00
Michael Marineau
9ed9ff7b45 build_image: generate C.UTF-8 locale 2016-09-30 15:24:32 -07:00
Michael Marineau
1092afd240 build_image: clean up PCR policy generation
Pass as an argument to finish_image like most other things.
2016-09-19 12:09:47 -07:00
Michael Marineau
300722d7cb build_image: include kernel in --generate_update payloads 2016-09-19 11:41:41 -07:00
Michael Marineau
14eb89a5dc build_image: publish kernel along with base image for generating updates 2016-09-19 11:41:30 -07:00
Michael Marineau
8bfd994f3f Merge pull request #534 from glevand/for-merge-build
build_image: Fix image type conditional
2016-05-10 12:20:07 -07:00
Michael Marineau
4d97d2752d grub_install: use GRUB installed to the board root instead of SDK
Follow up to https://github.com/coreos/coreos-overlay/pull/1950
2016-05-10 12:02:56 -07:00
Geoff Levand
c053521e37 build_image: Fix image type conditional
PROD_IMAGE is a flag that indicates a production image should be
built, and will be set for dev builds if the user specifies that
both dev and prod images should be built.  build_image was
incorrectly using the PROD_IMAGE variable to conditionaly do some
setup depending on the image type.

Add a new variable IMAGE_BUILD_TYPE that can be tested for the type
of image currently being built and replace the PROD_IMAGE usage.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2016-05-03 14:06:14 -07:00
Matthew Garrett
56aa7e5a17 Add support for generating PCR configuration at image build time
We need to ship some PCR measurements alongside images in order to make it
easier for admins to provide an appropriate policy. Add some tooling to
generate the appropriate hashes during build, pack those into a zip file
and upload it.
2016-04-04 14:47:06 -07:00
Michael Marineau
9c529bb6fc check_root: add test for missing interpreters 2016-03-16 11:43:20 -07:00
Michael Marineau
743d4bce37 build_image: Add support for --getbinpkg
Allows build_image to be used without first running build_packages.

Note: setup_board --force is required before build_packages will work
properly after doing this since baselayout won't be installed otherwise.
2016-02-20 14:26:50 -08:00
Michael Marineau
bc5de30442 board_options: new portageq wrappers
- May be sourced early, so explicitly die if source fails.
 - Add a function for getting the latest version of a package.
 - Read PROVIDES metadata using portageq, enabling data to be read from
   binary packages in addition to installed packages. The performance
   issue is not an issue here and needed to support empty build roots.
2016-02-20 14:17:45 -08:00
Michael Marineau
5ba4c7181d *: drop usage of COREOS_VERSION_STRING
This variable was semi-deprecated ages ago so `version.txt` could follow
a similar variable naming pattern to `os-release`. Finally drop usage of
it here in favor of `$COREOS_VERSION`.
2016-02-15 13:55:55 -08:00
Andrej Rosano
16feac5ef6 Add arm64 grub installation support
Add the necessary variables in grub.cfg and populate the EFI
partition with arm64 efi executable and modules.

Signed-off-by: Andrej Rosano <andrej@inversepath.com>
2015-09-16 15:13:08 +02:00
Matthew Garrett
673f166013 Ensure that selinux policy is installed in correct location
Failing to explicitly set the selinux policy store to operate on may
result in semodule installing the policy in an incorrect location. Pass
it on the command line in order to avoid this.
2015-08-24 16:27:18 -07:00
Geoff Levand
3f3b2f2e8c build_image: Run ldconfig in qemu
ldconfig does not work for non-native arches.  Create a new
build_image routine run_ldconfig that uses qemu user emulation
to run the board ldconfig on the board rootfs when the board and
SDK arches are different.

See: http://code.google.com/p/chromium/issues/detail?id=378377

Prior to calling run_ldconfig the board rootfs must have ldconfig
installed.  To arrange this move the call of run_ldconfig to after
the base package install.

Fixes build_image errors like these when building for arm64:

  /sbin/ldconfig: /lib64/libXXX is for unknown machine 183.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2015-08-05 14:47:58 -07:00
Michael Marineau
5985b1e3d6 build_library: replace package checking script
The new python script check_root uses data that portage already
maintains on what shared libraries packages need or provide instead of
re-scanning whatever ELF files that can be found. This is much more
comprehensive but there is a bit of a transition issue for folks with
long-lived SDKs: packages built with portage older than 2.2.18 do not
include this data. As such for now the check is non-fatal and provides a
command you can use to refresh locally installed packages.

The code checking for conflicts between top level directories and /usr
has also been rewritten. Both tests now are considerably faster.
2015-07-12 15:50:58 -07:00
Michael Marineau
9db6ac5ef7 build_image: make building selinux policy optional 2015-07-01 23:11:09 -07:00
George Tankersley
283452e883 verity: add verity plumbing and hash injection to build scripts 2015-07-01 17:34:11 -07:00
Matthew Garrett
14163c3c0a Build selinux policy
Create an selinux policy at image build time - despite the -i flag, this
won't attempt to install it into the running kernel.
2015-06-30 14:46:51 -07:00
Matthew Garrett
07e5220f60 Add the kernels to the ESP
Once we're signing the root filesystem, we're not going to be able to boot
the kernel from there. Copy the kernel out to the EFI System Partition and
sign it.
2015-04-16 15:55:02 -07:00
Michael Marineau
3b8cf7d1fb build_image_util: generate package license list for each image
There isn't a sane way for users to know the licenses of individual
packages in CoreOS images in built images. The information is hidden
away back in the original ebuilds. This extends our existing package
list with a new file that also includes licenses:

```
app-admin/flannel-0.3.0-r3::coreos Apache-2.0
app-admin/fleet-0.9.1::coreos Apache-2.0
app-admin/locksmith-0.2.3::coreos Apache-2.0
app-admin/sdnotify-proxy-0.1.0::coreos Apache-2.0
app-admin/sudo-1.8.10_p2::portage-stable ISC BSD
app-admin/toolbox-0.0.0-r4::coreos Apache-2.0
app-arch/bzip2-1.0.6-r6::portage-stable BZIP2
app-arch/gzip-1.5::portage-stable GPL-3
app-arch/tar-1.27.1-r2::portage-stable GPL-3+
...
```
2015-03-24 18:10:45 -07:00
Alex Crawford
db1f826632 build_library: add extract_docs() 2015-01-16 13:12:21 -08:00
Michael Marineau
d443daa168 grub: the one bootloader to rule them all
This uses our new GRUB2 features to handle GPT priority partition
selection, terminal selection, OEM tweaks, etc. The old SYSLINUX and
PV-GRUB configs are now unused except for maintaining compatibility
with older installs. Of the old configs only the ones that
coreos-postinst copies are needed. The new setup supports using GRUB2
under Xen, giving us automatic fallback support on all of our platforms
for the very first time!

Since grub.cfg is copied into place instead of generated, build_image's
--boot_args option is no longer supported. It could be re-added later
with some sed goo but for now it is easy enough to just edit grub.cfg.
2014-12-05 16:51:11 -08:00
Alex Crawford
f0618ab541 build_library: use jq to parse JSON 2014-10-22 15:19:27 -07:00
Alex Crawford
44520881c7 build_image, image_to_vm: add disk-size assertions
Assert that the image is a multiple of 1 MiB
2014-10-08 21:09:54 -07:00
Michael Marineau
09e720e821 cleanup: remove a couple references to chrome-bot 2014-09-14 14:54:35 -07:00
Michael Marineau
5bfa0c8d20 build: switch from SYSLINUX to GRUB2
The new grub install script must be called after the image is unmounted
and the old bootloaders script doesn't need to touch grub at all. For
now we will continue to use the existing syslinux configs but
interpreted by grub. Beyond the grub menu flashing by during boot
everything should still be functionally equivalent.
2014-09-07 09:58:51 -07:00
Michael Marineau
9580ea4086 build_image_util: fix generation of packages.txt
The passing ROOT= as an environment variable to board wrapper scripts
doesn't work, the script unconditionally overrides it. This means so far
our packages.txt files have listed the contents of /build/amd64-usr
instead of the image. Fix this by calling equery directly instead.
2014-09-04 15:12:20 -07:00
Michael Marineau
3de1613a99 Merge pull request #324 from marineam/grub
Grub2 preview
2014-09-02 10:22:27 -07:00
Michael Marineau
0cc06c9c5c build_image_util: pass the disk image through to configure_bootloaders
Required so that configure_bootloaders can now handle installing the
bootloaders as well.
2014-08-30 16:39:05 -07:00
Michael Marineau
4228c591a8 disk_layout: mount ESP to /boot instead of /boot/efi
We have long since stopped installing anything to the /boot directory of
the root filesystem. Mount the ESP partition to /boot for consistancy
with the discoverable partition spec.
2014-08-29 13:57:42 -07:00
Michael Marineau
8a3a5e1c51 build_image_util: do not symlink etc/portage/profile
Create profile as a real directory instead of a symlink to the board
root's configuration. Normally the board root does not modify this but
it is useful for build_image to use it to modify package.provided.
2014-08-27 19:55:27 -07:00
Michael Marineau
a28a8966e4 build_image: use dev and prod profile variants
Instead of gluing in a special PROD_INSTALL_MASK for all images use
profiles to configure the differences between the base build root,
production images, and developer images. This offers much more
flexibility and is needed for providing a full dev environment in
developer images.
2014-07-19 17:17:28 -07:00
Michael Marineau
4d3c198161 tools: remove support for parallel_emerge
Using parallel_emerge has been disabled by default for all commands
except build_image for quite a while now, build_image kept it just
because it was still a bit faster than normal emerge. Keeping
parallel_emerge complicates future changes to build_image so it needs to
drop it entirely. Since that means nothing uses it by default we might
as well just rip out support for it entirely.
2014-07-19 16:38:17 -07:00