From 40d82945ab81ac83ffac77f0730bad5f5c6aa84e Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sun, 13 Sep 2020 11:57:14 +0800 Subject: [PATCH 01/22] PHONE: add APPS with _ prefix Signed-off-by: Wu Zhangjin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f1e5f41..26e9c8f 100644 --- a/Makefile +++ b/Makefile @@ -3568,7 +3568,7 @@ endif PHONY += $(APP_TARGETS) endif -PHONY += $(APPS) +PHONY += $(APPS) $(patsubst %,_%,$(APPS)) # Allow cleanstamp and run a target force-%: -- Gitee From 41a0cc8e37bc9228eed08afa7c0126688ee0edc8 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sun, 13 Sep 2020 11:57:54 +0800 Subject: [PATCH 02/22] mips64el/ls3a7a: README: fix up directory name Signed-off-by: Wu Zhangjin --- boards/mips64el/ls3a7a/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/mips64el/ls3a7a/README.md b/boards/mips64el/ls3a7a/README.md index e3bbf71..cf9e433 100644 --- a/boards/mips64el/ls3a7a/README.md +++ b/boards/mips64el/ls3a7a/README.md @@ -51,10 +51,10 @@ Both of boot and network are ok with loongnix linux kernel: [git://cgit.loongnix $ cd /path/to/linux-lab/src/ $ ls tinylab-loongson-linux-v3.10-release-1903.zip - Decompress the zip package and check if the directory: `loongnix-linux-3.10` generated: + Decompress the zip package and rename it to `loongnix-linux-3.10`: $ unzip tinylab-loongson-linux-v3.10-release-1903.zip - $ ls loongnix-linux-3.10 + $ mv loongson-linux-3.10 loongnix-linux-3.10 Enter into the kernel source directory, init it as a git repository: @@ -69,6 +69,6 @@ Both of boot and network are ok with loongnix linux kernel: [git://cgit.loongnix Ignore the kernel download step: - $ make kernel-download -t + $ make source kernel -t That's all. -- Gitee From 04a656e6f0e2ab7f0b3506bcaa6e831f000dbb81 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sun, 13 Sep 2020 12:21:32 +0800 Subject: [PATCH 03/22] build: touch timestamp anyway Avoid re-build for the targets(e.g. debug) depends on build. Reported-by: unicornx Signed-off-by: Wu Zhangjin --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 26e9c8f..92657ae 100644 --- a/Makefile +++ b/Makefile @@ -1372,6 +1372,7 @@ endif # Force app building for current building targets can not auto detect code update ifeq ($(filter $(first_target),$(1) $(1)-build build), $(first_target)) $(1)-build: _$(1) + $$(Q)touch $$(call __stamp_$(1),build) else $(1)-build: $$(call __stamp_$(1),build) endif -- Gitee From c67640fb2cbe9e64bbfa4f3fa2189112c6eea922 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sun, 13 Sep 2020 17:53:36 +0800 Subject: [PATCH 04/22] mips64el/ls3a7a: buildroot: upgrade to 2020.08 Signed-off-by: Wu Zhangjin --- boards/mips64el/ls3a7a/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/mips64el/ls3a7a/Makefile b/boards/mips64el/ls3a7a/Makefile index f7aecea..6836e8c 100644 --- a/boards/mips64el/ls3a7a/Makefile +++ b/boards/mips64el/ls3a7a/Makefile @@ -3,7 +3,7 @@ _BASE = 1 ARCH = mips XARCH = mips64el CPU ?= mips64r2 -BUILDROOT?= 2016.05 +BUILDROOT?= 2020.08 MEM ?= 1024M SERIAL ?= ttyS0 -- Gitee From f77cf5b01bff169012d2f687fc4180ec58af1645 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Tue, 15 Sep 2020 00:39:04 +0800 Subject: [PATCH 05/22] README: document the rootfs error FIXME: This error must be fixed up with code change, `CTRL+C` should be stopped during the creating of rootfs directory, ramdisk and harddisk, but there is no such support in Makefile?! Reported-by: unicornx Signed-off-by: Wu Zhangjin --- README.md | 9 +++++++++ README_zh.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index a2e3343..9c2c973 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ - [6.4.5 unable to create file: net/netfilter/xt_dscp.c](#645-unable-to-create-file-netnetfilterxt_dscpc) - [6.4.6 how to run as root](#646-how-to-run-as-root) - [6.4.7 not in supported list](#647-not-in-supported-list) + - [6.4.8 is not a valid rootfs directory](#648-is-not-a-valid-rootfs-directory) - [7. Contact and Sponsor](#7-contact-and-sponsor) @@ -2174,6 +2175,14 @@ There are two main types: * This board may not support such type of device or just nobody verify and add it * This differs from board and kernel version +### 6.4.8 is not a valid rootfs directory + +If using prebuilt filesystem, this error means the rootfs dir, ramdisk or harddisk creating procedure has been interrupted by `CTRL+C` or similar operations and it means the filesystem is not complete. If no important changes in BSP repository, reset it may help: + + $ make bsp-cleanup + +If using external filesystem, please make sure the filesystem architecture follows the Linux standards. + # 7. Contact and Sponsor Our contact wechat is **tinylab**, welcome to join our user & developer discussion group. diff --git a/README_zh.md b/README_zh.md index f360063..1ee782a 100644 --- a/README_zh.md +++ b/README_zh.md @@ -126,6 +126,7 @@ - [6.4.5 unable to create file: net/netfilter/xt_dscp.c](#645-unable-to-create-file-netnetfilterxt_dscpc) - [6.4.6 如何切到 root 用户](#646-如何切到-root-用户) - [6.4.7 提示指定的版本或者配置不存在](#647-提示指定的版本或者配置不存在) + - [6.4.8 is not a valid rootfs directory](#648-is-not-a-valid-rootfs-directory) - [7. 联系并赞助我们](#7-联系并赞助我们) @@ -2247,6 +2248,14 @@ Web 连接可能由于某些未知原因而挂起,导致 Linux Lab 有时可 * vda 可能根本不支持或者需要重新配置内核后才支持 * 这个因板子和内核版本而异,需要具体对待 +### 6.4.8 is not a valid rootfs directory + +如果当前使用的是预制文件系统,说明操作过程中可能有类似 `CTRL+C` 中断了正常根文件系统目录、Ramdisk 或 Hardisk 镜像的创建过程,导致文件系统不完整,在确保 BSP 目录无其他紧要修改的情况下,可以通过如下命令恢复 BSP 仓库为默认设置: + + $ make bsp-cleanup + +如果当前使用的是用户自己构建的文件系统,请确保文件系统符合 Linux 的规范,确保相关的基础目录均存在。 + # 7. 联系并赞助我们 我们的联系微信是 **tinylab**,欢迎加入 Linux Lab 的用户和开发人员讨论组。 -- Gitee From 0422bc3681b978afb31d5fba477faf824e32e7ed Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Tue, 15 Sep 2020 01:46:29 +0800 Subject: [PATCH 06/22] root: use intermediate files to work with ctrl+c ref: https://www.gnu.org/software/make/manual/html_node/Interrupts.html https://stackoverflow.com/questions/56610536/how-to-trap-exit-ctrlc-signal-in-makefile .INTERMEDIATE target doesn't work with directories, use tmp files instead. The only side effect is while ctrl+c happen, .tmp will be created, but will be cleaned up next time or with `git clean -fdx`. Signed-off-by: Wu Zhangjin --- Makefile | 22 ++++++++++++++++++---- tools/root/rd2hd.sh | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 92657ae..cd8a7cf 100644 --- a/Makefile +++ b/Makefile @@ -2043,7 +2043,9 @@ root-rd: root-rd-rebuild: FORCE @echo "LOG: Generating ramdisk image with $(ROOT_GENRD_TOOL) ..." - ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) USER=$(USER) $(ROOT_GENRD_TOOL) + $(Q)rm -rf $(IROOTFS).tmp + $(Q)ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS).tmp USER=$(USER) $(ROOT_GENRD_TOOL) + $(Q)mv $(IROOTFS).tmp $(IROOTFS) ROOT_GENDISK_TOOL := $(TOOL_DIR)/root/dir2$(DEV_TYPE).sh @@ -2051,11 +2053,19 @@ ifeq ($(prebuilt_root_dir), 1) ROOT_DIR := root-dir endif +ifeq ($(DEV_TYPE),rd) + XROOTFS := $(IROOTFS) +else + XROOTFS := $(HROOTFS) +endif + # This is used to repackage the updated root directory, for example, `make r-i` just executed. root-rebuild: $(ROOT_DIR) ifeq ($(prebuilt_root_dir), 1) @echo "LOG: Generating $(DEV_TYPE) with $(ROOT_GENDISK_TOOL) ..." - ROOTDIR=$(ROOTDIR) INITRD=$(IROOTFS) HROOTFS=$(HROOTFS) FSTYPE=$(FSTYPE) USER=$(USER) $(ROOT_GENDISK_TOOL) + $(Q)rm -rf $(XROOTFS).tmp + $(Q)ROOTDIR=$(ROOTDIR) INITRD=$(IROOTFS).tmp HROOTFS=$(HROOTFS).tmp FSTYPE=$(FSTYPE) USER=$(USER) $(ROOT_GENDISK_TOOL) + $(Q)if [ -f $(XROOTFS).tmp ]; then mv $(XROOTFS).tmp $(XROOTFS); fi $(Q)if [ $(build_root_uboot) -eq 1 ]; then make $(S) _root-ud-rebuild; fi else $(call make_root) @@ -2102,7 +2112,9 @@ root-dir-rebuild: rootdir rootdir: ifneq ($(ROOTDIR), $(BUILDROOT_ROOTDIR)) @echo "LOG: Generating rootfs directory with $(ROOT_GENDIR_TOOL) ..." - ROOTDIR=$(ROOTDIR) USER=$(USER) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) $(ROOT_GENDIR_TOOL) + $(Q)rm -rf $(ROOTDIR).tmp + $(Q)ROOTDIR=$(ROOTDIR).tmp USER=$(USER) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) $(ROOT_GENDIR_TOOL) + $(Q)mv $(ROOTDIR).tmp $(ROOTDIR) endif rootdir-install: root-install @@ -2126,7 +2138,9 @@ root-hd: root-hd-rebuild: FORCE @echo "LOG: Generating harddisk image with $(ROOT_GENHD_TOOL) ..." - ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) $(ROOT_GENHD_TOOL) + $(Q)rm -rf $(HROOTFS).tmp + $(Q)ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS).tmp INITRD=$(IROOTFS) $(ROOT_GENHD_TOOL) + $(Q)mv $(HROOTFS).tmp $(HROOTFS) PHONY += root-hd root-hd-rebuild diff --git a/tools/root/rd2hd.sh b/tools/root/rd2hd.sh index a54d21a..2877219 100755 --- a/tools/root/rd2hd.sh +++ b/tools/root/rd2hd.sh @@ -17,7 +17,7 @@ [ -z "${USER}" ] && USER=$(whoami) -ROOTDIR=$(echo ${HROOTFS} | sed -e "s%.${FSTYPE}%%g") +ROOTDIR=$(echo ${HROOTFS} | sed -e "s%.${FSTYPE}.*%%g") FS_CPIO_GZ=${ROOTDIR}.cpio.gz FS_CPIO=${ROOTDIR}.cpio -- Gitee From 479efc857d1fdc65924bc2ea27e8ce890be0e1e1 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 16 Sep 2020 01:32:01 +0800 Subject: [PATCH 07/22] README: modules target works as alias of module target Use modules instead of module, if no options specified, modules means default kernel modules target. Signed-off-by: Wu Zhangjin --- README.md | 16 ++++++++-------- README_zh.md | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9c2c973..20f8078 100644 --- a/README.md +++ b/README.md @@ -977,13 +977,13 @@ Build all internel kernel modules: List available modules in `src/modules/`, `boards//bsp/modules/`: - $ make module-list + $ make modules-list If `m` argument specified, list available modules in `src/modules/`, `boards//bsp/modules/` and `src/linux-stable/`: - $ make module-list m=hello + $ make modules-list m=hello 1 m=hello ; M=$PWD/modules/hello - $ make module-list m=tun,minix + $ make modules-list m=tun,minix 1 c=TUN ; m=tun ; M=drivers/net 2 c=MINIX_FS ; m=minix ; M=fs/minix @@ -1003,14 +1003,14 @@ Enable one kernel module: Build one kernel module (e.g. minix.ko): - $ make module M=fs/minix/ + $ make modules M=fs/minix/ Or - $ make module m=minix + $ make modules m=minix Install and clean the module: - $ make module-install M=fs/minix/ - $ make module-clean M=fs/minix/ + $ make modules-install M=fs/minix/ + $ make modules-clean M=fs/minix/ More flexible usage: @@ -1021,7 +1021,7 @@ More flexible usage: Build external kernel modules (the same as internel modules): - $ make module m=hello + $ make modules m=hello Or $ make kernel x=$PWD/modules/hello/hello.ko diff --git a/README_zh.md b/README_zh.md index 1ee782a..4f0eb4c 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1053,13 +1053,13 @@ Linux 内核提供了一个脚本 `scripts/config`,可用于非交互方式获 列出 `src/modules/` 和 `boards//bsp/modules/` 路径下的所有模块: - $ make module-list + $ make modules-list 如果加上 `m` 参数,除了列出 `src/modules/` 和 `boards//bsp/modules/` 路径下的所有模块外,还会列出 `src/linux-stable/` 下的所有模块: - $ make module-list m=hello + $ make modules-list m=hello 1 m=hello ; M=$PWD/modules/hello - $ make module-list m=tun,minix + $ make modules-list m=tun,minix 1 c=TUN ; m=tun ; M=drivers/net 2 c=MINIX_FS ; m=minix ; M=fs/minix @@ -1079,14 +1079,14 @@ Linux 内核提供了一个脚本 `scripts/config`,可用于非交互方式获 编译一个内核模块(例如:minix.ko) - $ make module M=fs/minix/ + $ make modules M=fs/minix/ 或 - $ make module m=minix + $ make modules m=minix 安装和清理模块: - $ make module-install M=fs/minix/ - $ make module-clean M=fs/minix/ + $ make modules-install M=fs/minix/ + $ make modules-clean M=fs/minix/ 其他用法: @@ -1097,7 +1097,7 @@ Linux 内核提供了一个脚本 `scripts/config`,可用于非交互方式获 编译外部内核模块(类似编译内部模块): - $ make module m=hello + $ make modules m=hello 或 $ make kernel x=$PWD/src/modules/hello/hello.ko -- Gitee From 078b68119ab958840d8b8bb509cc202f8cc3e046 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 16 Sep 2020 16:57:52 +0800 Subject: [PATCH 08/22] .gitignore: ignore .tmp files Signed-off-by: Wu Zhangjin --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 542cc2e..532755c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ loongnix-3.10 tglx-linux-history force-* .lock +.tmp -- Gitee From 56ee883032c0ba38e86bd85be2db25791c00f36c Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 16 Sep 2020 17:03:31 +0800 Subject: [PATCH 09/22] bsp: checkout after cleanstamp Signed-off-by: Wu Zhangjin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cd8a7cf..d0b57b6 100644 --- a/Makefile +++ b/Makefile @@ -1702,7 +1702,7 @@ else endif ifeq ($(firstword $(MAKECMDGOALS)),bsp) -bsp: force-bsp-checkout +bsp: bsp-cleanstamp bsp-checkout PHONY += bsp endif -- Gitee From daab4eb17fc10a7b7eab0bc5a631b9dff214463f Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sun, 13 Sep 2020 12:21:32 +0800 Subject: [PATCH 10/22] build: touch timestamp anyway Avoid re-build for the targets(e.g. debug) depends on build. Reported-by: unicornx Signed-off-by: Wu Zhangjin --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 26e9c8f..92657ae 100644 --- a/Makefile +++ b/Makefile @@ -1372,6 +1372,7 @@ endif # Force app building for current building targets can not auto detect code update ifeq ($(filter $(first_target),$(1) $(1)-build build), $(first_target)) $(1)-build: _$(1) + $$(Q)touch $$(call __stamp_$(1),build) else $(1)-build: $$(call __stamp_$(1),build) endif -- Gitee From dd0915c9ca740a41406cb76d3bf6e98349d3d1fa Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sun, 13 Sep 2020 17:53:36 +0800 Subject: [PATCH 11/22] mips64el/ls3a7a: buildroot: upgrade to 2020.08 Signed-off-by: Wu Zhangjin --- boards/mips64el/ls3a7a/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/mips64el/ls3a7a/Makefile b/boards/mips64el/ls3a7a/Makefile index f7aecea..6836e8c 100644 --- a/boards/mips64el/ls3a7a/Makefile +++ b/boards/mips64el/ls3a7a/Makefile @@ -3,7 +3,7 @@ _BASE = 1 ARCH = mips XARCH = mips64el CPU ?= mips64r2 -BUILDROOT?= 2016.05 +BUILDROOT?= 2020.08 MEM ?= 1024M SERIAL ?= ttyS0 -- Gitee From 9fd505303e42ffa5c730f1fcd0f9f799eda2f4ec Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Tue, 15 Sep 2020 00:39:04 +0800 Subject: [PATCH 12/22] README: document the rootfs error FIXME: This error must be fixed up with code change, `CTRL+C` should be stopped during the creating of rootfs directory, ramdisk and harddisk, but there is no such support in Makefile?! Reported-by: unicornx Signed-off-by: Wu Zhangjin --- README.md | 9 +++++++++ README_zh.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index a2e3343..9c2c973 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ - [6.4.5 unable to create file: net/netfilter/xt_dscp.c](#645-unable-to-create-file-netnetfilterxt_dscpc) - [6.4.6 how to run as root](#646-how-to-run-as-root) - [6.4.7 not in supported list](#647-not-in-supported-list) + - [6.4.8 is not a valid rootfs directory](#648-is-not-a-valid-rootfs-directory) - [7. Contact and Sponsor](#7-contact-and-sponsor) @@ -2174,6 +2175,14 @@ There are two main types: * This board may not support such type of device or just nobody verify and add it * This differs from board and kernel version +### 6.4.8 is not a valid rootfs directory + +If using prebuilt filesystem, this error means the rootfs dir, ramdisk or harddisk creating procedure has been interrupted by `CTRL+C` or similar operations and it means the filesystem is not complete. If no important changes in BSP repository, reset it may help: + + $ make bsp-cleanup + +If using external filesystem, please make sure the filesystem architecture follows the Linux standards. + # 7. Contact and Sponsor Our contact wechat is **tinylab**, welcome to join our user & developer discussion group. diff --git a/README_zh.md b/README_zh.md index f360063..1ee782a 100644 --- a/README_zh.md +++ b/README_zh.md @@ -126,6 +126,7 @@ - [6.4.5 unable to create file: net/netfilter/xt_dscp.c](#645-unable-to-create-file-netnetfilterxt_dscpc) - [6.4.6 如何切到 root 用户](#646-如何切到-root-用户) - [6.4.7 提示指定的版本或者配置不存在](#647-提示指定的版本或者配置不存在) + - [6.4.8 is not a valid rootfs directory](#648-is-not-a-valid-rootfs-directory) - [7. 联系并赞助我们](#7-联系并赞助我们) @@ -2247,6 +2248,14 @@ Web 连接可能由于某些未知原因而挂起,导致 Linux Lab 有时可 * vda 可能根本不支持或者需要重新配置内核后才支持 * 这个因板子和内核版本而异,需要具体对待 +### 6.4.8 is not a valid rootfs directory + +如果当前使用的是预制文件系统,说明操作过程中可能有类似 `CTRL+C` 中断了正常根文件系统目录、Ramdisk 或 Hardisk 镜像的创建过程,导致文件系统不完整,在确保 BSP 目录无其他紧要修改的情况下,可以通过如下命令恢复 BSP 仓库为默认设置: + + $ make bsp-cleanup + +如果当前使用的是用户自己构建的文件系统,请确保文件系统符合 Linux 的规范,确保相关的基础目录均存在。 + # 7. 联系并赞助我们 我们的联系微信是 **tinylab**,欢迎加入 Linux Lab 的用户和开发人员讨论组。 -- Gitee From eea10afaf0b724142dc9712c292514146b954122 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Tue, 15 Sep 2020 01:46:29 +0800 Subject: [PATCH 13/22] root: use intermediate files to work with ctrl+c ref: https://www.gnu.org/software/make/manual/html_node/Interrupts.html https://stackoverflow.com/questions/56610536/how-to-trap-exit-ctrlc-signal-in-makefile .INTERMEDIATE target doesn't work with directories, use tmp files instead. The only side effect is while ctrl+c happen, .tmp will be created, but will be cleaned up next time or with `git clean -fdx`. Signed-off-by: Wu Zhangjin --- Makefile | 22 ++++++++++++++++++---- tools/root/rd2hd.sh | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 92657ae..cd8a7cf 100644 --- a/Makefile +++ b/Makefile @@ -2043,7 +2043,9 @@ root-rd: root-rd-rebuild: FORCE @echo "LOG: Generating ramdisk image with $(ROOT_GENRD_TOOL) ..." - ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) USER=$(USER) $(ROOT_GENRD_TOOL) + $(Q)rm -rf $(IROOTFS).tmp + $(Q)ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS).tmp USER=$(USER) $(ROOT_GENRD_TOOL) + $(Q)mv $(IROOTFS).tmp $(IROOTFS) ROOT_GENDISK_TOOL := $(TOOL_DIR)/root/dir2$(DEV_TYPE).sh @@ -2051,11 +2053,19 @@ ifeq ($(prebuilt_root_dir), 1) ROOT_DIR := root-dir endif +ifeq ($(DEV_TYPE),rd) + XROOTFS := $(IROOTFS) +else + XROOTFS := $(HROOTFS) +endif + # This is used to repackage the updated root directory, for example, `make r-i` just executed. root-rebuild: $(ROOT_DIR) ifeq ($(prebuilt_root_dir), 1) @echo "LOG: Generating $(DEV_TYPE) with $(ROOT_GENDISK_TOOL) ..." - ROOTDIR=$(ROOTDIR) INITRD=$(IROOTFS) HROOTFS=$(HROOTFS) FSTYPE=$(FSTYPE) USER=$(USER) $(ROOT_GENDISK_TOOL) + $(Q)rm -rf $(XROOTFS).tmp + $(Q)ROOTDIR=$(ROOTDIR) INITRD=$(IROOTFS).tmp HROOTFS=$(HROOTFS).tmp FSTYPE=$(FSTYPE) USER=$(USER) $(ROOT_GENDISK_TOOL) + $(Q)if [ -f $(XROOTFS).tmp ]; then mv $(XROOTFS).tmp $(XROOTFS); fi $(Q)if [ $(build_root_uboot) -eq 1 ]; then make $(S) _root-ud-rebuild; fi else $(call make_root) @@ -2102,7 +2112,9 @@ root-dir-rebuild: rootdir rootdir: ifneq ($(ROOTDIR), $(BUILDROOT_ROOTDIR)) @echo "LOG: Generating rootfs directory with $(ROOT_GENDIR_TOOL) ..." - ROOTDIR=$(ROOTDIR) USER=$(USER) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) $(ROOT_GENDIR_TOOL) + $(Q)rm -rf $(ROOTDIR).tmp + $(Q)ROOTDIR=$(ROOTDIR).tmp USER=$(USER) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) $(ROOT_GENDIR_TOOL) + $(Q)mv $(ROOTDIR).tmp $(ROOTDIR) endif rootdir-install: root-install @@ -2126,7 +2138,9 @@ root-hd: root-hd-rebuild: FORCE @echo "LOG: Generating harddisk image with $(ROOT_GENHD_TOOL) ..." - ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS) INITRD=$(IROOTFS) $(ROOT_GENHD_TOOL) + $(Q)rm -rf $(HROOTFS).tmp + $(Q)ROOTDIR=$(ROOTDIR) FSTYPE=$(FSTYPE) HROOTFS=$(HROOTFS).tmp INITRD=$(IROOTFS) $(ROOT_GENHD_TOOL) + $(Q)mv $(HROOTFS).tmp $(HROOTFS) PHONY += root-hd root-hd-rebuild diff --git a/tools/root/rd2hd.sh b/tools/root/rd2hd.sh index a54d21a..2877219 100755 --- a/tools/root/rd2hd.sh +++ b/tools/root/rd2hd.sh @@ -17,7 +17,7 @@ [ -z "${USER}" ] && USER=$(whoami) -ROOTDIR=$(echo ${HROOTFS} | sed -e "s%.${FSTYPE}%%g") +ROOTDIR=$(echo ${HROOTFS} | sed -e "s%.${FSTYPE}.*%%g") FS_CPIO_GZ=${ROOTDIR}.cpio.gz FS_CPIO=${ROOTDIR}.cpio -- Gitee From ae3dd054ff0adb502ef8736dbfa6a92ac64f56ca Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 16 Sep 2020 01:32:01 +0800 Subject: [PATCH 14/22] README: modules target works as alias of module target Use modules instead of module, if no options specified, modules means default kernel modules target. Signed-off-by: Wu Zhangjin --- README.md | 16 ++++++++-------- README_zh.md | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9c2c973..20f8078 100644 --- a/README.md +++ b/README.md @@ -977,13 +977,13 @@ Build all internel kernel modules: List available modules in `src/modules/`, `boards//bsp/modules/`: - $ make module-list + $ make modules-list If `m` argument specified, list available modules in `src/modules/`, `boards//bsp/modules/` and `src/linux-stable/`: - $ make module-list m=hello + $ make modules-list m=hello 1 m=hello ; M=$PWD/modules/hello - $ make module-list m=tun,minix + $ make modules-list m=tun,minix 1 c=TUN ; m=tun ; M=drivers/net 2 c=MINIX_FS ; m=minix ; M=fs/minix @@ -1003,14 +1003,14 @@ Enable one kernel module: Build one kernel module (e.g. minix.ko): - $ make module M=fs/minix/ + $ make modules M=fs/minix/ Or - $ make module m=minix + $ make modules m=minix Install and clean the module: - $ make module-install M=fs/minix/ - $ make module-clean M=fs/minix/ + $ make modules-install M=fs/minix/ + $ make modules-clean M=fs/minix/ More flexible usage: @@ -1021,7 +1021,7 @@ More flexible usage: Build external kernel modules (the same as internel modules): - $ make module m=hello + $ make modules m=hello Or $ make kernel x=$PWD/modules/hello/hello.ko diff --git a/README_zh.md b/README_zh.md index 1ee782a..4f0eb4c 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1053,13 +1053,13 @@ Linux 内核提供了一个脚本 `scripts/config`,可用于非交互方式获 列出 `src/modules/` 和 `boards//bsp/modules/` 路径下的所有模块: - $ make module-list + $ make modules-list 如果加上 `m` 参数,除了列出 `src/modules/` 和 `boards//bsp/modules/` 路径下的所有模块外,还会列出 `src/linux-stable/` 下的所有模块: - $ make module-list m=hello + $ make modules-list m=hello 1 m=hello ; M=$PWD/modules/hello - $ make module-list m=tun,minix + $ make modules-list m=tun,minix 1 c=TUN ; m=tun ; M=drivers/net 2 c=MINIX_FS ; m=minix ; M=fs/minix @@ -1079,14 +1079,14 @@ Linux 内核提供了一个脚本 `scripts/config`,可用于非交互方式获 编译一个内核模块(例如:minix.ko) - $ make module M=fs/minix/ + $ make modules M=fs/minix/ 或 - $ make module m=minix + $ make modules m=minix 安装和清理模块: - $ make module-install M=fs/minix/ - $ make module-clean M=fs/minix/ + $ make modules-install M=fs/minix/ + $ make modules-clean M=fs/minix/ 其他用法: @@ -1097,7 +1097,7 @@ Linux 内核提供了一个脚本 `scripts/config`,可用于非交互方式获 编译外部内核模块(类似编译内部模块): - $ make module m=hello + $ make modules m=hello 或 $ make kernel x=$PWD/src/modules/hello/hello.ko -- Gitee From 7c93fdaaffcf001ed43bfce35435eae4730e54c9 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 16 Sep 2020 16:57:52 +0800 Subject: [PATCH 15/22] .gitignore: ignore .tmp files Signed-off-by: Wu Zhangjin --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 542cc2e..532755c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ loongnix-3.10 tglx-linux-history force-* .lock +.tmp -- Gitee From b98a4b8de5d1a6d6290cb407014e68c328deb852 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 16 Sep 2020 17:03:31 +0800 Subject: [PATCH 16/22] bsp: checkout after cleanstamp Signed-off-by: Wu Zhangjin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cd8a7cf..d0b57b6 100644 --- a/Makefile +++ b/Makefile @@ -1702,7 +1702,7 @@ else endif ifeq ($(firstword $(MAKECMDGOALS)),bsp) -bsp: force-bsp-checkout +bsp: bsp-cleanstamp bsp-checkout PHONY += bsp endif -- Gitee From 7ca90600fbf942ea16ea64dcfb503eb61fc32b8a Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Fri, 18 Sep 2020 14:21:17 +0800 Subject: [PATCH 17/22] rootfs: Add missing rootdir dependency for a variant of modules-install Rootfs directory must be prepared before modules installation, otherwise, the rootfs/ directory will be not a completed rootfs directory and since the directory is there, it will not be re-created (see `root-dir` target). Issue: https://gitee.com/tinylab/linux-lab/issues/I1UY6N Reported-and-Tested-by: unicornx Signed-off-by: Wu Zhangjin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d0b57b6..f6da61a 100644 --- a/Makefile +++ b/Makefile @@ -2361,7 +2361,7 @@ endif # From linux-stable/scripts/depmod.sh, v5.1 SCRIPTS_DEPMOD := $(TOP_DIR)/tools/kernel/depmod.sh -kernel-modules-install-km: +kernel-modules-install-km: $(M_I_ROOT) $(Q)if [ "$(shell $(SCRIPTS_KCONFIG) --file $(DEFAULT_KCONFIG) -s MODULES)" = "y" ]; then \ $(call make_kernel,modules_install $(KM) INSTALL_MOD_PATH=$(ROOTDIR)); \ if [ ! -f $(KERNEL_ABS_SRC)/scripts/depmod.sh ]; then \ -- Gitee From fc5e170acb1762a9398494c0bae727363ae7d488 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Fri, 18 Sep 2020 14:27:12 +0800 Subject: [PATCH 18/22] README: Unify the usage of ROOTDEV /dev/XXX can be shorten to XXX for ROOTDEV, but unify to avoid confusion. Signed-off-by: Wu Zhangjin --- README.md | 2 +- README_zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 20f8078..7a7b5ad 100644 --- a/README.md +++ b/README.md @@ -2156,7 +2156,7 @@ By default, no password required to run as root with: Such information means the specified value is not supported currently: - $ make boot ROOTDEV=vda + $ make boot ROOTDEV=/dev/vda ERR: /dev/vda not in supported ROOTDEV list: /dev/sda /dev/ram0 /dev/nfs, update may help: 'make bsp B=mips64el/ls3a7a'. Stop. $ make boot LINUX=v5.8 diff --git a/README_zh.md b/README_zh.md index 4f0eb4c..f058993 100644 --- a/README_zh.md +++ b/README_zh.md @@ -2227,7 +2227,7 @@ Web 连接可能由于某些未知原因而挂起,导致 Linux Lab 有时可 如果看到如下信息: - $ make boot ROOTDEV=vda + $ make boot ROOTDEV=/dev/vda ERR: /dev/vda not in supported ROOTDEV list: /dev/sda /dev/ram0 /dev/nfs, update may help: 'make bsp B=mips64el/ls3a7a'. Stop. $ make boot LINUX=v5.8 -- Gitee From 490db9767926164f7188f7ca7b2a6b4bbf9299ec Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sat, 19 Sep 2020 17:18:20 +0800 Subject: [PATCH 19/22] README: Add more document Signed-off-by: Wu Zhangjin --- README.md | 5 +++++ README_zh.md | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 7a7b5ad..6e48da5 100644 --- a/README.md +++ b/README.md @@ -1614,6 +1614,11 @@ Read more: * [Why Using Linux Lab V1.0 (In Chinese)](http://tinylab.org/why-linux-lab) * [Why Using Linux Lab V2.0 (In Chinese)](http://tinylab.org/why-linux-lab-v2) +* [Linux Lab Loongson Manual V0.2](http://tinylab.org/pdfs/linux-lab-loongson-manual-v0.2.pdf) +* Linux Lab Open Video + * [CCTALK](https://www.cctalk.com/m/group/88948325) + * [Bilibili](https://space.bilibili.com/687228362) + * [Zhihu](https://www.zhihu.com/people/wuzhangjin) # 5. Linux Lab Development diff --git a/README_zh.md b/README_zh.md index f058993..b302852 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1684,6 +1684,11 @@ Linux Lab 支持通过形如 `-run` 方式访问 Makefile 中定义的目 * [Linux Lab:难以抗拒的十大理由 V1.0](http://tinylab.org/why-linux-lab) * [Linux Lab:难以抗拒的十大理由 V2.0](http://tinylab.org/why-linux-lab-v2) +* [Linux Lab 龙芯实验手册 V0.2](http://tinylab.org/pdfs/linux-lab-loongson-manual-v0.2.pdf) +* Linux Lab 视频公开课 + * [CCTALK](https://www.cctalk.com/m/group/88948325) + * [B 站](https://space.bilibili.com/687228362) + * [知乎](https://www.zhihu.com/people/wuzhangjin) # 5. Linux Lab 开发 -- Gitee From df5fcd07bad1e41779db15085858a0fb9ff35688 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Sat, 19 Sep 2020 17:32:34 +0800 Subject: [PATCH 20/22] README: update bilibili channel Signed-off-by: Wu Zhangjin --- README.md | 2 +- README_zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e48da5..ecc1235 100644 --- a/README.md +++ b/README.md @@ -1617,7 +1617,7 @@ Read more: * [Linux Lab Loongson Manual V0.2](http://tinylab.org/pdfs/linux-lab-loongson-manual-v0.2.pdf) * Linux Lab Open Video * [CCTALK](https://www.cctalk.com/m/group/88948325) - * [Bilibili](https://space.bilibili.com/687228362) + * [Bilibili](https://space.bilibili.com/687228362/channel/detail?cid=152574) * [Zhihu](https://www.zhihu.com/people/wuzhangjin) # 5. Linux Lab Development diff --git a/README_zh.md b/README_zh.md index b302852..b3c3701 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1687,7 +1687,7 @@ Linux Lab 支持通过形如 `-run` 方式访问 Makefile 中定义的目 * [Linux Lab 龙芯实验手册 V0.2](http://tinylab.org/pdfs/linux-lab-loongson-manual-v0.2.pdf) * Linux Lab 视频公开课 * [CCTALK](https://www.cctalk.com/m/group/88948325) - * [B 站](https://space.bilibili.com/687228362) + * [B 站](https://space.bilibili.com/687228362/channel/detail?cid=152574) * [知乎](https://www.zhihu.com/people/wuzhangjin) # 5. Linux Lab 开发 -- Gitee From 22f86cc6c7fb756cc13287010a789e98d4737f85 Mon Sep 17 00:00:00 2001 From: Wu Zhangjin Date: Wed, 23 Sep 2020 19:49:55 +0800 Subject: [PATCH 21/22] module: fix up modules-list results Signed-off-by: Wu Zhangjin --- Makefile | 2 +- README.md | 2 +- README_zh.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f6da61a..ffba680 100644 --- a/Makefile +++ b/Makefile @@ -2344,7 +2344,7 @@ endif kernel-modules-list: kernel-modules-list-full kernel-modules-list-full: - $(Q)find $(EXT_MODULE_DIR) -name "Makefile" | $(PF) | xargs -i egrep -iH "^obj-m[[:space:]]*[+:]*=[[:space:]]*.*($(IMF)).*\.o" {} | sed -e "s%$(PWD)/\(.*\)/Makefile:obj-m[[:space:]]*[+:]*=[[:space:]]*\(.*\).o%m=\2 ; M=\$$PWD/\1%g" | cat -n + $(Q)find $(EXT_MODULE_DIR) -name "Makefile" | $(PF) | xargs -i egrep -iH "^obj-m[[:space:]]*[+:]*=[[:space:]]*.*($(IMF)).*\.o" {} | sed -e "s%$(PWD)\(.*\)/Makefile:obj-m[[:space:]]*[+:]*=[[:space:]]*\(.*\).o%m=\2 ; M=\$$PWD/\1%g" | cat -n ifeq ($(internal_search),1) $(Q)find $(KERNEL_SEARCH_PATH) -name "Makefile" | $(PF) | xargs -i egrep -iH "^obj-.*_($(IMF))(\)|_).*[[:space:]]*[+:]*=[[:space:]]*($(IMF)).*\.o" {} | sed -e "s%$(KERNEL_MODULE_DIR)/\(.*\)/Makefile:obj-\$$(CONFIG_\(.*\))[[:space:]]*[+:]*=[[:space:]]*\(.*\)\.o%c=\2 ; m=\3 ; M=\1%g" | cat -n endif diff --git a/README.md b/README.md index ecc1235..3d6a7db 100644 --- a/README.md +++ b/README.md @@ -982,7 +982,7 @@ List available modules in `src/modules/`, `boards//bsp/modules/`: If `m` argument specified, list available modules in `src/modules/`, `boards//bsp/modules/` and `src/linux-stable/`: $ make modules-list m=hello - 1 m=hello ; M=$PWD/modules/hello + 1 m=hello ; M=$PWD/src/modules/hello $ make modules-list m=tun,minix 1 c=TUN ; m=tun ; M=drivers/net 2 c=MINIX_FS ; m=minix ; M=fs/minix diff --git a/README_zh.md b/README_zh.md index b3c3701..2d26bb5 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1058,7 +1058,7 @@ Linux 内核提供了一个脚本 `scripts/config`,可用于非交互方式获 如果加上 `m` 参数,除了列出 `src/modules/` 和 `boards//bsp/modules/` 路径下的所有模块外,还会列出 `src/linux-stable/` 下的所有模块: $ make modules-list m=hello - 1 m=hello ; M=$PWD/modules/hello + 1 m=hello ; M=$PWD/src/modules/hello $ make modules-list m=tun,minix 1 c=TUN ; m=tun ; M=drivers/net 2 c=MINIX_FS ; m=minix ; M=fs/minix -- Gitee From 0413f443f50cfb54a46b5d1a384b3a7659217feb Mon Sep 17 00:00:00 2001 From: Signal Date: Tue, 29 Sep 2020 19:57:41 +0800 Subject: [PATCH 22/22] update i386 board's kernel to v5.8 --- boards/i386/pc/Makefile | 2 +- boards/i386/pc/bsp | 2 +- boards/x86_64/pc/bsp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/i386/pc/Makefile b/boards/i386/pc/Makefile index 2470c5e..778ab14 100644 --- a/boards/i386/pc/Makefile +++ b/boards/i386/pc/Makefile @@ -19,7 +19,7 @@ GCC[QEMU_v0.10.6] = 4.4 endif SMP ?= 4 -LINUX ?= v5.1 +LINUX ?= v5.8 BUILDROOT?= 2019.02.2 # Add board detailed configuration diff --git a/boards/i386/pc/bsp b/boards/i386/pc/bsp index a95f926..bf2175c 160000 --- a/boards/i386/pc/bsp +++ b/boards/i386/pc/bsp @@ -1 +1 @@ -Subproject commit a95f9266e93a5aea68baa4e162bd885806604531 +Subproject commit bf2175c1882f21aa92600578bcd05a0ed6142290 diff --git a/boards/x86_64/pc/bsp b/boards/x86_64/pc/bsp index 62826c9..ad1fad6 160000 --- a/boards/x86_64/pc/bsp +++ b/boards/x86_64/pc/bsp @@ -1 +1 @@ -Subproject commit 62826c9b6397c488ccf393a2ef9383b4101af8dc +Subproject commit ad1fad65c4f66d26c8f00a69ae20154c22119457 -- Gitee