001 /* Copyright (C) 2004, David Decotigny
002
003 This program is free software; you can redistribute it and/or
004 modify it under the terms of the GNU General Public License
005 as published by the Free Software Foundation; either version 2
006 of the License, or (at your option) any later version.
007
008 This program is distributed in the hope that it will be useful,
009 but WITHOUT ANY WARRANTY; without even the implied warranty of
010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011 GNU General Public License for more details.
012
013 You should have received a copy of the GNU General Public License
014 along with this program; if not, write to the Free Software
015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
016 USA.
017 */
018
019 SECTIONS
020 {
021 /* ***********************************************
022 * The bootsector is here. We link it against the remaining of the kernel
023 * in order to automatically figure out its size that must be loaded
024 * from file to memory (see the load_size definition below)
025 */
026
027 /* If we use one, we put the boot sector here. We don't set its
028 * address to 0x7c000 (aka 0x7c00:0), since it reloads itself to
029 * 0x9f000, causing the 0x7c000 address to be meaningless too. So we
030 * chose to pretend that the address is 0x0, and to make a little
031 * address arithmetic in bootsect.S */
032 .bootsect 0x0 :
033 {
034 /* The code for the boot sector goes here */
035 *(.bootsect);
036
037 /* The load_size symbol contains the size of the area (in
038 * sectors, aka 512 Bytes) that the boot sector should copy from
039 * the disk. The bss section is not included since it uses 0
040 * bytes on disk */
041 load_size = .;
042 LONG((__e_load - __b_load + 511) >> 9);
043 /* ---> This is equivalent to ceil( (__e_load - __b_load) / 512 ) */
044
045 /* At offsets 511 and 512, we set the boot sector signature (AA55h) */
046 . = 0x1fe;
047 SHORT(0xAA55);
048 }
049 }
050
051
052 /* This is to avoid a cut/paste here. Please notice that a multiboot
053 * section WILL be inserted, which is NOT mandatory (we could have
054 * removed it without getting into trouble). Please note however that
055 * the *.bin files will NOT be multiboot compatible (they are not in ELF
056 * format): they are expected to be directly booted by the BIOS (or
057 * by the "chainloader" command of Grub). */
058 INCLUDE ../support/sos.lds
059
060 /* We overload the entry set in sos.lds, just to avoid an ld warning */
061 ENTRY(sos_main);