NiChrome
NiChrome copied to clipboard
how to split usb.go between cloud and local
The NiChrome build assumes an Ubuntu machine; Debian is not close enough. No problem, just open an Ubuntu VM instance on a cloud provider like GCP and build there. It is less than obvious how to then make the usb stick. Here is what worked for me:
on a fresh VM instance: install go1.11.5
NiChrome=$GOPATH/src/github.com/u-root/NiChrome
cd $GOPATH/src
git clone https://github.com/u-root/NiChrome
cd $NiChrome
bash travis.sh
on a local machine: plug in a ChromeOS-formatted USBstick use dmesg to determine device, say /dev/sdb
cd $GOPATH/src/github.com/u-root/u-root/cmds/gpt
upspin cp [email protected]/Public/NiChrome/gpt.go ./gpt.go
go build
sudo ./gpt -r /dev/sdb > config.txt
copy config.txt to the VM instance's $NiChrome
on the VM instance:
cd $NiChrome
vboot_reference/build/futility/futility vbutil_kernel --pack newKern --keyblock vboot_reference/tests/devkeys/recovery_kernel.keyblock --signprivate vboot_reference/tests/devkeys/recovery_kernel_data_key.vbprivk --version 1 --vmlinuz linux-stable/arch/x86/boot/bzImage --bootloader nocontent.efi --config config.txt --arch x86
copy newKern and initramfs.linux_amd64.cpio to local machine
on the local machine: using the same device name as determined earlier
sudo dd if=newKern of=/dev/sdb2 bs=1M
sudo dd if=initramfs.linux_amd64.cpio of=/dev/sdb3 bs=1M