Add the apu2

Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
This commit is contained in:
Ronald G Minnich 2020-06-11 14:59:28 -07:00 committed by Ryan O'Leary
parent 0c0410a46e
commit 5b223c5603
8 changed files with 7970 additions and 0 deletions

View File

@ -0,0 +1,150 @@
# This is the makefile for a flash image, a netbootable sshd image,
# and a netbootable cpu image.
#
# sshdkernel produces a kernel with a built-in initramfs for netboot
# It provides (and starts) an sshd, and also has flashrom.
# Hence you can ssh to a node, flashrom -r on it, scp the
# image back, process it, scp the new image to the node, and
# write with flashrom.
# e.g.
# ssh -i class_key -p 2022 board flashrom -r image.bin -p internal
# scp -i class_key -P 2022 board:/image.bin image.bin
# make tiny.bin
# scp -i class_key -P 2022 tiny.bin board:/tiny.bin
# ssh -i class_key -p 2022 board flashrom -w tiny.bin -p internal
#
# The cpu image uses a cpud as its init, and you
# can cpu to it to run commands, including flashrom -p internal
# to flash the flash image.
# e.g.
# cpu board flashrom -r image.bin -p internal
# Note this writes image image.bin to the host directoy; no scp needed
# make tiny.bin
# cpu board flashrom -w tiny.bin -p internal
# cpu is way more convenient than ssh/scp if you can learn it.
# you can also just
# cpu board
# and once you are in:
# flashrom -r image.bin -p internal
# make tiny.bin
# flashrom -w tiny.bin -p internal
# NOTE: those commands are running on the board, and they all work
#
# You can test the flash image kernel with qemu
# make flashtest
default: sshdkernel flashkernel cpukernel
echo you can add any of these targets to the apu2 image.
echo as img/nerf. You can also set priority.
flashtest: testflashkernel
usefultargets:
echo fetch, sshdkernel, flashkernel, cpukernel, etc.
sshdkernel: sshd.cpio.lzma sshd.config
cp sshd.config linux/.config
(cd linux && make oldconfig && make -j32)
cp linux/arch/x86/boot/bzImage $@
cpukernel: cpu.cpio.lzma cpu.config
cp cpu.config linux/.config
(cd linux && make oldconfig && make -j32)
cp linux/arch/x86/boot/bzImage $@
readrom:
echo You need to get a ROM image from *somewhere*
echo Once you do, put it in ROM.bin
writerom: image.bin
echo Here is where you would do the flashrom, e.g.
echo and maybe a cbfstool
echo cbfstool apu2.rom remove -n img/nerf
echo cbfstool apu2.rom add-payload -n img/nerf -f cpukernel
echo sudo flashrom -p internal -w image.bin
flashinitramfs.cpio.lzma: flashinitramfs.cpio
lzma -f -k $<
flashinitramfs.cpio: Makefile
go run github.com/u-root/u-root -o $@ -build=bb \
-uinitcmd=/bbin/pxeboot \
github.com/u-root/u-root/cmds/boot/pxeboot \
github.com/u-root/u-root/cmds/core/cat \
github.com/u-root/u-root/cmds/core/elvish \
github.com/u-root/u-root/cmds/core/init \
github.com/u-root/u-root/cmds/core/ip \
github.com/u-root/u-root/cmds/core/ls \
github.com/u-root/u-root/cmds/core/kexec \
github.com/u-root/u-root/cmds/core/pci \
github.com/u-root/u-root/cmds/core/wget \
# this target builds an initramfs with only one program, the cpu server.
# It depends on the kernel setting the IP address.
# You need ip=dhcp OR ip=fixed.ip.address.here in the command line
cpu.cpio.lzma: Makefile
go run github.com/u-root/u-root -o cpu.cpio -build=bb -initcmd=cpud -files ~/.ssh/cpu_rsa.pub:key.pub \
-defaultsh="" \
github.com/u-root/cpu/cmds/cpud
lzma -f -k cpu.cpio
# this target builds an initramfs with all of u-root, AND all of /bin, /usr/bin, /sbin, /usr/sbin, /etc
# the intent is to demonstrate the capability of http loading.
# It depends on the kernel setting the IP address.
# You need ip=dhcp OR ip=fixed.ip.address.here in the command line
sshd.cpio.lzma: Makefile
go run github.com/u-root/u-root -o sshd.cpio -build=bb \
-uinitcmd=/bbin/sshd \
-files class_key.pub:authorized_keys \
-files classhostkey:id_rsa \
-files /usr/bin/vi \
-files /usr/share/vim \
-files /usr/share/terminfo \
-files /bin/bash \
-files /usr/sbin/flashrom \
-files /usr/bin/xz \
all
lzma -f -k sshd.cpio
ls -l sshd.cpio.*
flashkernel: flash.config flashinitramfs.cpio.lzma Makefile
cp $< linux/.config
(cd linux && make oldconfig && make -j32)
cp linux/arch/x86/boot/bzImage $@
testflashkernel: flashkernel
qemu-system-x86_64 -kernel flashkernel -nographic -serial /dev/tty -initrd flashinitramfs.cpio.lzma
testcpukernel: cpukernel
qemu-system-x86_64 -kernel cpukernel -nographic -serial /dev/tty
# These stanzas fetch code.
fetch: getkernel geturoot getrom
getkernel:
rm -rf linux
git clone --depth=1 -b v5.7 --single-branch https://github.com/torvalds/linux
getrom:
echo you can use flashrom to read the apu2 image.
geturoot:
go get -u github.com/u-root/u-root
go get -u github.com/u-root/cpu/...
# Serve the combined sshd-kernel and sshd-initramfs image. This includes flashrom
sshd-pxeserver:
echo Consider Disabling any system services ...
echo e.g. sudo systemctl stop tftpd-hpa.service
echo e.g. sudo systemctl stop isc-dhcp-server
sudo `go env GOPATH`/bin/pxeserver -tftp-dir . -bootfilename sshdkernel -http-dir . -interface $(NETWORK)
# Serve the combined cpu-kernel and cpu-initramfs image.
cpu-pxeserver:
echo Consider Disabling any system services ...
echo e.g. sudo systemctl stop tftpd-hpa.service
echo e.g. sudo systemctl stop isc-dhcp-server
sudo `go env GOPATH`/bin/pxeserver -tftp-dir . -bootfilename cpukernel -http-dir . -interface $(NETWORK)
ssh:
ssh -i class_key -p 2022 root@up

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA4zGICkjqlAPbYH0MZGN79zDJi88uC1pbc7cUcHQPp8R9iet0
2Q594DiOsJhAc9ALDkVopAmDMew1OO9vwZXAkv00hPhnEHFSXJP31zaoWvQkbS/Z
/Ghl8gTTrPpJo+gJ3kCINwM1Z+IEQbjlE1EsvgKQEWQMCN32cD52F1L0UpkRaRzP
FKKxfMOKYCIIbFDbC1iAAsjuIOunlATy4OT1IbNBhkdX2Mx2kTchaJxry4LL+NDs
sIvfrtMJ/5gmIWKYnc4mXr2ozD4ZvCm7ooEnQshSgXXTpjl1AuEJvnaczr+ij66w
KUQhzK3Ukjo99b8xhih4pVlU661KAbezziyuFwIDAQABAoIBAFbib1s3jXYzj2b0
C5Qss5DR+JHeFobC9GxpXIiw6ffH3harlBEaSKtCFdeVMjjYHBJGGwF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8OpeVvH999PU15g7MFAUdjrd2MCIEWcQ9WjJr0V3sVn4
Nze3kVUWRsXhIoG0yWh6SHbc/HKFhKymtxvdPnbP4qajfcCGIKuIA2c=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjMYgKSOqUA9tgfQxkY3v3MMmLzy4LWltztxRwdA+nxH2J63TZDn3gOI6wmEBz0AsORWikCYMx7DU472/BlcCS/TSE+GcQcVJck/fXNqha9CRtL9n8aGXyBNOs+kmj6AneQIg3AzVn4gRBuOUTUSy+ApARZAwI3fZwPnYXUvRSmRFpHM8UorF8w4pgIghsUNsLWIACyO4g66eUBPLg5PUhs0GGR1fYzHaRNyFonGvLgsv40Oywi9+u0wn/mCYhYpidziZevajMPhm8KbuigSdCyFKBddOmOXUC4Qm+dpzOv6KPrrApRCHMrdSSOj31vzGGKHilWVTrrUoBt7POLK4X rminnich@xcpu

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA20e7SsGzrPyXMosKhgXMbvIPSe27ilhgcWw4I1NWsPMWhYEU
DnM66JiqImyN3tTiimwH7WewKxy4opGLbk2ohYvNQBALNXNr1cV7usAQREAIbafp
zZ6mO0gcWjrdsN31aTzMmEXO3dkS+wtEQzKBe/eFjlJbutHvEQkvYWtPeHTtBlVy
wcJEc59orcE+HNXrXLcPuJZF37Z5HkEMNGDWvAutHmnXc3C0cKd+bOdhpTx7DAaW
Fmj1GdL7WMPBQk1qKo4uE8lqOjTB5qwCGhWPtZFgD6QwYIKtZ/VFWMzUytc6ciRw
b5ob6+0+mbL3IFb1XZDbOC3gSbGPV4V0xZrVtwIDAQABAoIBABlIF+vykUishrIp
Hbl+Cafw+JpJconszpHFLGPGRAR6wmn6C9nupygSEeuOIH1Ehin3cqKIheMymIcF
yNGa2ocrKyrrrp8nA5POBQnvAvEbgN1Dss0mMXw8QCiXCOBPdu//NoeH5OXnFS0k
i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7He/fPqjM4DIi+PvfpAl/ZUXdD/48=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbR7tKwbOs/JcyiwqGBcxu8g9J7buKWGBxbDgjU1aw8xaFgRQOczromKoibI3e1OKKbAftZ7ArHLiikYtuTaiFi81AEAs1c2vVxXu6wBBEQAhtp+nNnqY7SBxaOt2w3fVpPMyYRc7d2RL7C0RDMoF794WOUlu60e8RCS9ha094dO0GVXLBwkRzn2itwT4c1etctw+4lkXftnkeQQw0YNa8C60eaddzcLRwp35s52GlPHsMBpYWaPUZ0vtYw8FCTWoqji4TyWo6NMHmrAIaFY+1kWAPpDBggq1n9UVYzNTK1zpyJHBvmhvr7T6ZsvcgVvVdkNs4LeBJsY9XhXTFmtW3 rminnich@xcpu

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff