cros_bundle_firmware: Allow sending a kernel over USB
When all you want to do is test a new kernel, it is convenient to be
able to send it over USB. This avoids the other slower options, like
1)
./build_packages --board daisy
./build_image --board daisy test
./image_to_usb ...
(put SD card in machine and boot)
2)
cros_workon_make --board daisy chromeos-kernel
./build_image --board daisy test
./image_to_usb ...
(put SD card in machine and boot)
3)
FEATURES=noclean cros_workon_make chromeos-kernel --install
(ssh to copy kernel to machine over network, or perhaps better
update_kernel.sh)
It is most similar to:
4)
cros_workon_make --board daisy chromeos-kernel
(reset board with network adaptor in USB, and have it pick up the
kernel using tftp or nfs)
but of course you can't easily fiddle with firmware with that path.
To use it on daisy, try:
cros_bundle_firmware -b daisy ---kernel /build/daisy/boot/vmlinux.uimg
or similar. It will reset the board, download U-Boot and the kernel,
then start U-Boot, setting the kernaddr environment variable so that the
scripts will substitute the downloaded kernel for the one that is loaded
through normal means.
BUG=chromium-os:32386
TEST=manual:
cros_bundle_firmware -b daisy ---kernel /build/daisy/boot/vmlinux.uimg
-d exynos5250-snow
on a snow and see that it boots U-Boot and then picks up the latest
kernel, ignoring the one on the machine.
Change-Id: I36f229aa1d55c8c6859fc7f62b4a9443e7d6c924
Reviewed-on: https://gerrit.chromium.org/gerrit/26792
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 4aa4123..ad8d803 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -116,7 +116,7 @@
def SetFiles(self, board, bct, uboot=None, bmpblk=None, coreboot=None,
postload=None, seabios=None, exynos_bl1=None, exynos_bl2=None,
- skeleton=None, ecbin=None):
+ skeleton=None, ecbin=None, kernel=None):
"""Set up files required for Bundle.
Args:
@@ -131,6 +131,7 @@
exynos_bl2: The filename of the exynos BL2 file (U-Boot spl)
skeleton: The filename of the coreboot skeleton file.
ecbin: The filename of the EC (Embedded Controller) file.
+ kernel: The filename of the kernel file if any.
"""
self._board = board
self.uboot_fname = uboot
@@ -143,6 +144,7 @@
self.exynos_bl2 = exynos_bl2
self.skeleton_fname = skeleton
self.ecbin_fname = ecbin
+ self.kernel_fname = kernel
def SetOptions(self, small):
"""Set up options supported by Bundle.
@@ -779,6 +781,10 @@
pack.AddProperty('skeleton', self.skeleton_fname)
pack.AddProperty('dtb', fdt.fname)
+ # If we are writing a kernel, add its offset from TEXT_BASE to the fdt.
+ if self.kernel_fname:
+ fdt.PutInteger('/config', 'kernel-offset', pack.image_size)
+
# Make a copy of the fdt for the bootstub
fdt_data = self._tools.ReadFile(fdt.fname)
uboot_data = self._tools.ReadFile(self.uboot_fname)