请问能不能把bbiagent这个软盘上的内容放到硬盘上来,从硬盘上来启动?
我不太懂liunx
请问能不能把bbiagent这个软盘上的内容放到硬盘上来,从硬盘上来启动?
我不太懂liunx
应该可以的!用一下cp试一下嘛!
没这么容易吧,说得详细些好吗
不行,除非你重写启动部分,它是直接控制软驱读写,用虚拟软驱都不行。
也刻不起光盘
bbi的启动部分
:0001.0000 B8C007 mov ax, 07C0
:0001.0003 8ED8 mov ds, ax
:0001.0005 B80090 mov ax, 9000
:0001.0008 8EC0 mov es, ax
:0001.000A B90001 mov cx, 0100
:0001.000D 29F6 sub si, si
:0001.000F 29FF sub di, di
:0001.0011 FC cld
:0001.0012 F3 repz
:0001.0013 A5 movsw
:0001.0014 EA19000090 jmp 9000:0019
以上:把自已从地址0x00007c00移动到0x00090000;
以下:段址0001都变成9000
:0001.0019 BFF43F mov di, 3FF4
:0001.001C 8ED8 mov ds, ax
:0001.001E 8ED0 mov ss, ax
:0001.0020 89FC mov sp, di
:0001.0022 8EE1 mov fs, cx
:0001.0024 BB7800 mov bx, 0078
:0001.0027 1E push ds
:0001.0028 64C537 lds si, fs:[bx]
:0001.002B B106 mov cl, 06
:0001.002D 57 push di
:0001.002E F3 repz
:0001.002F A5 movsw
:0001.0030 5F pop di
:0001.0031 1F pop ds
:0001.0032 C6450424 mov byte ptr [di+04], 24
:0001.0036 64893F mov fs:[bx], di
:0001.0039 648C4702 mov fs:[bx+02], es
:0001.003D BEC601 mov si, 01C6
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0056(C)
|
:0001.0040 AC lodsb
:0001.0041 98 cbw
:0001.0042 A3C401 mov word ptr [01C4], ax
:0001.0045 81FECA01 cmp si, 01CA
:0001.0049 730D jnb 0058
:0001.004B 91 xchg ax,cx
:0001.004C 31D2 xor dx, dx
:0001.004E BB0002 mov bx, 0200
:0001.0051 B80102 mov ax, 0201
:0001.0054 CD13 int 13
:0001.0056 72E8 jb 0040
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0049(C)
|
:0001.0058 B403 mov ah, 03
:0001.005A 30FF xor bh, bh
:0001.005C CD10 int 10
:0001.005E B90900 mov cx, 0009
:0001.0061 B307 mov bl, 07
:0001.0063 BDCA01 mov bp, 01CA
:0001.0066 B80113 mov ax, 1301
:0001.0069 CD10 int 10
:0001.006B B80100 mov ax, 0001
:0001.006E BED500 mov si, 00D5
:0001.0071 8904 mov [si], ax
:0001.0073 31C0 xor ax, ax
:0001.0075 30D2 xor dl, dl
:0001.0077 CD13 int 13
:0001.0079 BB0002 mov bx, 0200
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.009B(C)
|
:0001.007C 8A06F101 mov al , [01F1]
:0001.0080 8B0EC401 mov cx, [01C4]
:0001.0084 2B0C sub cx, [si]
:0001.0086 38C8 cmp al , cl
:0001.0088 7605 jbe 008F
:0001.008A A1C401 mov ax, word ptr [01C4]
:0001.008D 2B04 sub ax, [si]
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0088(C)
|
:0001.008F E87C00 call 010E
:0001.0092 50 push ax
:0001.0093 E8A300 call 0139
:0001.0096 58 pop ax
:0001.0097 2806F101 sub [01F1], al
:0001.009B 75DF jne 007C
:0001.009D 680010 push 1000
:0001.00A0 07 pop es
:0001.00A1 E83700 call 00DB
:0001.00A4 E81601 call 01BD
:0001.00A7 E8F000 call 019A
:0001.00AA A1FC01 mov ax, word ptr [01FC]
:0001.00AD 09C0 or ax, ax
:0001.00AF 751C jne 00CD
:0001.00B1 8B1EC401 mov bx, [01C4]
:0001.00B5 B80802 mov ax, 0208
:0001.00B8 83FB0F cmp bx, 000F
:0001.00BB 7410 je 00CD
:0001.00BD B01C mov al, 1C
:0001.00BF 83FB12 cmp bx, 0012
:0001.00C2 7409 je 00CD
:0001.00C4 B020 mov al, 20
:0001.00C6 83FB24 cmp bx, 0024
:0001.00C9 7402 je 00CD
:0001.00CB B000 mov al, 00
Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
|:0001.00AF(C), :0001.00BB(C), :0001.00C2(C), :0001.00C9(C)
|
:0001.00CD A3FC01 mov word ptr [01FC], ax
:0001.00D0 EA00002090 jmp 9020:0000
:0001.00D5 000000000000 BYTE 6 DUP(0)
Referenced by a CALL at Address:
|:0001.00A1
|
:0001.00DB 8CC0 mov ax, es
:0001.00DD A9FF0F test ax, 0FFF
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.00E0(C)
|
:0001.00E0 75FE jne 00E0
:0001.00E2 31DB xor bx, bx
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.010C(U)
|
:0001.00E4 FF1E2002 call far word ptr [0220]
:0001.00E8 3B06F401 cmp ax, [01F4]
:0001.00EC 7601 jbe 00EF
:0001.00EE C3 ret
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.00EC(C)
|
:0001.00EF A1C401 mov ax, word ptr [01C4]
:0001.00F2 2B04 sub ax, [si]
:0001.00F4 89C1 mov cx, ax
:0001.00F6 C1E109 shl cx, 09
:0001.00F9 01D9 add cx, bx
:0001.00FB 7309 jnb 0106
:0001.00FD 7407 je 0106
:0001.00FF 31C0 xor ax, ax
:0001.0101 29D8 sub ax, bx
:0001.0103 C1E809 shr ax, 09
Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
|:0001.00FB(C), :0001.00FD(C)
|
:0001.0106 E80500 call 010E
:0001.0109 E82D00 call 0139
:0001.010C EBD6 jmp 00E4
Referenced by a CALL at Addresses:
|:0001.008F, :0001.0106
|
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0171(U)
|
:0001.010E 60 pusha
:0001.010F 60 pusha
:0001.0110 B82E0E mov ax, 0E2E
:0001.0113 BB0700 mov bx, 0007
:0001.0116 CD10 int 10
:0001.0118 61 popa
:0001.0119 8B5404 mov dx, [si+04]
:0001.011C 8B0C mov cx, [si]
:0001.011E 41 inc cx
:0001.011F 88D5 mov ch, dl
:0001.0121 8B5402 mov dx, [si+02]
:0001.0124 88D6 mov dh, dl
:0001.0126 81E20001 and dx, 0100
:0001.012A B402 mov ah, 02
:0001.012C 52 push dx
:0001.012D 51 push cx
:0001.012E 53 push bx
:0001.012F 50 push ax
:0001.0130 CD13 int 13
:0001.0132 722F jb 0163
:0001.0134 83C408 add sp, 0008
:0001.0137 61 popa
:0001.0138 C3 ret
Referenced by a CALL at Addresses:
|:0001.0093, :0001.0109
|
:0001.0139 89C1 mov cx, ax
:0001.013B 0304 add ax, [si]
:0001.013D 3B06C401 cmp ax, [01C4]
:0001.0141 750D jne 0150
:0001.0143 B80100 mov ax, 0001
:0001.0146 314402 xor [si+02], ax
:0001.0149 7503 jne 014E
:0001.014B FF4404 inc word ptr [si+04]
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0149(C)
|
:0001.014E 31C0 xor ax, ax
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0141(C)
|
:0001.0150 8904 mov [si], ax
:0001.0152 C1E109 shl cx, 09
:0001.0155 01CB add bx, cx
:0001.0157 7309 jnb 0162
:0001.0159 8CC0 mov ax, es
:0001.015B 80C410 add ah, 10
:0001.015E 8EC0 mov es, ax
:0001.0160 31DB xor bx, bx
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0157(C)
|
:0001.0162 C3 ret
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.0132(C)
|
:0001.0163 50 push ax
:0001.0164 E80C00 call 0173
:0001.0167 30E4 xor ah, ah
:0001.0169 30D2 xor dl, dl
:0001.016B CD13 int 13
:0001.016D 83C40A add sp, 000A
:0001.0170 61 popa
:0001.0171 EB9B jmp 010E
Referenced by a CALL at Address:
|:0001.0164
|
:0001.0173 B90500 mov cx, 0005
:0001.0176 89E5 mov bp, sp
:0001.0178 51 push cx
:0001.0179 E81E00 call 019A
:0001.017C 80F905 cmp cl, 05
:0001.017F 730F jnb 0190
:0001.0181 B8450E mov ax, 0E45
:0001.0184 28C8 sub al , cl
:0001.0186 CD10 int 10
:0001.0188 B058 mov al, 58
:0001.018A CD10 int 10
:0001.018C B03A mov al, 3A
:0001.018E CD10 int 10
Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0001.017F(C)
|
:0001.0190 83C502 add bp, 0002
:0001.0193 E80E00 call 01A4
:0001.0196 59 pop cx
:0001.0197 E2DF loop 0178
:0001.0199 C3 ret
Referenced by a CALL at Addresses:
|:0001.00A7, :0001.0179
|
:0001.019A B80D0E mov ax, 0E0D
:0001.019D CD10 int 10
:0001.019F B00A mov al, 0A
:0001.01A1 CD10 int 10
:0001.01A3 C3 ret
Referenced by a CALL at Address:
|:0001.0193
|
:0001.01A4 B90400 mov cx, 0004
:0001.01A7 8B5600 mov dx, [bp]
:0001.01AA C1C204 rol dx, 04
:0001.01AD B80F0E mov ax, 0E0F
:0001.01B0 20D0 and al , dl
:0001.01B2 0490 add al, 90
:0001.01B4 27 daa
:0001.01B5 1440 adc al, 40
:0001.01B7 27 daa
:0001.01B8 CD10 int 10
:0001.01BA E2EE loop 01AA
:0001.01BC C3 ret
Referenced by a CALL at Address:
|:0001.00A4
|
:0001.01BD 31C0 xor ax, ax
:0001.01BF 30D2 xor dl, dl
:0001.01C1 CD13 int 13
:0001.01C3 C3 ret
从软盘启动Linux
从软盘启动时,存储在软盘第一扇区的指令将被加载并执行。这个指令然后就会把其余的内核复制到内存中。
Linux内核可以装在1.44MB的软盘里,不过为了减少磁盘占用量,它们都进行了压缩。这个压缩过程是在编译时完成的,而解压缩的过程则由自举程序完成。
从软盘启动Linux时,自举程序要做的工作非常简单。它是一个位于/usr/src/linux-2.4.2/arch/i386/boot/bootsect.S的汇编语言文件。当我们编译Linux内核源代码,或者获取一个新的内核时,这个可执行的汇编代码就会被放在内核程序的前端。由此可见,要制作一个可启动的Linux软盘其实很简单。我们只要从磁盘的第一个扇区拷贝Linux内核,就可以创建一个可启动软盘。当BIOS加载软盘的第一个扇区时,它实际上拷贝的是自举程序。自举程序由BIOS调用(跳到物理地址为0x00007c00的位置),然后执行以下的操作:
(1)把自已从地址0x00007c00移动到0x00090000;
(2)使用地址0x00003ff4,创建“实模式”栈;
(3)设置磁盘参数表,这里使用的是BIOS提供的软盘驱动程序;
(4)通过调用BIOS程序显示“Loading”信息;
(5)自举程序调用BIOS程序来加载软盘上内核的setup()函数,并把它放在起始地址为0x00090200的内存中;
(6)接下来自举程序调用一个BIOS程序,这个程序从软盘加载剩余的内核程序,并将其放入起始地址为0x00010000(所谓的低地址)或者0x00100000(所谓的高地址);
(7)然后,跳转到setup()函数。
2.从硬盘启动Linux
当系统从硬盘启动时,启动过程又有所不同。硬盘的第一个扇区叫做MBR(Master Boot Record),其上存储着分区表和一个小程序。这个程序加载存储由操作系统的第一扇区来开始启动。Linux是一个高度灵活且非常优秀的软件,所以在MBR里,它使用一个叫做LILO的程序来代替上述的那个程序。LILO允许用户选择所要启动的操作系统。
一般来说,Linux是从硬盘启动的。这就需要不同的自举程序。在Intel系统里,用得最多的自举程序就是LILO。对于其它的体系结构,还存在着别的自举程序。LILO可以安装在MBR上(请注意:在安装Red Hat Linux时,有一个步骤会让用户选择把LILO安装到MBR或者引导扇区)或一个活动分区的引导扇区上。
由于LILO太大,MBR无法容纳,所以它被分成两部分。MBR(或者磁盘分区的引导扇区)包含有一个小的自举程序,它被BIOS载入到起始地址为0x00007c00的内存中。然后,这个小程序再把自己移到0x0009a000地址处,接着设置实模式栈,最后加载第二部分的LILO自举程序(请注意:实模式栈地址范围是0x0009b000 到 0x0009a200)。
第二部分的LILO会从磁盘读取所有可用的操作系统,并且给用户列出,以选择所要启动的系统。一旦用户选择完成,自举程序就会加载相应的扇区内容到内存中并且执行之。
自举程序被BIOS调用时(跳到物理地址为0x00007c00处),要执行以下操作:
(1)把自已从地址0x00007c00移动到0x00090000;
(2)使用地址0x00003ff4,创建“实模式”栈;
(3)设置磁盘参数表。这里使用的是BIOS提供的软盘驱动程序;
(4)通过调用BIOS程序显示“Loading Linux”信息;
(5)自举程序调用BIOS程序来加载软盘上内核的setup()函数,并把它放在起始地址为0x00090200的内存中;
(6)接下来自举程序调用一个BIOS程序,这个程序从软盘加载剩余的内核程序,并将其放入起始地址为0x00010000或者0x00100000;
(7)然后,跳转到setup()函数。