2N/A * GRUB -- GRand Unified Bootloader 2N/A * Copyright (C) 2009 Free Software Foundation, Inc. 2N/A * GRUB is free software: you can redistribute it and/or modify 2N/A * it under the terms of the GNU General Public License as published by 2N/A * the Free Software Foundation, either version 3 of the License, or 2N/A * (at your option) any later version. 2N/A * GRUB is distributed in the hope that it will be useful, 2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2N/A * GNU General Public License for more details. 2N/A * You should have received a copy of the GNU General Public License 2N/A /* OF CIF entry point arrives in %o4 */ 2N/A /* The offsets to these locations are defined by the 2N/A * and grub-setup uses this to patch these next three values as needed. 2N/A * The boot_path will be the OF device path of the partition where the 2N/A * rest of the GRUB kernel image resides. kernel_sector will be set to 2N/A * the location of the first block of the GRUB kernel, and 2N/A * kernel_address is the location where we should load that first block. 2N/A * After loading in that block we will execute it by jumping to the 2N/A * load address plus the size of the prepended A.OUT header (32 bytes). 2N/A /* %o0: OF call name 2N/A /* %o2: message string 2N/A * %o3: message length 2N/A /* %o0: OF call name 2N/A /* %o0: OF call name 2N/A /* Find the /chosen node so we can fetch the stdout handle, 2N/A * and thus perform console output. 2N/A * chosen_node = prom_finddevice("/chosen") 2N/A /* getprop(chosen_node, "stdout", &buffer, buffer_size) */ 2N/A /* write(stdout_node, "GRUB ", strlen("GRUB ")) */ 2N/A /* getprop(chosen_node, "bootpath", &buffer, buffer_size) */ 2N/A /* Open up the boot_path, and use that handle to read the 2N/A * first block of the GRUB kernel image. 2N/A * bootdev_handle = open(boot_path) 2N/A /* Since we have 64-bit cells, the high cell of the seek offset 2N/A * is zero and the low cell is the entire value. 2N/A * seek(bootdev, 0, *kernel_byte) 2N/A /* read(bootdev, *kernel_address, 512) */ 2N/A/* the last 4 bytes in the sector 0 contain the signature */