mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 02:46:47 +00:00
移植dns查询工具dog的--tcp功能 (#652)
* add dog, modify user/Makefile and user.sysconfig * add dog, modify user/Makefile and user.sysconfig * fix tty unicode * 修正无法正确编译dog的问题 --------- Co-authored-by: val213 <val213666@gmail.com> Co-authored-by: GnoCiYeH <heyicong@dragonos.org> Co-authored-by: longjin <longjin@DragonOS.org>
This commit is contained in:
parent
911132c4b8
commit
7c958c9ef0
43
env.mk
43
env.mk
@ -8,46 +8,3 @@ endif
|
|||||||
ifeq ($(EMULATOR), )
|
ifeq ($(EMULATOR), )
|
||||||
export EMULATOR=__NO_EMULATION__
|
export EMULATOR=__NO_EMULATION__
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# 设置编译器
|
|
||||||
ifeq ($(ARCH), x86_64)
|
|
||||||
|
|
||||||
# 如果 x86_64时,DragonOS_GCC 为空,那么设置为默认值
|
|
||||||
export DragonOS_GCC?=$(HOME)/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
|
|
||||||
|
|
||||||
export CC=$(DragonOS_GCC)/x86_64-elf-gcc
|
|
||||||
export LD=ld
|
|
||||||
export AS=$(DragonOS_GCC)/x86_64-elf-as
|
|
||||||
export NM=$(DragonOS_GCC)/x86_64-elf-nm
|
|
||||||
export AR=$(DragonOS_GCC)/x86_64-elf-ar
|
|
||||||
export OBJCOPY=$(DragonOS_GCC)/x86_64-elf-objcopy
|
|
||||||
|
|
||||||
else ifeq ($(ARCH), riscv64)
|
|
||||||
|
|
||||||
export CC=riscv64-unknown-elf-gcc
|
|
||||||
# binutils版本需要>=2.38
|
|
||||||
# 而ubuntu的unknown-elf的版本比较旧,所以使用了riscv64-linux-gnu-ld
|
|
||||||
export LD=riscv64-linux-gnu-ld
|
|
||||||
export AS=riscv64-unknown-elf-as
|
|
||||||
export NM=riscv64-unknown-elf-nm
|
|
||||||
export AR=riscv64-unknown-elf-ar
|
|
||||||
export OBJCOPY=riscv64-unknown-elf-objcopy
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
export DEBUG=DEBUG
|
|
||||||
|
|
||||||
export CFLAGS_DEFINE_ARCH="__$(ARCH)__"
|
|
||||||
|
|
||||||
export GLOBAL_CFLAGS := -fno-builtin -fno-stack-protector -D $(CFLAGS_DEFINE_ARCH) -D $(EMULATOR) -O1
|
|
||||||
|
|
||||||
ifeq ($(ARCH), x86_64)
|
|
||||||
GLOBAL_CFLAGS += -mcmodel=large -m64
|
|
||||||
else ifeq ($(ARCH), riscv64)
|
|
||||||
GLOBAL_CFLAGS += -mcmodel=medany -march=rv64imac -mabi=lp64
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(DEBUG), DEBUG)
|
|
||||||
GLOBAL_CFLAGS += -g
|
|
||||||
endif
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# 导入环境变量
|
# 导入环境变量
|
||||||
include ../env.mk
|
include ./env.mk
|
||||||
|
|
||||||
export ARCH ?= x86_64
|
# export ARCH ?= x86_64
|
||||||
# 如果是x86_64, 则使用x86_64-unknown-none.json作为target
|
# 如果是x86_64, 则使用x86_64-unknown-none.json作为target
|
||||||
ifeq ($(ARCH), x86_64)
|
ifeq ($(ARCH), x86_64)
|
||||||
export TARGET_JSON=arch/x86_64/x86_64-unknown-none.json
|
export TARGET_JSON=arch/x86_64/x86_64-unknown-none.json
|
||||||
|
44
kernel/env.mk
Normal file
44
kernel/env.mk
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
include ../env.mk
|
||||||
|
|
||||||
|
# 设置编译器
|
||||||
|
ifeq ($(ARCH), x86_64)
|
||||||
|
|
||||||
|
# 如果 x86_64时,DragonOS_GCC 为空,那么设置为默认值
|
||||||
|
export DragonOS_GCC?=$(HOME)/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
|
||||||
|
|
||||||
|
export CC=$(DragonOS_GCC)/x86_64-elf-gcc
|
||||||
|
export LD=ld
|
||||||
|
export AS=$(DragonOS_GCC)/x86_64-elf-as
|
||||||
|
export NM=$(DragonOS_GCC)/x86_64-elf-nm
|
||||||
|
export AR=$(DragonOS_GCC)/x86_64-elf-ar
|
||||||
|
export OBJCOPY=$(DragonOS_GCC)/x86_64-elf-objcopy
|
||||||
|
|
||||||
|
else ifeq ($(ARCH), riscv64)
|
||||||
|
|
||||||
|
export CC=riscv64-unknown-elf-gcc
|
||||||
|
# binutils版本需要>=2.38
|
||||||
|
# 而ubuntu的unknown-elf的版本比较旧,所以使用了riscv64-linux-gnu-ld
|
||||||
|
export LD=riscv64-linux-gnu-ld
|
||||||
|
export AS=riscv64-unknown-elf-as
|
||||||
|
export NM=riscv64-unknown-elf-nm
|
||||||
|
export AR=riscv64-unknown-elf-ar
|
||||||
|
export OBJCOPY=riscv64-unknown-elf-objcopy
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
export DEBUG=DEBUG
|
||||||
|
|
||||||
|
export CFLAGS_DEFINE_ARCH="__$(ARCH)__"
|
||||||
|
|
||||||
|
export GLOBAL_CFLAGS := -fno-builtin -fno-stack-protector -D $(CFLAGS_DEFINE_ARCH) -D $(EMULATOR) -O1
|
||||||
|
|
||||||
|
ifeq ($(ARCH), x86_64)
|
||||||
|
GLOBAL_CFLAGS += -mcmodel=large -m64
|
||||||
|
else ifeq ($(ARCH), riscv64)
|
||||||
|
GLOBAL_CFLAGS += -mcmodel=medany -march=rv64imac -mabi=lp64
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DEBUG), DEBUG)
|
||||||
|
GLOBAL_CFLAGS += -g
|
||||||
|
endif
|
@ -347,7 +347,7 @@ impl VirtualConsoleData {
|
|||||||
/// !!! 注意,该函数返回true时,元组的第一个数据是无效数据(未转换完成)
|
/// !!! 注意,该函数返回true时,元组的第一个数据是无效数据(未转换完成)
|
||||||
fn translate_unicode(&mut self, c: u32) -> (Option<u32>, bool) {
|
fn translate_unicode(&mut self, c: u32) -> (Option<u32>, bool) {
|
||||||
// 收到的字符不是首个
|
// 收到的字符不是首个
|
||||||
if (c & 0xc8) == 0x80 {
|
if (c & 0xc0) == 0x80 {
|
||||||
// 已经不需要继续的字符了,说明这个字符是非法的
|
// 已经不需要继续的字符了,说明这个字符是非法的
|
||||||
if self.utf_count == 0 {
|
if self.utf_count == 0 {
|
||||||
return (Some(0xfffd), false);
|
return (Some(0xfffd), false);
|
||||||
|
@ -60,8 +60,7 @@ all:
|
|||||||
@echo 用户态程序编译完成
|
@echo 用户态程序编译完成
|
||||||
|
|
||||||
copy_services: dadk_run
|
copy_services: dadk_run
|
||||||
@mkdir -p $(ROOT_PATH)/bin/sysroot/etc/reach/system
|
cp -r sysconfig/* $(ROOT_PATH)/bin/sysroot/
|
||||||
cp -r services/* $(ROOT_PATH)/bin/sysroot/etc/reach/system/
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
28
user/dadk/config/dog_0_1_0.dadk
Normal file
28
user/dadk/config/dog_0_1_0.dadk
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "dog",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "dns client",
|
||||||
|
"rust_target": null,
|
||||||
|
"task_type": {
|
||||||
|
"BuildFromSource": {
|
||||||
|
"Git": {
|
||||||
|
"url": "https://git.mirrors.dragonos.org.cn/DragonOS-Community/dog.git",
|
||||||
|
"branch": null,
|
||||||
|
"revision": "4ad6075686"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"depends": [],
|
||||||
|
"build": {
|
||||||
|
"build_command": "make install"
|
||||||
|
},
|
||||||
|
"install": {
|
||||||
|
"in_dragonos_path": "/"
|
||||||
|
},
|
||||||
|
"clean": {
|
||||||
|
"clean_command": "make clean"
|
||||||
|
},
|
||||||
|
"envs": [],
|
||||||
|
"build_once": false,
|
||||||
|
"install_once": false
|
||||||
|
}
|
8
user/sysconfig/etc/reach/system/shell.service
Normal file
8
user/sysconfig/etc/reach/system/shell.service
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Shell
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/bin/NovaShell
|
||||||
|
Restart=always
|
||||||
|
ExecStartPre=-/bin/about.elf
|
2
user/sysconfig/etc/resolv.conf
Normal file
2
user/sysconfig/etc/resolv.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
nameserver 8.8.8.8
|
||||||
|
nameserver 8.8.8.4
|
Loading…
x
Reference in New Issue
Block a user