Skip to content

The Big Merge - Welcome SystemBoot#1255

Merged
hugelgupf merged 137 commits intou-root:masterfrom
hugelgupf:big-merge-3
Jun 19, 2019
Merged

The Big Merge - Welcome SystemBoot#1255
hugelgupf merged 137 commits intou-root:masterfrom
hugelgupf:big-merge-3

Conversation

@hugelgupf
Copy link
Copy Markdown
Member

@hugelgupf hugelgupf commented Jun 19, 2019

Merges the entire http://github.com/systemboot/systemboot repo into u-root, as discussed offline.

Sorry, had to redo this since u-root made some changes at master and merging didn't work for GitHub. (Independent trees are probably not a use case they see often...)

insomniacslk and others added 30 commits April 23, 2018 17:35
Adding .stickler.yml configuration file
Grub2 supports quoting. I have introduced minimal unquoting with this
patch to support dollar-sign for variable expansion.
https://www.gnu.org/software/grub/manual/grub/grub.html#Quoting
Implemented a simple VPD library, using the sysfs interface at /sys/firmware/vpd . See https://chromium.googlesource.com/chromiumos/platform/vpd/ for details.

There are three methods, Get, Set, and GetAll. Unfortunately Set doesn't currently work, because the sysfs interface does not support writing. To write, this library needs a backend able to write to flash chips, like the command line tool flashrom[1] or flashtools[2].

[1] https://www.flashrom.org
[2] https://github.com/osresearch/flashtools
Redesigned to have a TPM interface and TPM1 and TPM2 implementations
created tpm.Info, refactored around it. Fixed potential FD leak
insomniacslk and others added 21 commits April 30, 2019 12:11
Also use Run instead of Start + Wait

Signed-off-by: Andrea Barberio <[email protected]>
fixmynetboot is now part of the netboot workflow. It is called
automatically if netboot fails, if speficied in the VPD variables,
or if `-fix` is passed.

Also corrected error handling logic in checker and restructured command
execution.

Signed-off-by: Andrea Barberio <[email protected]>
localboot: add config flag to select bootconfig
* localboot: add multiboot support

Enables localboot to handle multiboot menu entries using kexeec support
for multiboot

Signed-off-by: Jens Drenhaus <[email protected]>

* review fixes

Signed-off-by: Jens Drenhaus <[email protected]>

* review: rework ScanGrubConfigs

Signed-off-by: Jens Drenhaus <[email protected]>

* fix bootconfig struct tag

Signed-off-by: Jens Drenhaus <[email protected]>

* review: add safeguard to recursive grub.cfg search

Signed-off-by: Jens Drenhaus <[email protected]>

* localboot: add multiboot support

Enables localboot to handle multiboot menu entries using kexeec support
for multiboot

Signed-off-by: Jens Drenhaus <[email protected]>

* initial draft, support for vfat and ext4

Signed-off-by: Jens Drenhaus <[email protected]>

* add config flag to selct bootconfig

Signed-off-by: Jens Drenhaus <[email protected]>

* fix rebase

Signed-off-by: Jens Drenhaus <[email protected]>

* rework bootconfig.go due to new mulitboot interface

Signed-off-by: Jens Drenhaus <[email protected]>

* fix rebase

Signed-off-by: Jens Drenhaus <[email protected]>

* localboot/grub.go: rework fsuuid validation

Signed-off-by: Jens Drenhaus <[email protected]>

* localboot/grub.go: reset kernelBaseDir for every grub menuentry

Signed-off-by: Jens Drenhaus <[email protected]>

* rework measurement of bootconfigs

Signed-off-by: Jens Drenhaus <[email protected]>

* clean up comments

Signed-off-by: Jens Drenhaus <[email protected]>

* crypto: remove TryMeasureBootconfig()

Signed-off-by: Jens Drenhaus <[email protected]>

* storage/blockdev.go: fix PartitionsByFsUUID

Signed-off-by: Jens Drenhaus <[email protected]>
localboot               -> cmds/boot/localboot
netboot                 -> cmds/boot/fbnetboot
uinit                   -> cmds/boot/uinit
cmds/fixmynetboot       -> examples/fixmynetboot
cmds/vpdbootmanager     -> tools/vpdbootmanager

Signed-off-by: Chris Koch <[email protected]>
Signed-off-by: Chris Koch <[email protected]>
The "boot" template just includes all bootloader commands.

The "systemboot" template includes a uinit that automatically does
fbnetboot and localboot.

Signed-off-by: Chris Koch <[email protected]>
if err := cmd.Run(); err != nil {
log.Printf("Error calling fixmynetboot: %v", err)
log.Print("fixmynetboot failed. Check the above output to manually debug the issue.")
os.Exit(1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for later, but we could probably just use log.Fatalf for this sort of case.

if sline[0] == "search" {
for _, str1 := range sline {
if str1 == "--set=root" {
log.Printf("Kernel seems to be on an other partitioin then the grub.cfg file")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for later, fix spelling of partition.

)

// TODO backward compatibility for BIOS mode with partition type 0xee
// TODO use a proper parser for grub config (see grub.go)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a proper grub parser is ... a lot. it's just about a programming language. I would rather argue that we should stick with simple grub, since the inventor of the grub configuration language doesn't like it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we eventually decided to stay with a simple grub parser, it's really too much to handle, especially being a "transition" boot mode

@@ -0,0 +1,47 @@
// Copyright 2017-2019 the u-root Authors. All rights reserved
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably ought to create an 'ansi' package, as this could be more useful than just in here.

"github.com/rekby/gpt"
)

var (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to do: all this needs to be either // +build linux OR variables like this could go into a blockdev_linux.go file

"strconv"
"strings"

"github.com/rekby/gpt"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not the u-root gpt package?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I wrote this before the u-root gpt package (and if not, I probably just didn't see it)

return uuid
}

// GetGPTTable tries to read a GPT table from the block device described by the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT means GUID Partition Table, so GPTTable means ... GUID Partition Table Table :-)

@hugelgupf hugelgupf merged commit 97c9606 into u-root:master Jun 19, 2019
@hugelgupf hugelgupf deleted the big-merge-3 branch October 6, 2020 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.