WIP ppl-os building tools
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

40 行
1.8 KiB

CHANNEL=$(shell bash conf-tool.sh read CHANNEL)
ENV=$(shell bash conf-tool.sh read ENV)
ENABLE_SIGNING=$(shell bash conf-tool.sh read ENABLE_SIGNING)
DEVICE_IP=$(shell bash conf-tool.sh read DEVICE_IP)
DEVICE_USERNAME=$(shell bash conf-tool.sh read DEVICE_USERNAME)
DEVICE_PORT=$(shell bash conf-tool.sh read DEVICE_PORT)
USER_KEY=$(shell bash conf-tool.sh read USER_KEY)
USER_EMAIL=$(shell bash conf-tool.sh read USER_EMAIL)
SNAP_BUILD=$(shell bash conf-tool.sh read SNAP_BUILD)
all: .config
bash conf-tool.sh
echo "Please re-run the command"
exit 2
rm -rf *.img *.model *.manifest snaps
%.model: boards/%.yaml # sign a model file
test "$(ENABLE_SIGNING)" = "false" || cat definition.yaml $< | node json2yaml.js | sed "s|TIMESTAMP|$(shell date -Iseconds --utc)|g" | snap sign -k "$(USER_KEY)" > $@
test "$(ENABLE_SIGNING)" = "true" || cp presigned/$* $*.model
presigned/%: %.model
cp $*.model presigned/$*
LC_ALL=C.UTF-8 LANGUAGE=C LANG=C.UTF-8 node build-tool.js --build-backend $(SNAP_BUILD) --env $(ENV) --channel $(CHANNEL) --board $*
.cloud-init.yaml: $(ENV).cloud-init.yaml
cat $(ENV).cloud-init.yaml | USER_EMAIL=$(USER_EMAIL) envsubst > .cloud-init.yaml
%.img: %.model %.snaps .cloud-init.yaml # build an image
sudo ubuntu-image snap -o $@ --cloud-init $(ENV).cloud-init.yaml -c $(CHANNEL) $(shell cat /tmp/snap-files) $<
# VM stuff
vm.img: amd64.img # make a copy of the newest clean image
cp amd64.img vm.img
start: vm.img # launch the image with kvm
kvm -smp 2 -m 1500 -netdev user,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 -device virtio-net-pci,netdev=mynet0 -drive file=vm.img,format=raw
ssh: # ssh into it (don't check the key because that one changes after every rebuild)
ssh $(DEVICE_USERNAME)@$(DEVICE_IP) -p $(DEVICE_PORT) -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null