Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e5023f)
raw | patch | inline | side by side (parent: 7e5023f)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Mon, 29 Dec 2025 11:10:21 +0000 (19:10 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Mon, 29 Dec 2025 11:10:21 +0000 (19:10 +0800) |
| .gitignore | patch | blob | history | |
| boot/boot.c | patch | blob | history | |
| boot/multiboot.S | patch | blob | history | |
| mkiso.sh | patch | blob | history | |
| scripts/iso.grub.cfg | patch | blob | history |
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
initfs
rootfs
**/init
-
+*.log
diff --git a/boot/boot.c b/boot/boot.c
--- a/boot/boot.c
+++ b/boot/boot.c
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();
break;
case MULTIBOOT_TAG_TYPE_FRAMEBUFFER:
printk("frame buffer\n");
+ parse_framebuffer(tag);
break;
case MULTIBOOT_TAG_TYPE_ELF_SECTIONS:
{
diff --git a/boot/multiboot.S b/boot/multiboot.S
--- a/boot/multiboot.S
+++ b/boot/multiboot.S
# 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
diff --git a/mkiso.sh b/mkiso.sh
--- a/mkiso.sh
+++ b/mkiso.sh
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 .
diff --git a/scripts/iso.grub.cfg b/scripts/iso.grub.cfg
--- a/scripts/iso.grub.cfg
+++ b/scripts/iso.grub.cfg
#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
}