refactor: rewrite kernel's make script
[lunaix-os.git] / lunaix-os / link / linker.ld
index f61e368f19483ee54d69c467bcb9678d9a452819..4ea6b4eecb72d755e225800c1bdb59d6bc3753bf 100644 (file)
@@ -14,20 +14,20 @@ SECTIONS {
 
     .hhk_init_text BLOCK(4K) : {
         * (.multiboot)
-        build/obj/arch/x86/*.o (.hhk_init)
-        build/obj/arch/x86/*.o (.text)
+        arch/*.o (.hhk_init)
+        arch/*.o (.text)
     }
 
     .hhk_init_bss BLOCK(4K) : {
-        build/obj/arch/x86/*.o (.bss)
+        arch/*.o (.bss)
     }
 
     .hhk_init_data BLOCK(4K) : {
-        build/obj/arch/x86/*.o (.data)
+        arch/*.o (.data)
     }
 
     .hhk_init_rodata BLOCK(4K) : {
-        build/obj/arch/x86/*.o (.rodata)
+        arch/*.o (.rodata)
     }
     __init_hhk_end = ALIGN(4K);
 
@@ -37,31 +37,42 @@ SECTIONS {
     /* 好了,我们的内核…… */
     .text BLOCK(4K) : AT ( ADDR(.text) - 0xC0000000 ) {
         __kernel_start = .;
-        build/obj/kernel/*.o (.text)
-        build/obj/hal/*.o (.text)
+        kernel/*.o (.text)
+        hal/*.o (.text)
+        debug/*.o (.text)
+        libs/*.o (.text)
     }
 
-    .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) {
-        build/obj/kernel/*.o (.bss)
-        build/obj/hal/*.o (.bss)
+    __usrtext_start = ALIGN(4K);
+    .usrtext BLOCK(4K) : AT ( ADDR(.usrtext) - 0xC0000000 ) {
+        * (.usrtext)
     }
+    __usrtext_end = ALIGN(4K);
 
-    .data BLOCK(4k) : AT ( ADDR(.data) - 0xC0000000 ) {
-        build/obj/kernel/*.o (.data)
-        build/obj/hal/*.o (.data)
+    .data BLOCK(4K) : AT ( ADDR(.data) - 0xC0000000 ) {
+        kernel/*.o (.data)
+        hal/*.o (.data)
+        debug/*.o (.data)
+        libs/*.o (.data)
     }
 
     .rodata BLOCK(4K) : AT ( ADDR(.rodata) - 0xC0000000 ) {
-        build/obj/kernel/*.o (.rodata)
-        build/obj/hal/*.o (.rodata)
+        kernel/*.o (.rodata)
+        hal/*.o (.rodata)
+        debug/*.o (.rodata)
+        libs/*.o (.rodata)
     }
 
     .kpg BLOCK(4K) : AT ( ADDR(.kpg) - 0xC0000000 ) {
-        build/obj/arch/x86/*.o (.kpg)
+        arch/*.o (.kpg)
+    }
+
+    .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) {
+        kernel/*.o (.bss)
+        hal/*.o (.bss)
+        debug/*.o (.bss)
+        libs/*.o (.bss)
     }
 
     __kernel_end = ALIGN(4K);
-    __proc_table = ALIGN(4K);
-    . += 128M;
-    __kernel_heap_start = ALIGN(4K);    /* 内核结束的地方即堆开始的地方 */
 }
\ No newline at end of file