0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

アセンブラAdvent Calendar 2019

Day 25

wslでubuntu その8

Last updated at Posted at 2019-12-24

概要

wslでkernel開発やってみる。
一連の動きを通しでやってみる。

環境

windows10 64bit

1、wslでコンパイルする。

gcc -c -m32 -nostdlib test5.S
ld -melf_i386 -e_start -Ttext=0x100000 -otest5.elf test5.o
   

サンプルコード

.code32    
.text
.globl _start
.globl multiboot_header

_start:
    movl    $0xb8000, %ebx
    movl    $12, %ecx
    movl    $msg, %esi
loop:
    movb    (%esi), %al
    movb    $2, %ah
    movw    %ax, (%ebx)
    addl    $2, %ebx
    addl    $1, %esi
    subl    $1, %ecx
    jne     loop
    jmp     .

.data
multiboot_header:
    .align 4
    .long   0x1badb002
    .long   0x0 
    .long   -0x1badb002-0x0
msg:
    .ascii "Hello world!"

2、diskexplorerで、nano1.imgにtest5.elfを入れる。

1.jpg

3、qemu-0.15.1で、test5.elfをgrubからbootする。

qemu起動。

qemu -fda nano1.img

grub

root (fd0)
kernel /boot/test5.elf
boot

結果

2.jpg

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?