]> Zhao Yanbai Git Server - kernel.git/commitdiff
图形模式的进一步测试
authoracevest <zhaoyanbai@126.com>
Mon, 29 Dec 2025 11:10:21 +0000 (19:10 +0800)
committeracevest <zhaoyanbai@126.com>
Mon, 29 Dec 2025 11:10:21 +0000 (19:10 +0800)
.gitignore
boot/boot.c
boot/multiboot.S
mkiso.sh
scripts/iso.grub.cfg

index 6b0ccfb1cfcd0c303fdaf70b2030542a682c7b9f..27c3157a9d5afa5f246303a4c9470adb20ef12ec 100644 (file)
@@ -45,4 +45,4 @@ initrd
 initfs
 rootfs
 **/init
-
+*.log
index a1dfb90271ddaf20ff17513e24d83025c9d8f523..1b2905b9ecadf36513961f071d60e0bf2fa48720 100644 (file)
@@ -57,6 +57,27 @@ void set_tss();
 void setup_i8254(uint16_t);
 void setup_boot_irqs();
 
+void parse_framebuffer(void *addr) {
+    struct multiboot_tag_framebuffer *fb = (struct multiboot_tag_framebuffer *)addr;
+    if(0 == fb) {
+        printk("no framebuffer info\n");
+    }
+
+    uint32_t type = fb->common.type;
+    uint32_t size = fb->common.size;
+    uint64_t fb_addr = fb->common.framebuffer_addr;
+    uint32_t fb_pitch = fb->common.framebuffer_pitch;
+    uint32_t fb_width = fb->common.framebuffer_width;
+    uint32_t fb_height = fb->common.framebuffer_height;
+    uint8_t fb_bpp = fb->common.framebuffer_bpp;
+    uint8_t fb_type = fb->common.framebuffer_type;
+
+    printk("type %u size %u addr %lx pitch %u width %u height %u bpp %u type %u\n",
+            type, size, fb_addr, fb_pitch, fb_width, fb_height, fb_bpp, fb_type);
+
+
+}
+
 
 void check_kernel(unsigned long addr, unsigned long magic) {
     init_serial();
@@ -187,6 +208,7 @@ void check_kernel(unsigned long addr, unsigned long magic) {
             break;
         case MULTIBOOT_TAG_TYPE_FRAMEBUFFER:
             printk("frame buffer\n");
+            parse_framebuffer(tag);
             break;
         case MULTIBOOT_TAG_TYPE_ELF_SECTIONS:
             {
index 1e6d69f56c3a83178e9804026efacbc25318bc01..fa76874c9d7326dd851b1e2bd68d29ef4ccc2adf 100644 (file)
@@ -130,27 +130,33 @@ multiboot2_header_bgn:
     # checksum
     .long   -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot2_header_end - multiboot2_header_bgn))
 
-    // .align 8
-    // .framebuffer_tag_bgn:
-    // .short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
-    // .short MULTIBOOT_HEADER_TAG_OPTIONAL
-    // .long .framebuffer_tag_end - .framebuffer_tag_bgn
-    // # width
-    // # Contains the number of the columns. This is specified in pixels in a graphics mode,
-    // # and in characters in a text mode.
-    // # The value zero indicates that the OS image has no preference.
-    // .long 1024
-    // # height
-    // # Contains the number of the lines. This is specified in pixels in a graphics mode,
-    // # and in characters in a text mode.
-    // # The value zero indicates that the OS image has no preference.
-    // .long 768
-    // # depth
-    // # Contains the number of bits per pixel in a graphics mode, and zero in a text mode.
-    // # The value zero indicates that the OS image has no preference.
-    // .long 32
-    // .framebuffer_tag_end:
-
+#if 1
+    /* === Framebuffer Tag === */
+    .align 8
+    .framebuffer_tag_bgn:
+    .short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
+    .short MULTIBOOT_HEADER_TAG_OPTIONAL
+    .long .framebuffer_tag_end - .framebuffer_tag_bgn
+
+    # width
+    # Contains the number of the columns. This is specified in pixels in a graphics mode,
+    # and in characters in a text mode.
+    # The value zero indicates that the OS image has no preference.
+    .long 0
+
+    # height
+    # Contains the number of the lines. This is specified in pixels in a graphics mode,
+    # and in characters in a text mode.
+    # The value zero indicates that the OS image has no preference.
+    .long 0
+
+    # depth
+    # Contains the number of bits per pixel in a graphics mode, and zero in a text mode.
+    # The value zero indicates that the OS image has no preference.
+    .long 0
+
+    .framebuffer_tag_end:
+#endif
     // // .align 2
     // .multiboot2_header_tag_module:
     // .short MULTIBOOT_HEADER_TAG_MODULE_ALIGN
index 3b3645fbbe8918652b601cd32d8430c046718e06..36180e85c47333c5fae26adc653a36ff973e4ecc 100755 (executable)
--- a/mkiso.sh
+++ b/mkiso.sh
@@ -68,7 +68,7 @@ for i in "${!files[@]}"; do
 done
 
 #docker exec -it $CONTAINER_ID /usr/bin/grub2-mkrescue -o /tmp/kernel.iso /tmp/iso/
-docker exec -it $CONTAINER_ID bash -c "cd /tmp && grub2-mkrescue -o kernel.iso /tmp/iso/"
+docker exec -it $CONTAINER_ID bash -c "cd /tmp && grub2-mkrescue -o kernel.iso --modules=\"video video_bochs video_cirrus vbe\" /tmp/iso/"
 
 
 docker cp $CONTAINER_ID:/tmp/kernel.iso .
index c245630173de5e47aa647e6ab4d7db76ce2be2ad..a18af786a8a6287af8fd502d1664be969e49c844 100644 (file)
@@ -1,17 +1,26 @@
 #serial --unit=0 --speed=115200
-serial --unit=0
-terminal_input serial
-terminal_output serial
+#serial --unit=0
+#terminal_input serial
+#terminal_output serial
+#terminal_output serial_com0
 
 
+load_video
+set gfxmode=auto
+set gfxpayload=keep
+terminal_output gfxterm
+
 set default="0"
 set timeout=0
 menuentry 'Kernel' --class os {
     #insmod ext2
     #set gfxpayload=1024x768x32
     #insmod all_video
+    #set gfxmode=auto
+    #set gfxmode=auto
     multiboot2 /boot/Kernel root=hda7 delay=2
     module2 /boot/rootfs rootfs
     #module2 /boot/init init
+    videoinfo
     boot
 }