🆕 在shell中启动另一个程序

This commit is contained in:
fslongjin
2022-06-07 23:18:26 +08:00
parent 129d24296b
commit 4e04ab9eee
14 changed files with 109 additions and 77 deletions

View File

@ -1,6 +1,6 @@
all: about.o
ld -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/about $(shell find . -name "*.o") $(shell find $(sys_libs_dir) -name "*.o") -T shell.lds
ld -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/about $(shell find . -name "*.o") $(shell find $(sys_libs_dir) -name "*.o") -T about.lds
objcopy -I elf64-x86-64 -S -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/about $(output_dir)/about.elf
about.o: about.c

View File

@ -3,5 +3,6 @@
int main()
{
printf("Hello World!\n");
exit(0);
while(1);
}

50
user/apps/about/about.lds Normal file
View File

@ -0,0 +1,50 @@
OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(main)
SECTIONS
{
. = 0x800000;
.text :
{
_text = .;
*(.text)
_etext = .;
}
. = ALIGN(8);
.data :
{
_data = .;
*(.data)
_edata = .;
}
rodata_start_pa = .;
.rodata :
{
_rodata = .;
*(.rodata)
_erodata = .;
}
.bss :
{
_bss = .;
*(.bss)
_ebss = .;
}
_end = .;
}