mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 22:43:23 +00:00
🎨 将shell独立成单独的app
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
user_sub_dirs = libs
|
||||
user_sub_dirs = libs apps
|
||||
|
||||
SUBDIR_ROOTS := .
|
||||
DIRS := . $(shell find $(SUBDIR_ROOTS) -type d)
|
||||
@ -6,9 +6,11 @@ GARBAGE_PATTERNS := *.o *.s~ *.s *.S~ *.c~ *.h~ sys_api_lib
|
||||
GARBAGE := $(foreach DIR,$(DIRS),$(addprefix $(DIR)/,$(GARBAGE_PATTERNS)))
|
||||
|
||||
|
||||
objs :=
|
||||
CFLAGS := $(GLOBAL_CFLAGS)
|
||||
current_CFLAGS := $(CFLAGS) -I $(shell pwd)/libs
|
||||
tmp_output_dir=$(ROOT_PATH)/bin/tmp/user
|
||||
output_dir=$(ROOT_PATH)/bin/user
|
||||
|
||||
CFLAGS := $(GLOBAL_CFLAGS) -I $(shell pwd)/libs
|
||||
current_CFLAGS := $(CFLAGS)
|
||||
all:
|
||||
|
||||
@list='$(user_sub_dirs)'; for subdir in $$list; do \
|
||||
@ -17,18 +19,25 @@ all:
|
||||
$(MAKE) all CFLAGS="$(CFLAGS)";\
|
||||
cd ..;\
|
||||
done
|
||||
$(MAKE) init.o
|
||||
$(MAKE) sys_api_lib
|
||||
|
||||
|
||||
$(shell if [ ! -e $(tmp_output_dir) ];then mkdir -p $(tmp_output_dir); fi)
|
||||
$(shell if [ ! -e $(output_dir) ];then mkdir -p $(output_dir); fi)
|
||||
|
||||
$(MAKE) sys_api_lib
|
||||
$(MAKE) shell
|
||||
# objcopy -I elf64-x86-64 -S -R ".eh_frame" -R ".comment" -O binary sys_api_lib $(ROOT_PATH)/bin/user/init.bin
|
||||
objcopy -I elf64-x86-64 -S -R ".eh_frame" -R ".comment" -O elf64-x86-64 sys_api_lib $(ROOT_PATH)/bin/user/init.bin
|
||||
#objcopy -I elf64-x86-64 -S -R ".eh_frame" -R ".comment" -O elf64-x86-64 sys_api_lib $(ROOT_PATH)/bin/user/init.bin
|
||||
|
||||
sys_api_lib: init.o
|
||||
sys_api_lib:
|
||||
|
||||
ld -b elf64-x86-64 -z muldefs -o sys_api_lib $(shell find . -name "*.o")
|
||||
ld -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/sys_api_lib $(shell find ./libs -name "*.o")
|
||||
#ld -b elf64-x86-64 -z muldefs -o sys_api_lib init.o $(shell find . -name "*.o") -T init.lds
|
||||
|
||||
init.o: init.c
|
||||
gcc $(current_CFLAGS) -c init.c -o init.o
|
||||
shell:
|
||||
ld -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/shell $(shell find ./apps/shell -name "*.o") $(shell find ./libs -name "*.o")
|
||||
|
||||
objcopy -I elf64-x86-64 -S -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/shell $(output_dir)/shell.elf
|
||||
clean:
|
||||
rm -rf $(GARBAGE)
|
||||
rm -rf $(GARBAGE)
|
||||
|
Reference in New Issue
Block a user