Page 2 of 2

Re: simple bootsector beginner's problem

Posted: Sat Mar 14, 2009 1:23 pm
by djmauretto
pompon wrote:my notebook ASUS F3Sseries
You have a bad notebook,
Do you know about Trusted Computing ?

Re: simple bootsector beginner's problem

Posted: Sat Mar 14, 2009 3:29 pm
by pompon
Dex wrote:I would like to help, but first i need a problem, i tested your 2nd code on 8 differant PC's and it works on all of them.
Well, as I have written, on PC I obtained "Hello world", but key pressing doesn't cause loop to repeat. On laptop anything doesn't work. Again it's: ASUS F3Sseries, Intel Core 2 Duo T5550. Which other parameters can be important? I'll give them if possible.
JohnnyTheDon wrote:Did you use a long jump to make sure segments are set properly (as was suggested)? That would explain why it works on one computer but not another (bioses can load segments with whatever they want).
Yes, the first thing i'm doing is "ljmp 0x07c0:main". It actually changes the result (comparing to the 2nd code version) but, as I have written, I get only black screen.
djmauretto wrote: You have a bad notebook,
Do you know about Trusted Computing ?
I haven't knew about that untill now (but googling a bit made me feel quite uncomfortable :(). Is really problem so far that I can not boot from my own code :shock: ? Or is it a different suggestion?

Re: simple bootsector beginner's problem

Posted: Sat Mar 14, 2009 8:26 pm
by Dex
pompon wrote:
Dex wrote:I would like to help, but first i need a problem, i tested your 2nd code on 8 differant PC's and it works on all of them.
Well, as I have written, on PC I obtained "Hello world", but key pressing doesn't cause loop to repeat. On laptop anything doesn't work. Again it's: ASUS F3Sseries, Intel Core 2 Duo T5550. Which other parameters can be important? I'll give them if possible.
But using a floppy, on my test PC's it prints hello world then when you press a key it prints it again
hello world
hello world
hello world
hello world
So there could be a problem writing it to the fob, how are you doing this ?.

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 2:53 am
by pompon
Dex wrote: So there could be a problem writing it to the fob, how are you doing this ?.
# nasm main.s -o main.bin
# sudo dd if=main.bin of=/dev/sdb bs=512 count=1
main.s - source code
sdb - flash disk

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 5:25 am
by djmauretto
First of all you must to have an Exadecimal Editor to verify
drive sector or copy to hand binary file to drive.
try to add Bios Parameter Block to your boot sector,
if your usb boot emulate floppy add this:

Code: Select all

	JMP	Start
	NOP

;======================
; Bios Parameter Block
;======================

OEM			DB "Pompon  "
Bytes_per_sector	DW 512		
Sectors_per_cluster	DB 1		
Reserved_sectors	DW 1		
Number_of_FATs		DB 2		
Root_entries		DW 224		
Total_sector_count	DW 2880			; 80*2*18		
Media_descriptor	DB 0F0H			; Floppy
Sectors_per_FAT		DW 9
Sectors_per_track	DW 18
Heads			DW 2
Hidden_sectors		DD 0
Total_sector_FAT32	DD 0			
BIOS_drive		DB 0
Unused			DB 0
Boot_signature		DB 29H				
Volume_ID		DD 0
Volume_label		DB "Boot Sector"
File_system_type	DB "FAT12   "

start:
; your boot code

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 6:51 am
by djmauretto
berkus wrote:I believe Exadecimal Editors were banned on this plane of existence as well as Loathing point calculations.</ot>
:?: :?: :?: :?:
I don't understand ,please rephrase your statment

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 8:04 am
by pompon
YAHOOO!!! djmauretto, thank you very much! I added your code and it simply works :mrgreen: . Now, can you explain me what it actually does and why was it necessary? :D :D :D

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 8:43 am
by Hyperdrive
pompon wrote:YAHOOO!!! djmauretto, thank you very much! I added your code and it simply works :mrgreen: . Now, can you explain me what it actually does and why was it necessary? :D :D :D
BIOSes emulate USB drives in different ways:

(1) Some BIOSes emulate USB drives as a floppy drive and looks for the BIOS Parameter Block (BPB). If it isn't present the BIOS refuses to load and execute the boot sector.

(2) Other BIOSes may emulate USB drives as a hard drive and they don't look for a BPB. So, when there's no BPB they don't care (and they also don't care if there is a BPB).

Your BIOS seems to work as (1). Because you had no BPB included in your boot sector the BIOS thought it wasn't valid and so didn't load/execute your code. Adding the BPB solved that.

--TS

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 8:58 am
by Troy Martin
djmauretto wrote:
berkus wrote:I believe Exadecimal Editors were banned on this plane of existence as well as Loathing point calculations.</ot>
:?: :?: :?: :?:
I don't understand ,please rephrase your statment
Ignore that post :P

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 10:44 am
by djmauretto
pompon wrote:YAHOOO!!! djmauretto, thank you very much! I added your code and it simply works :mrgreen: . Now, can you explain me what it actually does and why was it necessary? :D :D :D
OK ,I'm happy :D
Can you try TCG (Trusted computing group) BIOS function
to verify availability ?
You can use this BIOS function:

Code: Select all

mov  ax,0bb00h                  ; TCG_StatusCheck
int  1ah
test  eax,eax
jnz  TCG_Not_Present
cmp  ebx,41504354h		; 'TCPA' ?
jnz   TCG_Not_Present
add  cx,3030h                    ; CH = Major Version, CL,Minor Version 
call   Print_Version
After that you can hash your boot code with function 7
so it will be trusted :P

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 11:10 am
by pompon
djmauretto wrote: Can you try TCG (Trusted computing group) BIOS function
to verify availability ?
You can use this BIOS function:

Code: Select all

mov  ax,0bb00h                  ; TCG_StatusCheck
int  1ah
test  eax,eax
jnz  TCG_Not_Present
cmp  ebx,41504354h		; 'TCPA' ?
jnz   TCG_Not_Present
add  cx,3030h                    ; CH = Major Version, CL,Minor Version 
call   Print_Version
After that you can hash your boot code with function 7
so it will be trusted :P
Well, I probably don't understand what do you want me to do... I'm working under ubuntu and as I tried to "int 1ah" I've received segfault. shall I try to execute your code from the boot sector? :|

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 11:21 am
by Dex
We did some test here: http://forum.osdev.org/viewtopic.php?f=1&t=19366
Ps: I tryed to tell you there was nothing wrong with the code.

Re: simple bootsector beginner's problem

Posted: Sun Mar 15, 2009 12:17 pm
by djmauretto
pompon wrote:Well, I probably don't understand what do you want me to do... I'm working under ubuntu and as I tried to "int 1ah" I've received segfault. shall I try to execute your code from the boot sector? :|
Yes from boot sector, note that Ubuntu terminal is 32bit not VM86,
anyway it's not important, i'm just curious
about TCG level of your BIOS..
about hash your boot sector so you can avoid that some alter it :-)

Re: simple bootsector beginner's problem

Posted: Mon Mar 16, 2009 2:33 pm
by pompon
djmauretto wrote: Can you try TCG (Trusted computing group) BIOS function
to verify availability ?
Finally, I have tested it with your code and it seems that I don't have TCG.
Thank you once again,
Pompon

Re: simple bootsector beginner's problem

Posted: Tue Mar 17, 2009 3:15 am
by djmauretto
pompon wrote:Finally, I have tested it with your code and it seems that I don't have TCG.
Thank you once again,
Pompon
Thank you for test :wink:
Anyway your Asus F3s has a TPM chip ,only his default status is disable 8)