Skip to content

Commit a5f263c

Browse files
committed
Update some clean-up
1 parent 09db0a9 commit a5f263c

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ $(INITRAMFS_FILE): $(CPUD_BINARY) $(UROOT_BIN) $(SSH_PUBLIC_KEY)
158158
@rm -f $(INITRAMFS_DIR)/*
159159
@echo "Building initramfs with u-root..."
160160
@cd $(CPU_REPO) && GOOS=$(GOOS) GOARCH=$(GOARCH) ../../u-root-bin -format=cpio -o ../../initramfs/cpud-initramfs.cpio \
161-
-files "../../binaries/identity.pub:etc/identity.pub" \
161+
-files "../../binaries/identity.pub:key.pub" \
162162
-initcmd="cpud" \
163-
-uinitcmd="cpud -pk /etc/identity.pub" \
164163
./cmds/cpud \
165164
../u-root/cmds/core/ls \
166165
../u-root/cmds/core/ip \

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ sudo ./cpud -pk identity.pub
2121

2222
### On Mac
2323

24+
*NOTE*: You are grabbing a statically linked linux version of these binaries,
25+
you wont be able to run directly on OSX, but you can bind these into a Linux
26+
docker container in order to use them as will be shown below. It is possible
27+
to run cpu directly on the mac, but its utility is diminished when using it
28+
to access Linux so we are sticking to describing using it with containers for
29+
first.
30+
2431
```bash
2532
# Grab pre-built cpu & key
33+
2634
wget https://github.com/ericvh/cpu-prebuilt/releases/download/v0.0.4/cpu
2735
chmod ugo+x cpu
2836
wget https://github.com/ericvh/cpu-prebuilt/releases/download/v0.0.4/identity
@@ -83,8 +91,36 @@ PWD=${PWD/\/Users/\/home} cpu -sp 17010 -key ~/src/test-cpu/identity -namespace
8391
raspberrypi.local /bin/bash
8492
```
8593

86-
# NOTE: All other instructions below this line are currently being tested & debugged
94+
### With qemu on Mac
8795

96+
This requires you to pull your own kernel which is capable of running as a guest
97+
98+
```bash
99+
sudo qemu-system-aarch64 -kernel Image \
100+
-initrd cpud-initramfs.cpio.gz \
101+
--append "init=/init console=ttyAMA0 ip=dhcp" \
102+
-machine virt -cpu cortex-a57 -m 1024M -nographic \
103+
-netdev vmnet-shared,id=n1 -device virtio-net-pci,netdev=n1
104+
```
105+
106+
Then in a different window you can start cpu with docker (or use one of the other methods, but using the native
107+
method won't work as expected because only the builtin commands will be available)
108+
109+
```bash
110+
docker run -i -t -v ${HOME}:${HOME/\Users/\/home} -e PWD=${PWD/\/Users/\/home} \
111+
-v ./identity:/etc/cpu/identity -v ./cpu:/usr/bin/cpu \
112+
ubuntu:latest \
113+
/usr/bin/cpu -nfs -sp 17010 -key /etc/cpu/identity \
114+
-namespace "/lib:/usr:/bin:/home:/etc" \
115+
192.168.64.2 /bin/bash
116+
```
117+
118+
#### Here's the invocation I actually used on my mac
119+
sudo qemu-system-aarch64 -kernel ~/images/Image -initrd ../cpu-prebuilt/build/initramfs/cpud-initramfs.cpio.gz --append "init=/init console=ttyAMA0 ip=dhcp" -machine virt -cpu cortex-a57 -accel hvf -m 1024M -nographic \
120+
-netdev user,id=n1,hostfwd=tcp::17010-:17010 -device virtio-net-pci,netdev=n1
121+
122+
-- but it requires you to know the ip address to use, decpu might work better but we can't do it from docker so that's less useful
123+
88124
## Quick Install (on Linux)
89125

90126
```bash
@@ -122,6 +158,8 @@ curl -fsSL https://raw.githubusercontent.com/ericvh/cpu-prebuilt/main/install.sh
122158
- **Development builds**: Available for every commit
123159
- **90-day retention**: Temporary artifacts for testing
124160

161+
# NOTE: All other instructions below this line are currently being tested & debugged
162+
125163
## Installation Options
126164

127165
### Option 1: Install Script (Easiest)
@@ -188,7 +226,8 @@ qemu-system-aarch64 \
188226
-initrd cpud-initramfs.cpio.gz \
189227
-append "init=/init console=ttyAMA0" \
190228
-machine virt -cpu cortex-a57 -m 1024M -nographic \
191-
-netdev user,id=net0 -device virtio-net-device,netdev=net0
229+
-netdev vmnet-shared \ #,id=net0,hostfwd=tcp:127.0.0.1:17010-:17010,net=192.168.1.0/24,host=192.168.1.1 \
230+
#-device virtio-net-device,netdev=net0
192231

193232
# Physical hardware: copy to /boot and update bootloader
194233
sudo cp cpud-initramfs.cpio.gz /boot/

0 commit comments

Comments
 (0)