[gPXE] Trying to reassemble NBI image
Brian Feeny
bfeeny at mac.com
Sun Oct 10 20:25:55 EDT 2010
So here is some more information about what I am trying to do:
1. disassemble an NBI image
2. modify it
3. re-assemble it
The image I am working on is this:
# disnbi myimage
Type: NBI
Header location: 9220:0000
Start address: 9280:0000
Flags:
Vendor data: mknbi-linux-1.2-6
Segment number 1
Load address: 00092800
Image length: 4608
Memory length: 6144
Position: Absolute
Vendor tag: 16
Segment number 2
Load address: 00092400
Image length: 512
Memory length: 2048
Position: Absolute
Vendor tag: 17
Segment number 3
Load address: 00090000
Image length: 512
Memory length: 512
Position: Absolute
Vendor tag: 18
Segment number 4
Load address: 00090200
Image length: 2560
Memory length: 40448
Position: Absolute
Vendor tag: 19
Segment number 5
Load address: 00100000
Image length: 993280
Memory length: 15728640
Position: Absolute
Vendor tag: 20
Segment number 6
Load address: 001f3000
Image length: 13746176
Memory length: 67108864
Position: Absolute
Vendor tag: 21
Vendor data: " "
Vendor data in hex: 00 00 00 00
Segment number 7
Load address: 02500000
Image length: 0
Memory length: 1204
Position: Absolute
Vendor tag: 22
It extracts into 6 segments that look like this:
# file *
nbidir: Netboot image, mode 2
segment0: DOS executable (COM)
segment1: ASCII text, with no line terminators
segment2: Linux x86 kernel root=0x100-ro vga=normal
segment3: DOS executable (COM)
segment4: data
segment5: gzip compressed data, was "loopback", from Unix, last modified: Sun Oct 10 15:22:36 2010, max compression
segment5 is the one I wanted to modify, its a compressed ext2 filesystem:
# mv segment5 segment5.gz
# gunzip segment5.gz
# file segment5
segment5: Linux rev 1.0 ext2 filesystem data
I mount it and modify away (small changes)
# mount -t ext2 -o loop segment5 /tmp/mount
I make my changes and unmount.
I was not sure what all the different segments were. I thought segment2 would be the kernel, but you can see it's too small:
# ls -al segment*
-rw-r--r-- 1 root root 4608 Oct 10 15:22 segment0
-rw-r--r-- 1 root root 512 Oct 10 15:22 segment1
-rw-r--r-- 1 root root 512 Oct 10 15:22 segment2
-rw-r--r-- 1 root root 2560 Oct 10 15:22 segment3
-rw-r--r-- 1 root root 993280 Oct 10 15:22 segment4
-rw-r--r-- 1 root root 13746858 Oct 10 15:22 segment5
-rw-r--r-- 1 root root 0 Oct 10 15:22 segment6
It looks like segment2 segment3 and segment4 maybe make up the kernel. Not knowing what to do I combined them, and it then showed a bzip kernel type:
# cat segment2 segment3 segment4 > zImage
# file zImage
zImage: Linux x86 kernel root=0x801-ro vga=normal, bzImage, version 2.4.20_mvl31-cpci735 (fas at and-s
I saw segment1 was the parameters:
# cat segment1
rw root=/dev/ram0 rdbase=0x8000000 ip=off ramdisk_size=65536
Once again, I wasn't sure exactly if I was doing this correctly but I tried to re-create the nbi image:
# mknbi-linux zImage --param="rw root=/dev/ram0 rdbase=0x8000000 ip=off
ramdisk_size=65536" --output=kernel /tmp/segment5
This was not successful. It produced a result of "kernel" but it was not a proper image to be booted. I am not building the NBI image file correctly and need some guidance. Can anyone direct me what I may be doing wrong?
I appreciate any help anyone can give me
More information about the gPXE
mailing list