카테고리

asm (27) bootloader_x86_grub (1) C (92) compile (11) config (76) CPP (13) CSS (1) debugging (7) gimp (1) Go (1) html (1) Java (1) JavaScript (1) kernel (19) LibreOffice (3) Linux system progamming (21) MFC (1) opencv (4) OpenGL (1) PHP (1) Python (4) qemu (29) shell (3) socket (7) troubleshooting (2) ubuntu18.04 (2) windows (1)

2019/01/04

리눅스 커널 컴파일 init/main.c 부팅시 메세지 출력

init/main.c

커널 소스 다운로드
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git
cd ubuntu-bionic

# 작업할 커널 소스버전 변경.
git checkout Ubuntu-4.15.0-20.21
fakeroot debian/rules clean
debian/rules updateconfigs
fakeroot debian/rules build-generic
linux_image="$(pwd)/debian/build/build-generic/arch/x86_64/boot/bzImage"

커널 정보 추출 확인.
https://nautiluslee.blogspot.com/2019/01/config.html

패치 적용
diff --git a/init/main.c b/init/main.c
index b8b121c17ff1..542229349efc 100644
--- a/init/main.c
+++ b/init/main.c
@@ -516,6 +516,8 @@ asmlinkage __visible void __init start_kernel(void)
        char *command_line;
        char *after_dashes;

+ pr_info("I'VE Hae Nam Korea Linux Love man!!!");
+
        set_task_stack_end_magic(&init_task);
        smp_setup_processor_id();
        debug_objects_early_init();

빌드
fakeroot debian/rules build-generic

부팅 메시지 출력
I'VE Hae Nam Korea Linux Love man

Kernel: arch/x86/boot/bzImage is ready  (#3)

댓글 없음:

댓글 쓰기