mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-20 14:16:33 +00:00
Feat(tty): Supplement process group logic (#1139)
* 添加busybox的编译 * 完善tty job control的逻辑 * 修改copy_sighand的逻辑,符合Linux语义 * 以busybox作为启动shell去运行 * 修改setsid的逻辑 * 解决前台进程组无法处理信号的问题 * 移除ProcessBasicInfo其中的pgid和sid信息 * 修改setsid * 新增get_pcb_info * 在etc目录下新增必要的文件 * 改用busybox init作为引导程序 * 恢复dragonreach文件 * 修改busybox编译选项,能够读取环境变量 * 先让SYS_RT_SIGTIMEDWAIT返回Ok(0),能够正常进入系统 * 一些小更改 * 删除get_pcb_info * 增加对默认termios的判断 * 完成backspace的修复 * 更改inittab,在shell启动之后更改termios * 增加executable_path信息 * 补充proc下的exe链接文件以及读取逻辑 * 更改PosixTermios,使用stty完成erase的设置 * 用busybox作为引导程序 * 修改波特率的获取 * 修改函数方法 * 在baud_rate方法中添加对于cbaud的与操作 * 为rv64下的SigSet实现From<Signal> * refactor(driver): 移除`#[derive(Debug)]`并手动实现`Debug` trait 移除`VirtIOBlkDevice`、`VirtIOConsoleDevice`和`VirtIONetDevice`的`#[derive(Debug)]`,并手动实现`Debug` trait以提供更详细的调试信息。 Co-authored-by: longjin <longjin@DragonOS.org>
This commit is contained in:
3
user/apps/busybox/.gitignore
vendored
Normal file
3
user/apps/busybox/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
build/
|
||||
busybox-1.35.0.tar.bz2
|
||||
busybox-1.35.0.tar.bz2.md5sum
|
76
user/apps/busybox/Makefile
Normal file
76
user/apps/busybox/Makefile
Normal file
@ -0,0 +1,76 @@
|
||||
ARCH ?= x86_64
|
||||
busybox_version := 1.35.0
|
||||
busybox_tarball := busybox-$(busybox_version).tar.bz2
|
||||
busybox_tarball_path := $(busybox_tarball)
|
||||
build_dir := build/$(ARCH)
|
||||
busybox_dir := $(build_dir)/busybox-$(busybox_version)
|
||||
prefix := $(ARCH)-linux-musl-
|
||||
bin := build/$(ARCH)/busybox
|
||||
|
||||
# 特殊架构处理
|
||||
ifeq ($(ARCH), mipsel)
|
||||
prefix := mipsel-linux-musln32-
|
||||
endif
|
||||
|
||||
cc := $(prefix)gcc
|
||||
strip := $(prefix)strip
|
||||
|
||||
# 下载 busybox 的 md5sum 文件
|
||||
$(busybox_tarball_path).md5sum:
|
||||
wget https://mirrors.dragonos.org.cn/pub/third_party/busybox/$(busybox_tarball).md5sum
|
||||
|
||||
# 下载源码
|
||||
$(busybox_tarball_path): $(busybox_tarball_path).md5sum
|
||||
@if [ ! -f $@ ] || ! md5sum -c $(busybox_tarball_path).md5sum; then \
|
||||
echo "Downloading $@..."; \
|
||||
wget https://mirrors.dragonos.org.cn/pub/third_party/busybox/$(busybox_tarball); \
|
||||
fi
|
||||
|
||||
# 解压源码包
|
||||
$(busybox_dir): $(busybox_tarball_path)
|
||||
mkdir -p $(build_dir)
|
||||
tar -xjf $< -C $(build_dir)
|
||||
|
||||
# 配置和编译
|
||||
$(bin): $(busybox_dir)
|
||||
@# 应用必要补丁和配置调整
|
||||
cd $(busybox_dir) && \
|
||||
make defconfig && \
|
||||
sed -i '/CONFIG_STATIC/s/.*/CONFIG_STATIC=y/' .config && \
|
||||
sed -i '/CONFIG_PIE/d' .config && \
|
||||
sed -i '/CONFIG_FEATURE_EDITING/s/=y/=n/' .config && \
|
||||
sed -i '/CONFIG_HUSH/s/=y/=n/' .config && \
|
||||
sed -i '/CONFIG_NOMMU/s/=y/=n/' .config && \
|
||||
echo "CONFIG_CROSS_COMPILER_PREFIX=\"$(prefix)\"" >> .config && \
|
||||
echo "CONFIG_FEATURE_STATIC=y" >> .config && \
|
||||
echo "CONFIG_STATIC_LIBGCC=y" >> .config && \
|
||||
echo "CONFIG_ASH=y" >> .config && \
|
||||
echo "CONFIG_ASH_READ_PROFILE=y" >> .config && \
|
||||
echo "CONFIG_FEATURE_EDITING=y" >> .config && \
|
||||
echo "CONFIG_HUSH=y" >> .config
|
||||
|
||||
@# 执行编译
|
||||
cd $(busybox_dir) && \
|
||||
KCONFIG_NOTIMESTAMP=1 make CC="$(cc)" CFLAGS_EXTRA="-static -Os" LDFLAGS="--static" -j$(nproc)
|
||||
|
||||
@# 处理编译输出
|
||||
mkdir -p $(dir $(bin))
|
||||
cp $(busybox_dir)/busybox $(bin)
|
||||
$(strip) $(bin)
|
||||
|
||||
.PHONY: all clean menuconfig
|
||||
|
||||
all: $(bin)
|
||||
|
||||
install: all
|
||||
mv $(bin) $(DADK_CURRENT_BUILD_DIR)/busybox
|
||||
|
||||
# 交互式配置菜单
|
||||
menuconfig: $(busybox_dir)
|
||||
cd $(busybox_dir) && make menuconfig
|
||||
|
||||
clean:
|
||||
rm -rf build/
|
||||
|
||||
distclean: clean
|
||||
rm -f $(busybox_tarball_path) $(busybox_tarball_path).md5sum
|
36
user/dadk/config/busybox_1_35_0.toml
Normal file
36
user/dadk/config/busybox_1_35_0.toml
Normal file
@ -0,0 +1,36 @@
|
||||
# 用户程序名称
|
||||
name = "busybox"
|
||||
# 版本号
|
||||
version = "1.35.0"
|
||||
# 用户程序描述信息
|
||||
description = ""
|
||||
# (可选)是否只构建一次,如果为true,DADK会在构建成功后,将构建结果缓存起来,下次构建时,直接使用缓存的构建结果
|
||||
build-once = false
|
||||
# (可选) 是否只安装一次,如果为true,DADK会在安装成功后,不再重复安装
|
||||
install-once = false
|
||||
# 目标架构
|
||||
# 可选值:"x86_64", "aarch64", "riscv64"
|
||||
target-arch = ["x86_64"]
|
||||
# 任务源
|
||||
[task-source]
|
||||
# 构建类型
|
||||
# 可选值:"build-from_source", "install-from-prebuilt"
|
||||
type = "build-from-source"
|
||||
# 构建来源
|
||||
# "build_from_source" 可选值:"git", "local", "archive"
|
||||
# "install_from_prebuilt" 可选值:"local", "archive"
|
||||
source = "local"
|
||||
# 路径或URL
|
||||
source-path = "user/apps/busybox"
|
||||
# 构建相关信息
|
||||
[build]
|
||||
# (可选)构建命令
|
||||
build-command = "make install"
|
||||
# 安装相关信息
|
||||
[install]
|
||||
# (可选)安装到DragonOS的路径
|
||||
in-dragonos-path = "/bin"
|
||||
# 清除相关信息
|
||||
[clean]
|
||||
# (可选)清除命令
|
||||
clean-command = "make distclean"
|
@ -47,3 +47,4 @@ clean-command = "make clean"
|
||||
|
||||
# 环境变量
|
||||
# 注意:因为没有环境变量,所以这里不包含[[envs]]部分
|
||||
|
||||
|
4
user/sysconfig/etc/init.d/rcS
Executable file
4
user/sysconfig/etc/init.d/rcS
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
echo "[rcS] Running system init script..."
|
||||
/bin/about.elf
|
||||
/bin/busybox stty erase 127
|
27
user/sysconfig/etc/inittab
Normal file
27
user/sysconfig/etc/inittab
Normal file
@ -0,0 +1,27 @@
|
||||
# /etc/inittab
|
||||
::sysinit:busybox sh /etc/init.d/rcS # 系统初始化脚本
|
||||
|
||||
::askfirst:-/bin/busybox sh --login
|
||||
|
||||
|
||||
# /etc/inittab - 根据源码弄出来的默认inittab
|
||||
# https://code.dragonos.org.cn/xref/busybox-1.35.0/init/init.c#679
|
||||
|
||||
# # 系统初始化脚本
|
||||
# ::sysinit:/etc/init.d/rcS
|
||||
|
||||
# # askfirst shell
|
||||
# ::askfirst:-/bin/sh
|
||||
# tty2::askfirst:-/bin/sh
|
||||
# tty3::askfirst:-/bin/sh
|
||||
# tty4::askfirst:-/bin/sh
|
||||
|
||||
# # Ctrl-Alt-Del 重启
|
||||
# ::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# # 系统关闭或重启前的动作
|
||||
# ::shutdown:/bin/umount -a -r
|
||||
# ::shutdown:/sbin/swapoff -a
|
||||
|
||||
# # 收到 QUIT 信号时重启 init
|
||||
# ::restart:/sbin/init
|
2
user/sysconfig/etc/profile
Normal file
2
user/sysconfig/etc/profile
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin
|
@ -6,3 +6,5 @@ Type=simple
|
||||
ExecStart=/bin/NovaShell
|
||||
Restart=always
|
||||
ExecStartPre=-/bin/about.elf
|
||||
ExecStartPre=/bin/busybox stty erase 127
|
||||
Environment=PATH=/bin:/usr/bin:/usr/local/bin
|
Reference in New Issue
Block a user