mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 14:23:39 +00:00
3
user/apps/about/.gitignore
vendored
3
user/apps/about/.gitignore
vendored
@ -1 +1,2 @@
|
||||
sys_version.h
|
||||
sys_version.h
|
||||
about
|
||||
|
@ -1,17 +1,26 @@
|
||||
OLD_LIBC_INSTALL_PATH=$(ROOT_PATH)/bin/sysroot/usr/old_libc
|
||||
ifeq ($(ARCH), x86_64)
|
||||
CROSS_COMPILE=x86_64-linux-musl-
|
||||
else ifeq ($(ARCH), riscv64)
|
||||
CROSS_COMPILE=riscv64-linux-musl-
|
||||
endif
|
||||
|
||||
# 获得当前git提交的sha1,并截取前8位
|
||||
GIT_COMMIT_SHA1=$(shell git log -n 1 | head -n 1 | cut -d ' ' -f 2 | cut -c1-8)
|
||||
CC=$(CROSS_COMPILE)gcc
|
||||
|
||||
all: about.o
|
||||
|
||||
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/about $(shell find . -name "*.o") $(OLD_LIBC_INSTALL_PATH)/lib/libc.a -T about.lds
|
||||
all: version_header about.c
|
||||
$(CC) -static -o about about.c
|
||||
|
||||
$(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/about $(output_dir)/about.elf
|
||||
.PHONY: install clean
|
||||
install: all
|
||||
mv about $(DADK_CURRENT_BUILD_DIR)/about.elf
|
||||
|
||||
about.o: version_header about.c
|
||||
$(CC) $(CFLAGS) -c about.c -o about.o
|
||||
clean:
|
||||
rm about *.o
|
||||
|
||||
# 生成版本头文件sys_version.h
|
||||
version_header: about.c
|
||||
@echo "#define DRAGONOS_GIT_COMMIT_SHA1 \"$(GIT_COMMIT_SHA1)\"" > sys_version.h
|
||||
|
||||
fmt:
|
||||
|
@ -1,9 +1,7 @@
|
||||
#include "sys_version.h" // 这是系统的版本头文件,在编译过程中自动生成
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void print_ascii_logo()
|
||||
{
|
||||
printf(" ____ ___ ____ \n");
|
||||
@ -13,24 +11,25 @@ void print_ascii_logo()
|
||||
printf("|____/ |_| \\__,_| \\__, | \\___/ |_| |_| \\___/ |____/ \n");
|
||||
printf(" |___/ \n");
|
||||
}
|
||||
|
||||
void print_copyright()
|
||||
{
|
||||
printf(" DragonOS - An opensource operating system.\n");
|
||||
printf(" Copyright: DragonOS Community. 2022-2024, All rights reserved.\n");
|
||||
printf(" Version: ");
|
||||
put_string("V0.1.8\n", COLOR_GREEN, COLOR_BLACK);
|
||||
printf("\033[1;32m%s\033[0m", "V0.1.8\n");
|
||||
printf(" Git commit SHA1: %s\n", DRAGONOS_GIT_COMMIT_SHA1);
|
||||
printf(" Build time: %s %s\n", __DATE__, __TIME__);
|
||||
printf(" \nYou can visit the project via:\n");
|
||||
printf("\n");
|
||||
put_string(" Official Website: https://DragonOS.org\n", COLOR_INDIGO, COLOR_BLACK);
|
||||
put_string(" GitHub: https://github.com/DragonOS-Community/DragonOS\n", COLOR_ORANGE, COLOR_BLACK);
|
||||
printf("\x1B[1;36m%s\x1B[0m", " Official Website: https://DragonOS.org\n");
|
||||
printf("\x1B[1;33m%s\x1B[0m", " GitHub: https://github.com/DragonOS-Community/DragonOS\n");
|
||||
printf("\n");
|
||||
printf(" Maintainer: longjin <longjin@DragonOS.org>\n");
|
||||
printf(" Get contact with the community: <contact@DragonOS.org>\n");
|
||||
printf("\n");
|
||||
printf(" Join our development community:\n");
|
||||
put_string(" https://bbs.dragonos.org.cn\n", COLOR_ORANGE, COLOR_BLACK);
|
||||
printf("\x1B[1;33m%s\x1B[0m", " https://bbs.dragonos.org.cn\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@ -39,4 +38,4 @@ int main()
|
||||
print_ascii_logo();
|
||||
print_copyright();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
|
||||
OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64")
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
. = 0x800000;
|
||||
|
||||
|
||||
.text :
|
||||
{
|
||||
_text = .;
|
||||
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
|
||||
_etext = .;
|
||||
}
|
||||
. = ALIGN(8);
|
||||
|
||||
.data :
|
||||
{
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
|
||||
_edata = .;
|
||||
}
|
||||
|
||||
|
||||
rodata_start_pa = .;
|
||||
.rodata :
|
||||
{
|
||||
_rodata = .;
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
_erodata = .;
|
||||
}
|
||||
|
||||
|
||||
.bss :
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
_ebss = .;
|
||||
}
|
||||
|
||||
_end = .;
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user