I have a probleme to boot on my usb key. I have developped a boot sector and I have placed it in sector 0 of my usb key (with command dd if=/home/user/bootsector of=/dev/sdb count=1) and after I have develloped a kernel and I have placed it in sector 1 (dd if=/home/user/bootsector of=/dev/sdb count=1 seek=1).
But only my boot sector is functionnal, the message "Chargement du kernel" display on the boot but not the message "kernel is speaking".
I think that the kernel is not loading correctly in the memory in the boot sector.
I would like to know if the interruption 0x13 is compatible with usb key and if it's compatible, where does my code is false.
Thanks and sorry for my bad english =)
My boot sector code :
Code: Select all
[BITS 16] ; mode reel 16 bits
[ORG 0x0]
mov [bootdev], dl
mov ax, 0x07C0
mov ds, ax
mov es, ax
mov ax, 0x8000
mov ss, ax
mov sp, 0xF000
mov si, msgDebut
call afficher
xor ax, ax
int 0x13 ; initialise la cle usb
push es
mov ax, 0x0100
mov es, ax
mov ah, 0x02; fonction lecture cle usb
mov al, 0x01; 1 secteur a lire
mov cx, 0x0002
mov dh, 0
mov dl, [bootdev]
mov bx, 0
int 0x13; copie le deuxieme secteur du disque en memoire (adresse 0X10000)
pop es
jmp dword 0100:0
afficher:
push ax
push bx
.debut
lodsb
cmp al, 0
jz .fin
mov ah, 0x0E
mov bx, 0x07
int 0x10
jmp .debut
.fin
pop bx
pop ax
ret
msgDebut db "Chargement du kernel ...", 13, 10, 0
bootdev db 0
times 510-($-$$) db 144
dw 0xAA55
Code: Select all
[BITS 16] ; mode reel 16 bits
[ORG 0x0]
mov ax, 0X0100
mov ds, ax
mov es, ax
mov ax, 0x8000
mov ss, ax
mov sp, 0xF000
mov si, msg00
call afficher
end:
jmp end;
afficher:
push ax
push bx
.debut
lodsb
cmp al, 0
jz .fin
mov ah, 0x0E
mov bx, 0x07
int 0x10
jmp .debut
.fin
pop bx
pop ax
ret
msg00 db "Kernel is spiking", 10, 0