From b2ec0613d0deeb4ffc51c0c175b1158ad21261ba Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Tue, 11 Aug 2020 23:04:50 +0800 Subject: [PATCH 1/5] add comment for common commands begin Signed-off-by: Wu Zhangjin --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 4d89af1..8f04cdf 100644 --- a/Makefile +++ b/Makefile @@ -426,6 +426,7 @@ ifeq ($(findstring -run,$(first_target)),-run) x := $(APP_ARGS) endif +# common commands ifneq ($(filter $(first_target),$(APP_TARGETS)),) # use the rest as arguments for "run" APP_ARGS := $(filter-out $(first_target),$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))) -- Gitee From 0da8e777537f328028f95d61eefe63d74c2543c6 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 12 Aug 2020 01:15:34 +0800 Subject: [PATCH 2/5] gdb: uboot: fix up commands in .gdb/uboot.default Signed-off-by: Wu Zhangjin --- .gdb/uboot.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gdb/uboot.default b/.gdb/uboot.default index 412ce59..6d1e76b 100644 --- a/.gdb/uboot.default +++ b/.gdb/uboot.default @@ -1,6 +1,6 @@ shell echo "Waiting for 1 secs..." shell sleep 1 -shell echo"Executing gdb commands in local .gdbinit ..." +shell echo "Executing gdb commands in local .gdbinit ..." shell echo "(gdb) target remote :1234" target remote :1234 -- Gitee From b8d96a7d4f3daf58228c8d7c9e65c3d17c58ebcb Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 12 Aug 2020 01:23:58 +0800 Subject: [PATCH 3/5] debug: easier debugging while login with bash Signed-off-by: Wu Zhangjin --- Makefile | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8f04cdf..a487985 100644 --- a/Makefile +++ b/Makefile @@ -446,7 +446,7 @@ ifneq ($$($(2)),) override app += $(1) endif -endef +endef #default_detectapp ifneq ($(APP_ARGS),) APP := $(firstword $(APP_ARGS)) @@ -3053,8 +3053,14 @@ endif EMULATOR_OPTS ?= -M $(MACH) -m $(call _v,MEM,LINUX) $(NET) -smp $(call _v,SMP,LINUX) $(KERNEL_OPT) $(EXIT_ACTION) EMULATOR_OPTS += $(SHARE_OPT) +# Debug listen on a unqiue port, should run exclusively +ifneq ($(DEBUG),0) + DEBUG_LOCK := $(GDBINIT_DIR)/.lock + KEEP_UNIQUE := flock -n -x $(DEBUG_LOCK) +endif + # Launch Qemu, prefer our own instead of the prebuilt one -BOOT_CMD := sudo $(EMULATOR) $(EMULATOR_OPTS) +BOOT_CMD := $(KEEP_UNIQUE) sudo $(EMULATOR) $(EMULATOR_OPTS) ifeq ($(U),1) ifeq ($(SD_BOOT),1) @@ -3408,7 +3414,11 @@ endif ifeq ($(XTERM_STATUS), 0) DEBUG_CMD := $(XTERM_CMD) else - DEBUG_CMD := $(Q)echo "\nLOG: Please run this in another terminal:\n\n " $(GDB_CMD) "\n" + DEBUG_CMD := $(Q)sleep 0.1 && echo "\nLOG: debug server started, please connect it with these commands:\n\n" \ + " (host) $$ cd /path/to/cloud-lab\n" \ + " (host) $$ tools/docker/bash linux-lab\n" \ + " ubuntu@linux-lab:/labs/linux-lab$$ make $(MAKECMDGOALS)\n" + #DEBUG_CMD := $(Q)echo "\nLOG: Please run this in another terminal:\n\n " $(GDB_CMD) "\n" endif # FIXME: gdb not continue the commands in .gdbinit while runing with 'CASE=debug tools/testing/run.sh' @@ -3429,7 +3439,10 @@ ifneq ($(TEST_TIMEOUT),0) else DEBUG_INIT := _debug_init_1 endif -DEBUG_CLIENT := $(DEBUG_DEPS) $(DEBUG_INIT) _debug + +ifeq ($(shell pgrep flock >/dev/null; echo $$?), 1) + DEBUG_CLIENT := $(DEBUG_DEPS) $(DEBUG_INIT) _debug +endif PHONY += _debug _debug_init_1 _debug_init_2 @@ -3446,8 +3459,14 @@ _BOOT_DEPS += $(UBOOT_IMGS) _BOOT_DEPS += $(DEBUG_CLIENT) _BOOT_DEPS += $(BOOT_DTB) +ifneq ($(DEBUG),0) + RUN_BOOT_CMD := $(BOOT_CMD) || $(GDB_CMD) +else + RUN_BOOT_CMD := $(BOOT_CMD) +endif + _boot: $(_BOOT_DEPS) - $(BOOT_CMD) + $(RUN_BOOT_CMD) PHONY += boot-test _boot -- Gitee From 94bd26f79fd8133cb3ffe15da2f7029b99f40e20 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 12 Aug 2020 23:50:20 +0800 Subject: [PATCH 4/5] README: tell users how to choose the docker mirror site Signed-off-by: Wu Zhangjin --- README.md | 6 +++--- README_zh.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ffe9563..8b05290 100644 --- a/README.md +++ b/README.md @@ -254,14 +254,14 @@ Docker is required by Linux Lab, please install it at first: Install Ubuntu via Virtualbox or Vmware Virtual Machine -Before running Linux Lab, please make sure the following command works without sudo and without any issue: +Before running Linux Lab, please refer to section 6.1.4 and make sure the following command works without sudo and without any issue: $ docker run hello-world In China, to use docker service normally, please **must** configure one of chinese docker mirror sites, for example: - * [Aliyun Docker Mirror Documentation](https://help.aliyun.com/document_detail/60750.html) - * [USTC Docker Mirror Documentation](https://lug.ustc.edu.cn/wiki/mirrors/help/docker) + * [Aliyun Docker Mirror Documentation](https://help.aliyun.com/document_detail/60750.html)(For non Univerisity) + * [USTC Docker Mirror Documentation](https://lug.ustc.edu.cn/wiki/mirrors/help/docker)(For Univerisity) More docker related issues, such as download slowly, download timeout and download errors, are cleary documented in the 6.1 section of FAQs. diff --git a/README_zh.md b/README_zh.md index 436a589..2f9c2be 100644 --- a/README_zh.md +++ b/README_zh.md @@ -319,14 +319,14 @@ Linux Lab 是一套完备的嵌入式 Linux 开发环境,需要预留足够的 通过 Virtualbox 或 Vmware 安装 Ubuntu 后使用 -在运行 Linux Lab 之前,请确保无需 `sudo` 权限也可以正常运行以下命令: +在运行 Linux Lab 之前,请参考 6.1.4 节确保无需 `sudo` 权限也可以正常运行以下命令: $ docker run hello-world 另外,在国内要正常使用 Docker,请**务必**配置好国内的 Docker 镜像加速服务: - * [阿里云 Docker 镜像使用文档](https://help.aliyun.com/document_detail/60750.html) - * [USTC Docker 镜像使用文档](https://lug.ustc.edu.cn/wiki/mirrors/help/docker) + * [阿里云 Docker 镜像使用文档](https://help.aliyun.com/document_detail/60750.html)(适合企业和家庭网络) + * [USTC Docker 镜像使用文档](https://lug.ustc.edu.cn/wiki/mirrors/help/docker)(适合高校网络) 使用 Linux Lab 过程中的常见 Docker 相关问题,请参考常见问题中的 6.1 节,镜像下载慢、下载超时、下载出错等问题都有详细解决方案。 -- Gitee From a1ee958d58115aef1210631ddc82c43842efbfbc Mon Sep 17 00:00:00 2001 From: taotieren Date: Thu, 13 Aug 2020 14:10:22 +0800 Subject: [PATCH 5/5] Update Arch/Manjaro docker systemd config --- doc/install/arch-docker.md | 5 +++++ doc/install/manjaro-docker.md | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/doc/install/arch-docker.md b/doc/install/arch-docker.md index fac424b..3dd6597 100644 --- a/doc/install/arch-docker.md +++ b/doc/install/arch-docker.md @@ -90,6 +90,11 @@ "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] } + 使用 `systemd` 用户可以通过执行 `sudo systemctl edit docker.service` 来修改设置, 覆盖默认的启动参数: + + [Service] + ExecStart= + ExecStart=/usr/bin/docker -d -H fd:// --registry-mirror=https://docker.mirrors.ustc.edu.cn 配置完成之后执行如下命令重新启动服务生效。 diff --git a/doc/install/manjaro-docker.md b/doc/install/manjaro-docker.md index a70ea20..f023ec1 100644 --- a/doc/install/manjaro-docker.md +++ b/doc/install/manjaro-docker.md @@ -95,6 +95,11 @@ Manjaro Linux 设置国内镜像站: "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] } + 使用 `systemd` 用户可以通过执行 `sudo systemctl edit docker.service` 来修改设置, 覆盖默认的启动参数: + + [Service] + ExecStart= + ExecStart=/usr/bin/docker -d -H fd:// --registry-mirror=https://docker.mirrors.ustc.edu.cn 配置完成之后执行如下命令重新启动服务生效。 -- Gitee