mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-10 08:06:48 +00:00
new: 将可执行文件移动到bin目录下
This commit is contained in:
parent
31b7b49d8c
commit
c811947dd0
@ -155,7 +155,7 @@ struct vfs_file_t *process_open_exec_file(char *path)
|
|||||||
{
|
{
|
||||||
struct vfs_dir_entry_t *dentry = NULL;
|
struct vfs_dir_entry_t *dentry = NULL;
|
||||||
struct vfs_file_t *filp = NULL;
|
struct vfs_file_t *filp = NULL;
|
||||||
|
// kdebug("path=%s", path);
|
||||||
dentry = vfs_path_walk(path, 0);
|
dentry = vfs_path_walk(path, 0);
|
||||||
|
|
||||||
if (dentry == NULL)
|
if (dentry == NULL)
|
||||||
@ -191,7 +191,7 @@ static int process_load_elf_file(struct pt_regs *regs, char *path)
|
|||||||
|
|
||||||
if ((long)filp <= 0 && (long)filp >= -255)
|
if ((long)filp <= 0 && (long)filp >= -255)
|
||||||
{
|
{
|
||||||
// kdebug("(long)filp=%ld", (long)filp);
|
kdebug("(long)filp=%ld", (long)filp);
|
||||||
return (unsigned long)filp;
|
return (unsigned long)filp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,12 +533,10 @@ ul initial_kernel_thread(ul arg)
|
|||||||
current_pcb->flags = 0;
|
current_pcb->flags = 0;
|
||||||
// 将返回用户层的代码压入堆栈,向rdx传入regs的地址,然后jmp到do_execve这个系统调用api的处理函数
|
// 将返回用户层的代码压入堆栈,向rdx传入regs的地址,然后jmp到do_execve这个系统调用api的处理函数
|
||||||
// 这里的设计思路和switch_proc类似 加载用户态程序:shell.elf
|
// 这里的设计思路和switch_proc类似 加载用户态程序:shell.elf
|
||||||
char init_path[] = "/shell.elf";
|
|
||||||
uint64_t addr = (uint64_t)&init_path;
|
|
||||||
__asm__ __volatile__("movq %1, %%rsp \n\t"
|
__asm__ __volatile__("movq %1, %%rsp \n\t"
|
||||||
"pushq %2 \n\t"
|
"pushq %2 \n\t"
|
||||||
"jmp do_execve \n\t" ::"D"(current_pcb->thread->rsp),
|
"jmp do_execve \n\t" ::"D"(current_pcb->thread->rsp),
|
||||||
"m"(current_pcb->thread->rsp), "m"(current_pcb->thread->rip), "S"("/shell.elf"), "c"(NULL),
|
"m"(current_pcb->thread->rsp), "m"(current_pcb->thread->rip), "S"("/bin/shell.elf"), "c"(NULL),
|
||||||
"d"(NULL)
|
"d"(NULL)
|
||||||
: "memory");
|
: "memory");
|
||||||
|
|
||||||
|
4
run.sh
4
run.sh
@ -108,8 +108,10 @@ if [ "${GENERATE_ISO}" == "1" ]; then
|
|||||||
mkdir -p ${boot_folder}/grub
|
mkdir -p ${boot_folder}/grub
|
||||||
cp ${kernel} ${root_folder}/bin/disk_mount/boot
|
cp ${kernel} ${root_folder}/bin/disk_mount/boot
|
||||||
# 拷贝用户程序到磁盘镜像
|
# 拷贝用户程序到磁盘镜像
|
||||||
cp -r ${root_folder}/bin/user/* ${root_folder}/bin/disk_mount
|
mkdir -p ${root_folder}/bin/disk_mount/bin
|
||||||
mkdir -p ${root_folder}/bin/disk_mount/dev
|
mkdir -p ${root_folder}/bin/disk_mount/dev
|
||||||
|
|
||||||
|
cp -r ${root_folder}/bin/user/* ${root_folder}/bin/disk_mount/bin
|
||||||
touch ${root_folder}/bin/disk_mount/dev/keyboard.dev
|
touch ${root_folder}/bin/disk_mount/dev/keyboard.dev
|
||||||
|
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ int shell_cmd_about(int argc, char **argv)
|
|||||||
|
|
||||||
unsigned char input_buffer[INPUT_BUFFER_SIZE] = {0};
|
unsigned char input_buffer[INPUT_BUFFER_SIZE] = {0};
|
||||||
|
|
||||||
strcpy(input_buffer, "exec /about.elf\0");
|
strcpy(input_buffer, "exec /bin/about.elf\0");
|
||||||
|
|
||||||
parse_command(input_buffer, &aac, &aav);
|
parse_command(input_buffer, &aac, &aav);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user