boot: serialize downloaded image info for reload#2629
Merged
Conversation
4d8975a to
0e312d3
Compare
Codecov ReportBase: 66.70% // Head: 74.72% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2629 +/- ##
==========================================
+ Coverage 66.70% 74.72% +8.02%
==========================================
Files 111 412 +301
Lines 6436 41641 +35205
==========================================
+ Hits 4293 31118 +26825
- Misses 2143 10523 +8380
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
0e312d3 to
bf044e2
Compare
Member
Author
|
adding a |
hugelgupf
reviewed
Feb 21, 2023
8f8e589 to
ddd03fa
Compare
ddd03fa to
e0dda13
Compare
hugelgupf
reviewed
Feb 22, 2023
ce957a0 to
6b00948
Compare
7fe8ca5 to
306c053
Compare
rminnich
reviewed
Feb 22, 2023
306c053 to
b00f6ce
Compare
hugelgupf
reviewed
Feb 22, 2023
hugelgupf
reviewed
Feb 22, 2023
56bf11c to
c4c039f
Compare
hugelgupf
reviewed
Feb 22, 2023
This is only triggered when we specify to not load
image. Downloaded image info, together with other
configs like cmdline will be saved to a file under
tmpfs, which can be reloaded via kexec cmd.
An example flow looks like
Run /init as init process
1970/01/01 00:00:03 Welcome to u-root!
_
_ _ _ __ ___ ___ | |_
| | | |____| '__/ _ \ / _ \| __|
| |_| |____| | | (_) | (_) | |_
\__,_| |_| \___/ \___/ \__|
/# echo '{ "InitrdPath": "/testdata/initramfs.cpio", "KernelPath": "/testdata/ke
rnel", "Cmdline": "/proc/cmdline", "Name": "testloadconfig" }' > /tmp/linux_i
mage_cfg.json
/# cat /tmp/linux_image_cfg.json
{ "InitrdPath": "/testdata/initramfs.cpio", "KernelPath": "/testdata/kernel", "Cmdline": "/proc/cmdline", "Name": "testloadconfig" }
/# ls /testdata
initramfs.cpio
kernel
/# kexec -d -I /tmp/linux_image_cfg.json
1970/01/01 00:01:25 Load image info from /tmp/linux_image_cfg.json
1970/01/01 00:01:25 read: { "InitrdPath": "/testdata/initramfs.cpio", "KernelPath": "/testdata/kernel", "Cmdline": "/proc/cmdline", "Name": "testloadconfig" }
1970/01/01 00:01:25 Call json.Unmarshal ...
1970/01/01 00:01:25 Start unmarshal
1970/01/01 00:01:25 lliJSON: {Name:testloadconfig KernelPath:/testdata/kernel InitrdPath:/testdata/initramfs.cpio Cmdline:/proc/cmdline LoadSyscall:false KexecOpts:{DTB:<nil> MmapKernel:false MmapRamfs:false}}
1970/01/01 00:01:25 Check lliJSON
1970/01/01 00:01:25 Done json.Marshal...
.
..
1970/01/01 00:01:26 Kernel: /tmp/kexec-image1468578633
1970/01/01 00:01:26 Initrd: /tmp/kexec-image3979801582
1970/01/01 00:01:26 Command line: /proc/cmdline
1970/01/01 00:01:26 KexecOpts: linux.KexecOptions{DTB:io.ReaderAt(nil), MmapKernel:false, MmapRamfs:false}
Booting Linux on physical CPU 0x0000000000 [0x000f0510]
Linux version 5.15.0 (xuehaohu@worldpeace.svl.corp.google.com) (aarch64-linux-gnu-gcc (Debian 12.2.0-3) 12.2.0, GNU ld (GNU Binutils for Debian) 2.39.50.20221208) #2 SMP Tue Feb 21 15:13:11 PST 2023
Machine model: linux,dummy-virt
efi: UEFI not found.
Zone ranges:
DMA [mem 0x0000000040000000-0x00000000ffffffff]
DMA32 empty
Normal [mem 0x0000000100000000-0x000000013fffffff]
NET: Registered PF_INET6 protocol family
...
... (linux booting)
...
Segment Routing with IPv6
In-situ OAM (IOAM) with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered PF_PACKET protocol family
9pnet: Installing 9P2000 support
Freeing initrd memory: 12748K
Freeing unused kernel memory: 960K
Run /init as init process
1970/01/01 00:00:03 Welcome to u-root!
_
_ _ _ __ ___ ___ | |_
| | | |____| '__/ _ \ / _ \| __|
| |_| |____| | | (_) | (_) | |_
\__,_| |_| \___/ \___/ \__|
/# uname -a
Linux (none) 5.15.0 #2 SMP Tue Feb 21 15:13:11 PST 2023 aarch64 (none)
/#
Signed-off-by: David Hu <xuehaohu@google.com>
49cbf74 to
af9065c
Compare
hugelgupf
approved these changes
Feb 22, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is only triggered when we specify to not load image. Downloaded image info, together with other
configs like cmdline will be saved to a file under tmpfs, which can be reloaded via kexec cmd