Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tools/labs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ copy: $(YOCTO_IMAGE)
sudo umount $(TEMPDIR)
rmdir $(TEMPDIR)

scp:
if [ ! -e qemu.mon ]; then exit 1; fi
IP=$$(qemu/get_vm_ip.sh); \
if [ -z "$$IP" ]; then exit 1; fi; \
modules=$$(find skels -type f \( -name *.ko -or -executable \)); \
echo -n $$modules | xargs -d ' ' --no-run-if-empty dirname | xargs ssh root@$$IP mkdir -p || true; \
echo -n $$modules | xargs -d ' ' -I _ --no-run-if-empty scp _ root@$$IP:_ || true; \
checkers=$$(find skels -type d \( -name checker \)); \
echo -n $$checkers | xargs -d ' ' --no-run-if-empty dirname | xargs ssh root@$$IP mkdir -p || true; \
echo -n $$checkers | xargs -d ' ' -I _ --no-run-if-empty scp -r _ root@$$IP:_ || true

ssh:
if [ ! -e qemu.mon ]; then exit 1; fi
IP=$$(qemu/get_vm_ip.sh); \
if [ -z "$$IP" ]; then exit 1; fi; \
ssh root@$$IP

ip:
qemu/get_vm_ip.sh

docker-docs:
cd docker && docker-compose build docs-build
cd docker && UID=$(shell id -u) GID=$(shell id -g) docker-compose run docs-build bash -c "cd /linux/tools/labs && make docs"
Expand All @@ -57,4 +77,4 @@ clean::
clean_skels:
rm -rf skels

.PHONY: skels build copy docs docker-docs docker-kernel stop-docker-kernel clean clean_skels
.PHONY: skels build copy scp ssh ip docs docker-docs docker-kernel stop-docker-kernel clean clean_skels
9 changes: 9 additions & 0 deletions tools/labs/qemu/get_vm_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

GUEST_IP=$(arp -n -i tap0 | tail -1 | cut -d ' ' -f 1)
while [ "$GUEST_IP" = "arp:" ]; do
sleep 1
GUEST_IP=$(arp -e -n -i tap0 | tail -1 | cut -d ' ' -f 1)
done

echo $GUEST_IP