offset = 0; if (align && /* if the alignment is power of 2 and specified, ... */ (bdata->node_boot_start & (align - 1UL)) != 0) /* and the address of bdata->node_boot_start is agree with the alignment */ offset = (align - (bdata->node_boot_start & (align - 1UL))); /* then calculate the offset */ offset >>= PAGE_SHIFT;
bootmem_data_t
Code commentary
typedef struct bootmem_data { unsigned long node_boot_start; /* The start of the bootmem memory (the first page, normally 0). */ unsigned long node_low_pfn; /* Contains the end of low memory of the node. */ void *node_bootmem_map; /* Start of the bootmem bitmap. unsigned long last_offset; /* This is used to store the offset of the last byte allocated in the previous allocation from last pos to avoid internal memory fragmentation */ unsigned long last_pos; /* This is used to store the page frame number of the last page of the previous allocation. It is used in the function alloc bootmem core() to reduce internal fragmentation by merging contiguous memory requests. */
This is the preliminare data to portray the image. About the size, the component size, default root device, and a few others.
.org 497 setup_sects: .byte SETUPSECS // overwritten by tools/build root_flags: .word ROOT_RDONLY syssize: .word SYSSIZE // overwritten by tools/build swap_dev: .word SWAP_DEV ram_size: .word RAMDISK vid_mode: .word SVGA_MODE root_dev: .word ROOT_DEV // overwritten by tools/build // but this would be overwritten // again by command line boot_flag: .word 0xAA55
bad_sig() on setup.S
Note that old bootloaders (old versions of LILO) could only load the first 4 sectors of image (1 for bootsect and 3 for setup), which is why there is code in setup to load the rest of itself if needed (means that setup size > 3 sectors).
How do we know the size of setup ? Yes that's it, via:
tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage Root device is (8, 8) Boot sector 512 bytes. Setup is 2517 bytes. System is 351 kB
See !, the arch/i386/boot/tools/build.c patches the size to the bootsect.S. And then any loader could load how many bytes from the kernel image for setup. What about the offset? setup is always patched right after bootsect, and the bootsect size is always 512 Bytes. Then you've sould got the idea.
Anonymous (not verified): OpenLDAP is a neat tool, but somehow it will bring you pain in the ass if you can't manage it well enough. This tips is intended to people whom they have some difficulty remembering so many thing in their head, because they only have 10 MB neural memory.1 year 2 days ago
Anonymous (not verified): Allah memberimu inspirasi agar kepada-Nya engkau mendekati1 year 2 days ago
Anonymous (not verified): good1 year 2 days ago
danang.wijanarko: wup, mas iya nih kerjaan numpuk2 soalnya ...1 year 16 weeks ago
Anonymous (not verified): mas alhikamnya tolong ditulis lg saya sgt antusias je,..ditunggu y mas,..terima kasih1 year 18 weeks ago
danang: x10i was just awesome ...1 year 26 weeks ago
Mitchel (not verified): I love your site, neat and nice ...1 year 30 weeks ago
smith: what is this site ?1 year 32 weeks ago
danang (not verified): @ adam request anda sudah terpenuhi :)1 year 32 weeks ago
danang (not verified): @ azhar, salam1 year 32 weeks ago