2004-03-29 Marco Gerards <metgerards@student.han.nl>
Add support for the newworld apple macintosh (PPC). This has been tested on the powerbook 2000 only. It only adds support for generic ieee1275 functions, console and disk support. This should be easy to port to other architectures with support for Open Firmware. * configure.ac: Accept the powerpc as host_cpu. In the case of the powerpc cpu set the host_vendor to ieee1275. Make sure the i386 specific tests are only executed while building for the i386. Inverse test for crosscompile. * genmk.rb (Utility): Allow assembler files. * normal/cmdline.c (pupa_tab_complete): Reset pupa_errno. * conf/powerpc-ieee1275.rmk: New file. * disk/powerpc/ieee1275/ofdisk.c: Likewise. * disk/powerpc/ieee1275/partition.c: Likewise. * include/pupa/powerpc/ieee1275/biosdisk.h: Likewise. * include/pupa/powerpc/ieee1275/console.h: Likewise. * include/pupa/powerpc/ieee1275/partition.h: Likewise. * include/pupa/powerpc/ieee1275/time.h: Likewise. * include/pupa/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/pupa/powerpc/ieee1275/multiboot.h: Likewise. * include/pupa/powerpc/ieee1275/loader.h * include/pupa/powerpc/setjmp.h: Likewise. * include/pupa/powerpc/types.h: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * term/powerpc/ieee1275/ofconsole.c: Likewise. These files were written by Johan Rydberg (jrydberg@night.trouble.net) and I only modified them slightly. * boot/powerpc/ieee1275/cmain.c: New file. * boot/powerpc/ieee1275/crt0.S: Likewise. * boot/powerpc/ieee1275/ieee1275.c: Likewise. * include/pupa/powerpc/ieee1275/ieee1275.h: Likewise.
This commit is contained in:
parent
8c8cc20511
commit
e56cdf2111
25 changed files with 2768 additions and 22 deletions
38
ChangeLog
38
ChangeLog
|
@ -1,3 +1,41 @@
|
|||
2004-03-29 Marco Gerards <metgerards@student.han.nl>
|
||||
|
||||
Add support for the newworld apple macintosh (PPC). This has been
|
||||
tested on the powerbook 2000 only. It only adds support for
|
||||
generic ieee1275 functions, console and disk support. This should
|
||||
be easy to port to other architectures with support for Open
|
||||
Firmware.
|
||||
|
||||
* configure.ac: Accept the powerpc as host_cpu. In the case of
|
||||
the powerpc cpu set the host_vendor to ieee1275. Make sure the i386
|
||||
specific tests are only executed while building for the i386.
|
||||
Inverse test for crosscompile.
|
||||
* genmk.rb (Utility): Allow assembler files.
|
||||
* normal/cmdline.c (pupa_tab_complete): Reset pupa_errno.
|
||||
* conf/powerpc-ieee1275.rmk: New file.
|
||||
* disk/powerpc/ieee1275/ofdisk.c: Likewise.
|
||||
* disk/powerpc/ieee1275/partition.c: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/biosdisk.h: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/console.h: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/partition.h: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/time.h: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/util/biosdisk.h: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/multiboot.h: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/loader.h
|
||||
* include/pupa/powerpc/setjmp.h: Likewise.
|
||||
* include/pupa/powerpc/types.h: Likewise.
|
||||
* kern/powerpc/ieee1275/init.c: Likewise.
|
||||
* kern/powerpc/ieee1275/openfw.c: Likewise.
|
||||
* term/powerpc/ieee1275/ofconsole.c: Likewise.
|
||||
|
||||
These files were written by Johan Rydberg
|
||||
(jrydberg@night.trouble.net) and I only modified them slightly.
|
||||
|
||||
* boot/powerpc/ieee1275/cmain.c: New file.
|
||||
* boot/powerpc/ieee1275/crt0.S: Likewise.
|
||||
* boot/powerpc/ieee1275/ieee1275.c: Likewise.
|
||||
* include/pupa/powerpc/ieee1275/ieee1275.h: Likewise.
|
||||
|
||||
2004-03-14 Jeroen Dekkers <jeroen@dekkers.cx>
|
||||
|
||||
* Makefile.in: Update copyright.
|
||||
|
|
148
boot/powerpc/ieee1275/cmain.c
Normal file
148
boot/powerpc/ieee1275/cmain.c
Normal file
|
@ -0,0 +1,148 @@
|
|||
/* cmain.c - Startup code for the PowerPC. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <alloca.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "pupa/machine/ieee1275.h"
|
||||
#include "pupa/kernel.h"
|
||||
|
||||
struct module_info
|
||||
{
|
||||
uint32_t start;
|
||||
uint32_t end;
|
||||
};
|
||||
|
||||
#define roundup(a, s) (((a) + ((s) - 1)) & ~((s) - 1))
|
||||
|
||||
/* OpenFirmware entry point passed to us from the real bootloader. */
|
||||
intptr_t (*pupa_ieee1275_entry_fn) (void *);
|
||||
|
||||
|
||||
/* Return a help text for this architecture. */
|
||||
const char *
|
||||
help_arch (void)
|
||||
{
|
||||
/* No special information. */
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/* Setup the argument vector and pass control over to the main
|
||||
function. */
|
||||
void
|
||||
cmain (uint32_t firmware_entry)
|
||||
{
|
||||
char **argv, args[256];
|
||||
pupa_ieee1275_phandle_t chosen;
|
||||
int argc = 0, actual;
|
||||
long batl, batu;
|
||||
|
||||
pupa_ieee1275_entry_fn = (intptr_t (*)(void *)) firmware_entry;
|
||||
|
||||
/* Initialize BAT registers to unmapped to not generate overlapping
|
||||
mappings below. */
|
||||
asm volatile ("mtibatu 0,%0" :: "r"(0));
|
||||
asm volatile ("mtibatu 1,%0" :: "r"(0));
|
||||
asm volatile ("mtibatu 2,%0" :: "r"(0));
|
||||
asm volatile ("mtibatu 3,%0" :: "r"(0));
|
||||
asm volatile ("mtdbatu 0,%0" :: "r"(0));
|
||||
asm volatile ("mtdbatu 1,%0" :: "r"(0));
|
||||
asm volatile ("mtdbatu 2,%0" :: "r"(0));
|
||||
asm volatile ("mtdbatu 3,%0" :: "r"(0));
|
||||
|
||||
/* Set up initial BAT table to only map the lowest 256 MB area. */
|
||||
batl = 0x00000000 | 0x10 | 0x02;
|
||||
batu = 0x00000000 | 0x1ffc | 0x02;
|
||||
|
||||
/* IBAT0 used for initial 256 MB segment */
|
||||
asm volatile ("mtibatl 3,%0; mtibatu 3,%1" :: "r" (batl), "r" (batu));
|
||||
/* DBAT0 used similar */
|
||||
asm volatile ("mtdbatl 3,%0; mtdbatu 3,%1" :: "r" (batl), "r" (batu));
|
||||
asm ("isync");
|
||||
|
||||
/* If any argument was passed to the kernel (us), they are
|
||||
put in the bootargs property of /chosen. The string can
|
||||
be null (just the nul-character), so check that the size
|
||||
is actually greater than one. */
|
||||
|
||||
pupa_ieee1275_finddevice ("/chosen", &chosen);
|
||||
if (pupa_ieee1275_get_property (chosen, "bootargs", args,
|
||||
sizeof args, &actual) == 0
|
||||
&& actual > 1)
|
||||
{
|
||||
/* A command line was passed. */
|
||||
char *str = args;
|
||||
int nr = 1;
|
||||
|
||||
/* First time around we count the number of arguments. */
|
||||
argc = 2;
|
||||
while (*str && *str == ' ')
|
||||
str++;
|
||||
|
||||
while (*str)
|
||||
if (*(str++) == ' ')
|
||||
{
|
||||
while (*str && *str == ' ')
|
||||
str++;
|
||||
if (*str)
|
||||
argc++;
|
||||
}
|
||||
argv = alloca (sizeof (char *) * (argc + 2));
|
||||
|
||||
/* The bootargs property does not contain the program
|
||||
name, just the arguments. */
|
||||
argv[0] = "pupa";
|
||||
|
||||
/* Second time around we fill in the argv. */
|
||||
str = args;
|
||||
|
||||
while (*str && *str == ' ')
|
||||
str++;
|
||||
argv[nr++] = str;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
if (*str == ' ')
|
||||
{
|
||||
*(str++) = '\0';
|
||||
while (*str && *str == ' ')
|
||||
str++;
|
||||
if (*str)
|
||||
argv[nr++] = str;
|
||||
}
|
||||
else
|
||||
str++;
|
||||
}
|
||||
argv[nr] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
argv = alloca (sizeof (char *) * 2);
|
||||
argv[0] = "pupa";
|
||||
argv[1] = 0;
|
||||
argc = 1;
|
||||
}
|
||||
/* Now invoke the main function. */
|
||||
/* XXX: pupa_main does not parse arguments yet. */
|
||||
pupa_main ();
|
||||
|
||||
/* Never reached. */
|
||||
}
|
55
boot/powerpc/ieee1275/crt0.S
Normal file
55
boot/powerpc/ieee1275/crt0.S
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* crt0.S - Startup code for the PowerPC. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
.section ".note"
|
||||
.align 2
|
||||
.note_section_header:
|
||||
.long 8
|
||||
.long 24
|
||||
.long 0x1275
|
||||
.string "PowerPC"
|
||||
.note_descriptor:
|
||||
.long 0x0 /* real-mode */
|
||||
.long 0xffffffff /* real-base */
|
||||
.long 0xffffffff /* real-size */
|
||||
.long 0xffffffff /* virt-base */
|
||||
.long 0xffffffff /* virt-size */
|
||||
.long 0x00030000 /* load-base */
|
||||
|
||||
.text
|
||||
.align 2
|
||||
.globl _start
|
||||
_start:
|
||||
lis 1, init_stack@ha
|
||||
la 1, init_stack@l(1)
|
||||
addi 1, 1, -32
|
||||
|
||||
li 2, 0
|
||||
li 13, 0
|
||||
|
||||
|
||||
mr 3, 5
|
||||
bl cmain
|
||||
1: b 1b
|
||||
|
||||
.section ".bss"
|
||||
.lcomm _ppc_init_stack, 4096*2, 16
|
||||
init_stack:
|
||||
|
475
boot/powerpc/ieee1275/ieee1275.c
Normal file
475
boot/powerpc/ieee1275/ieee1275.c
Normal file
|
@ -0,0 +1,475 @@
|
|||
/* ieee1275.c - Access the Open Firmware client interface. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <pupa/machine/ieee1275.h>
|
||||
|
||||
|
||||
#define IEEE1275_PHANDLE_ROOT ((pupa_ieee1275_phandle_t) 0)
|
||||
#define IEEE1275_PHANDLE_INVALID ((pupa_ieee1275_phandle_t) -1)
|
||||
|
||||
intptr_t (*pupa_ieee1275_entry_fn) (void *);
|
||||
|
||||
#ifndef IEEE1275_CALL_ENTRY_FN
|
||||
#define IEEE1275_CALL_ENTRY_FN(args) (*pupa_ieee1275_entry_fn) (args)
|
||||
#endif
|
||||
|
||||
/* All backcalls to the firmware is done by calling an entry function
|
||||
which was passed to us from the bootloader. When doing the backcall,
|
||||
a structure is passed which specifies what the firmware should do.
|
||||
NAME is the requested service. NR_INS and NR_OUTS is the number of
|
||||
passed arguments and the expected number of return values, resp. */
|
||||
struct pupa_ieee1275_common_hdr
|
||||
{
|
||||
char *name;
|
||||
int nr_ins;
|
||||
int nr_outs;
|
||||
};
|
||||
|
||||
#define INIT_IEEE1275_COMMON(p, xname, xins, xouts) \
|
||||
(p)->name = xname; (p)->nr_ins = xins; (p)->nr_outs = xouts
|
||||
|
||||
/* FIXME is this function needed? */
|
||||
pupa_uint32_t
|
||||
pupa_ieee1275_decode_int_4 (unsigned char *p)
|
||||
{
|
||||
pupa_uint32_t val = (*p++ << 8);
|
||||
val = (val + *p++) << 8;
|
||||
val = (val + *p++) << 8;
|
||||
return (val + *p);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pupa_ieee1275_finddevice (char *name, pupa_ieee1275_phandle_t *phandlep)
|
||||
{
|
||||
struct find_device_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
char *device;
|
||||
pupa_ieee1275_phandle_t phandle;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "finddevice", 1, 1);
|
||||
args.device = name;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*phandlep = args.phandle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_get_property (int handle, const char *property, void *buf,
|
||||
pupa_size_t size, pupa_size_t *actual)
|
||||
{
|
||||
struct get_property_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t phandle;
|
||||
const char *prop;
|
||||
void *buf;
|
||||
int buflen;
|
||||
int size;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "getprop", 4, 1);
|
||||
args.phandle = handle;
|
||||
args.prop = property;
|
||||
args.buf = buf;
|
||||
args.buflen = size;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
if (actual)
|
||||
*actual = args.size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_next_property (int handle, char *prev_prop, char *prop,
|
||||
int *flags)
|
||||
{
|
||||
struct get_property_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t phandle;
|
||||
char *prev_prop;
|
||||
char *next_prop;
|
||||
int flags;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "nextprop", 3, 1);
|
||||
args.phandle = handle;
|
||||
args.prev_prop = prev_prop;
|
||||
args.next_prop = prop;
|
||||
args.flags = -1;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
if (flags)
|
||||
*flags = args.flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_get_property_length (pupa_ieee1275_phandle_t handle,
|
||||
const char *prop, pupa_size_t *length)
|
||||
{
|
||||
struct get_property_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t phandle;
|
||||
const char *prop;
|
||||
pupa_size_t length;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "getproplen", 2, 1);
|
||||
args.phandle = handle;
|
||||
args.prop = prop;
|
||||
args.length = -1;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*length = args.length;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_instance_to_package (pupa_ieee1275_ihandle_t ihandle,
|
||||
pupa_ieee1275_phandle_t *phandlep)
|
||||
{
|
||||
struct instance_to_package_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_ihandle_t ihandle;
|
||||
pupa_ieee1275_phandle_t phandle;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "instance-to-package", 1, 1);
|
||||
args.ihandle = ihandle;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*phandlep = args.phandle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_package_to_path (pupa_ieee1275_phandle_t phandle,
|
||||
char *path, pupa_size_t len, pupa_size_t *actual)
|
||||
{
|
||||
struct instance_to_package_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t phandle;
|
||||
char *buf;
|
||||
int buflen;
|
||||
int actual;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "package-to-path", 3, 1);
|
||||
args.phandle = phandle;
|
||||
args.buf = path;
|
||||
args.buflen = len;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
if (actual)
|
||||
*actual = args.actual;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_instance_to_path (pupa_ieee1275_ihandle_t ihandle,
|
||||
char *path, pupa_size_t len,
|
||||
pupa_size_t *actual)
|
||||
{
|
||||
struct instance_to_package_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_ihandle_t ihandle;
|
||||
char *buf;
|
||||
int buflen;
|
||||
int actual;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "instance-to-path", 3, 1);
|
||||
args.ihandle = ihandle;
|
||||
args.buf = path;
|
||||
args.buflen = len;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
if (actual)
|
||||
*actual = args.actual;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_write (pupa_ieee1275_ihandle_t ihandle, void *buffer,
|
||||
pupa_size_t len, pupa_size_t *actualp)
|
||||
{
|
||||
struct write_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_ihandle_t ihandle;
|
||||
void *buf;
|
||||
pupa_size_t len;
|
||||
pupa_size_t actual;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "write", 3, 1);
|
||||
args.ihandle = ihandle;
|
||||
args.buf = buffer;
|
||||
args.len = len;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
if (actualp)
|
||||
*actualp = args.actual;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_read (pupa_ieee1275_ihandle_t ihandle, void *buffer,
|
||||
pupa_size_t len, pupa_size_t *actualp)
|
||||
{
|
||||
struct write_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_ihandle_t ihandle;
|
||||
void *buf;
|
||||
pupa_size_t len;
|
||||
pupa_size_t actual;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "read", 3, 1);
|
||||
args.ihandle = ihandle;
|
||||
args.buf = buffer;
|
||||
args.len = len;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
if (actualp)
|
||||
*actualp = args.actual;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_seek (pupa_ieee1275_ihandle_t ihandle, int pos_hi,
|
||||
int pos_lo, int *result)
|
||||
{
|
||||
struct write_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_ihandle_t ihandle;
|
||||
int pos_hi;
|
||||
int pos_lo;
|
||||
int result;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "seek", 3, 1);
|
||||
args.ihandle = ihandle;
|
||||
args.pos_hi = pos_hi;
|
||||
args.pos_lo = pos_lo;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
|
||||
if (result)
|
||||
*result = args.result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_peer (pupa_ieee1275_phandle_t node,
|
||||
pupa_ieee1275_phandle_t *result)
|
||||
{
|
||||
struct peer_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t node;
|
||||
pupa_ieee1275_phandle_t result;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "peer", 1, 1);
|
||||
args.node = node;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*result = args.result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_child (pupa_ieee1275_phandle_t node,
|
||||
pupa_ieee1275_phandle_t *result)
|
||||
{
|
||||
struct child_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t node;
|
||||
pupa_ieee1275_phandle_t result;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "child", 1, 1);
|
||||
args.node = node;
|
||||
args.result = IEEE1275_PHANDLE_INVALID;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*result = args.result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_parent (pupa_ieee1275_phandle_t node,
|
||||
pupa_ieee1275_phandle_t *result)
|
||||
{
|
||||
struct parent_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t node;
|
||||
pupa_ieee1275_phandle_t result;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "parent", 1, 1);
|
||||
args.node = node;
|
||||
args.result = IEEE1275_PHANDLE_INVALID;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*result = args.result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_exit (void)
|
||||
{
|
||||
struct exit_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "exit", 0, 0);
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_open (char *node, pupa_ieee1275_ihandle_t *result)
|
||||
{
|
||||
struct open_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
char *cstr;
|
||||
pupa_ieee1275_ihandle_t result;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "open", 1, 1);
|
||||
args.cstr = node;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*result = args.result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_close (pupa_ieee1275_ihandle_t ihandle)
|
||||
{
|
||||
struct close_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_ihandle_t ihandle;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "close", 1, 0);
|
||||
args.ihandle = ihandle;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_claim (void *p, pupa_size_t size,
|
||||
unsigned int align, void **result)
|
||||
{
|
||||
struct claim_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
void *p;
|
||||
pupa_size_t size;
|
||||
unsigned int align;
|
||||
void *addr;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "claim", 3, 1);
|
||||
args.p = p;
|
||||
args.size = size;
|
||||
args.align = align;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*result = args.addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_set_property (pupa_ieee1275_phandle_t phandle,
|
||||
const char *propname, void *buf,
|
||||
pupa_size_t size, pupa_size_t *actual)
|
||||
{
|
||||
struct set_property_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
pupa_ieee1275_phandle_t phandle;
|
||||
const char *propname;
|
||||
void *buf;
|
||||
pupa_size_t size;
|
||||
pupa_size_t actual;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "setprop", 4, 1);
|
||||
args.size = size;
|
||||
args.buf = buf;
|
||||
args.propname = propname;
|
||||
args.phandle = phandle;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
*actual = args.actual;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_ieee1275_set_color (pupa_ieee1275_ihandle_t ihandle,
|
||||
int index, int r, int g, int b)
|
||||
{
|
||||
struct set_color_args {
|
||||
struct pupa_ieee1275_common_hdr common;
|
||||
char *method;
|
||||
pupa_ieee1275_ihandle_t ihandle;
|
||||
int index;
|
||||
int b;
|
||||
int g;
|
||||
int r;
|
||||
int result;
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 1);
|
||||
args.method = "color!";
|
||||
args.ihandle = ihandle;
|
||||
args.index = index;
|
||||
args.r = r;
|
||||
args.g = g;
|
||||
args.b = b;
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
490
conf/powerpc-ieee1275.mk
Normal file
490
conf/powerpc-ieee1275.mk
Normal file
|
@ -0,0 +1,490 @@
|
|||
|
||||
# -*- makefile -*-
|
||||
|
||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -D__ASSEMBLY__
|
||||
COMMON_CFLAGS = -fno-builtin -D__ASSEMBLY__
|
||||
|
||||
# Images.
|
||||
|
||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
symlist.c: $(addprefix include/pupa/,$(kernel_img_HEADERS)) gensymlist.sh
|
||||
sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
|
||||
|
||||
kernel_syms.lst: $(addprefix include/pupa/,$(kernel_img_HEADERS)) genkernsyms.sh
|
||||
sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
|
||||
|
||||
# Utilities.
|
||||
sbin_UTILITIES = pupaof
|
||||
bin_UTILITIES = pupa-emu
|
||||
noinst_UTILITIES = genmoddep
|
||||
|
||||
# For pupa-emu
|
||||
pupa_emu_SOURCES = kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
disk/powerpc/ieee1275/partition.c \
|
||||
util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c \
|
||||
normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
|
||||
util/console.c util/pupa-emu.c util/misc.c util/i386/pc/getroot.c \
|
||||
kern/env.c
|
||||
CLEANFILES += pupa-emu pupa_emu-kern_main.o pupa_emu-kern_device.o pupa_emu-kern_disk.o pupa_emu-kern_dl.o pupa_emu-kern_file.o pupa_emu-kern_fs.o pupa_emu-kern_err.o pupa_emu-kern_misc.o pupa_emu-kern_loader.o pupa_emu-kern_rescue.o pupa_emu-kern_term.o pupa_emu-disk_powerpc_ieee1275_partition.o pupa_emu-util_i386_pc_biosdisk.o pupa_emu-fs_fat.o pupa_emu-fs_ext2.o pupa_emu-normal_cmdline.o pupa_emu-normal_command.o pupa_emu-normal_main.o pupa_emu-normal_menu.o pupa_emu-util_console.o pupa_emu-util_pupa_emu.o pupa_emu-util_misc.o pupa_emu-util_i386_pc_getroot.o pupa_emu-kern_env.o
|
||||
MOSTLYCLEANFILES += pupa_emu-kern_main.d pupa_emu-kern_device.d pupa_emu-kern_disk.d pupa_emu-kern_dl.d pupa_emu-kern_file.d pupa_emu-kern_fs.d pupa_emu-kern_err.d pupa_emu-kern_misc.d pupa_emu-kern_loader.d pupa_emu-kern_rescue.d pupa_emu-kern_term.d pupa_emu-disk_powerpc_ieee1275_partition.d pupa_emu-util_i386_pc_biosdisk.d pupa_emu-fs_fat.d pupa_emu-fs_ext2.d pupa_emu-normal_cmdline.d pupa_emu-normal_command.d pupa_emu-normal_main.d pupa_emu-normal_menu.d pupa_emu-util_console.d pupa_emu-util_pupa_emu.d pupa_emu-util_misc.d pupa_emu-util_i386_pc_getroot.d pupa_emu-kern_env.d
|
||||
|
||||
pupa-emu: pupa_emu-kern_main.o pupa_emu-kern_device.o pupa_emu-kern_disk.o pupa_emu-kern_dl.o pupa_emu-kern_file.o pupa_emu-kern_fs.o pupa_emu-kern_err.o pupa_emu-kern_misc.o pupa_emu-kern_loader.o pupa_emu-kern_rescue.o pupa_emu-kern_term.o pupa_emu-disk_powerpc_ieee1275_partition.o pupa_emu-util_i386_pc_biosdisk.o pupa_emu-fs_fat.o pupa_emu-fs_ext2.o pupa_emu-normal_cmdline.o pupa_emu-normal_command.o pupa_emu-normal_main.o pupa_emu-normal_menu.o pupa_emu-util_console.o pupa_emu-util_pupa_emu.o pupa_emu-util_misc.o pupa_emu-util_i386_pc_getroot.o pupa_emu-kern_env.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(pupa_emu_LDFLAGS)
|
||||
|
||||
pupa_emu-kern_main.o: kern/main.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_main.d: kern/main.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupa_emu-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_main.d
|
||||
|
||||
pupa_emu-kern_device.o: kern/device.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_device.d: kern/device.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,device\.o[ :]*,pupa_emu-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_device.d
|
||||
|
||||
pupa_emu-kern_disk.o: kern/disk.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_disk.d: kern/disk.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,disk\.o[ :]*,pupa_emu-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_disk.d
|
||||
|
||||
pupa_emu-kern_dl.o: kern/dl.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_dl.d: kern/dl.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,dl\.o[ :]*,pupa_emu-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_dl.d
|
||||
|
||||
pupa_emu-kern_file.o: kern/file.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_file.d: kern/file.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,file\.o[ :]*,pupa_emu-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_file.d
|
||||
|
||||
pupa_emu-kern_fs.o: kern/fs.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_fs.d: kern/fs.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,fs\.o[ :]*,pupa_emu-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_fs.d
|
||||
|
||||
pupa_emu-kern_err.o: kern/err.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_err.d: kern/err.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,err\.o[ :]*,pupa_emu-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_err.d
|
||||
|
||||
pupa_emu-kern_misc.o: kern/misc.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_misc.d: kern/misc.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_emu-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_misc.d
|
||||
|
||||
pupa_emu-kern_loader.o: kern/loader.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_loader.d: kern/loader.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,loader\.o[ :]*,pupa_emu-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_loader.d
|
||||
|
||||
pupa_emu-kern_rescue.o: kern/rescue.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_rescue.d: kern/rescue.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,pupa_emu-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_rescue.d
|
||||
|
||||
pupa_emu-kern_term.o: kern/term.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_term.d: kern/term.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,term\.o[ :]*,pupa_emu-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_term.d
|
||||
|
||||
pupa_emu-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c
|
||||
$(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c
|
||||
set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,pupa_emu-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-disk_powerpc_ieee1275_partition.d
|
||||
|
||||
pupa_emu-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c
|
||||
$(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c
|
||||
set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,biosdisk\.o[ :]*,pupa_emu-util_i386_pc_biosdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-util_i386_pc_biosdisk.d
|
||||
|
||||
pupa_emu-fs_fat.o: fs/fat.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-fs_fat.d: fs/fat.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,fat\.o[ :]*,pupa_emu-fs_fat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-fs_fat.d
|
||||
|
||||
pupa_emu-fs_ext2.o: fs/ext2.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-fs_ext2.d: fs/ext2.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,pupa_emu-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-fs_ext2.d
|
||||
|
||||
pupa_emu-normal_cmdline.o: normal/cmdline.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-normal_cmdline.d: normal/cmdline.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,pupa_emu-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-normal_cmdline.d
|
||||
|
||||
pupa_emu-normal_command.o: normal/command.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-normal_command.d: normal/command.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,command\.o[ :]*,pupa_emu-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-normal_command.d
|
||||
|
||||
pupa_emu-normal_main.o: normal/main.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-normal_main.d: normal/main.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupa_emu-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-normal_main.d
|
||||
|
||||
pupa_emu-normal_menu.o: normal/menu.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-normal_menu.d: normal/menu.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,menu\.o[ :]*,pupa_emu-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-normal_menu.d
|
||||
|
||||
pupa_emu-util_console.o: util/console.c
|
||||
$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-util_console.d: util/console.c
|
||||
set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,console\.o[ :]*,pupa_emu-util_console.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-util_console.d
|
||||
|
||||
pupa_emu-util_pupa_emu.o: util/pupa-emu.c
|
||||
$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-util_pupa_emu.d: util/pupa-emu.c
|
||||
set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,pupa\-emu\.o[ :]*,pupa_emu-util_pupa_emu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-util_pupa_emu.d
|
||||
|
||||
pupa_emu-util_misc.o: util/misc.c
|
||||
$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-util_misc.d: util/misc.c
|
||||
set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_emu-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-util_misc.d
|
||||
|
||||
pupa_emu-util_i386_pc_getroot.o: util/i386/pc/getroot.c
|
||||
$(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c
|
||||
set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,getroot\.o[ :]*,pupa_emu-util_i386_pc_getroot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-util_i386_pc_getroot.d
|
||||
|
||||
pupa_emu-kern_env.o: kern/env.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupa_emu-kern_env.d: kern/env.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,env\.o[ :]*,pupa_emu-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupa_emu-kern_env.d
|
||||
|
||||
pupa_emu_LDFLAGS = -lncurses
|
||||
|
||||
pupaof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c \
|
||||
boot/powerpc/ieee1275/crt0.S kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \
|
||||
kern/powerpc/ieee1275/openfw.c fs/ext2.c normal/cmdline.c \
|
||||
normal/command.c normal/main.c normal/menu.c \
|
||||
disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \
|
||||
kern/env.c normal/arg.c
|
||||
CLEANFILES += pupaof pupaof-boot_powerpc_ieee1275_cmain.o pupaof-boot_powerpc_ieee1275_ieee1275.o pupaof-boot_powerpc_ieee1275_crt0.o pupaof-kern_main.o pupaof-kern_device.o pupaof-kern_disk.o pupaof-kern_dl.o pupaof-kern_file.o pupaof-kern_fs.o pupaof-kern_err.o pupaof-kern_misc.o pupaof-kern_mm.o pupaof-kern_loader.o pupaof-kern_rescue.o pupaof-kern_term.o pupaof-kern_powerpc_ieee1275_init.o pupaof-term_powerpc_ieee1275_ofconsole.o pupaof-kern_powerpc_ieee1275_openfw.o pupaof-fs_ext2.o pupaof-normal_cmdline.o pupaof-normal_command.o pupaof-normal_main.o pupaof-normal_menu.o pupaof-disk_powerpc_ieee1275_ofdisk.o pupaof-disk_powerpc_ieee1275_partition.o pupaof-kern_env.o pupaof-normal_arg.o
|
||||
MOSTLYCLEANFILES += pupaof-boot_powerpc_ieee1275_cmain.d pupaof-boot_powerpc_ieee1275_ieee1275.d pupaof-boot_powerpc_ieee1275_crt0.d pupaof-kern_main.d pupaof-kern_device.d pupaof-kern_disk.d pupaof-kern_dl.d pupaof-kern_file.d pupaof-kern_fs.d pupaof-kern_err.d pupaof-kern_misc.d pupaof-kern_mm.d pupaof-kern_loader.d pupaof-kern_rescue.d pupaof-kern_term.d pupaof-kern_powerpc_ieee1275_init.d pupaof-term_powerpc_ieee1275_ofconsole.d pupaof-kern_powerpc_ieee1275_openfw.d pupaof-fs_ext2.d pupaof-normal_cmdline.d pupaof-normal_command.d pupaof-normal_main.d pupaof-normal_menu.d pupaof-disk_powerpc_ieee1275_ofdisk.d pupaof-disk_powerpc_ieee1275_partition.d pupaof-kern_env.d pupaof-normal_arg.d
|
||||
|
||||
pupaof: pupaof-boot_powerpc_ieee1275_cmain.o pupaof-boot_powerpc_ieee1275_ieee1275.o pupaof-boot_powerpc_ieee1275_crt0.o pupaof-kern_main.o pupaof-kern_device.o pupaof-kern_disk.o pupaof-kern_dl.o pupaof-kern_file.o pupaof-kern_fs.o pupaof-kern_err.o pupaof-kern_misc.o pupaof-kern_mm.o pupaof-kern_loader.o pupaof-kern_rescue.o pupaof-kern_term.o pupaof-kern_powerpc_ieee1275_init.o pupaof-term_powerpc_ieee1275_ofconsole.o pupaof-kern_powerpc_ieee1275_openfw.o pupaof-fs_ext2.o pupaof-normal_cmdline.o pupaof-normal_command.o pupaof-normal_main.o pupaof-normal_menu.o pupaof-disk_powerpc_ieee1275_ofdisk.o pupaof-disk_powerpc_ieee1275_partition.o pupaof-kern_env.o pupaof-normal_arg.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(pupaof_LDFLAGS)
|
||||
|
||||
pupaof-boot_powerpc_ieee1275_cmain.o: boot/powerpc/ieee1275/cmain.c
|
||||
$(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-boot_powerpc_ieee1275_cmain.d: boot/powerpc/ieee1275/cmain.c
|
||||
set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,cmain\.o[ :]*,pupaof-boot_powerpc_ieee1275_cmain.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-boot_powerpc_ieee1275_cmain.d
|
||||
|
||||
pupaof-boot_powerpc_ieee1275_ieee1275.o: boot/powerpc/ieee1275/ieee1275.c
|
||||
$(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-boot_powerpc_ieee1275_ieee1275.d: boot/powerpc/ieee1275/ieee1275.c
|
||||
set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ieee1275\.o[ :]*,pupaof-boot_powerpc_ieee1275_ieee1275.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-boot_powerpc_ieee1275_ieee1275.d
|
||||
|
||||
pupaof-boot_powerpc_ieee1275_crt0.o: boot/powerpc/ieee1275/crt0.S
|
||||
$(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-boot_powerpc_ieee1275_crt0.d: boot/powerpc/ieee1275/crt0.S
|
||||
set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,crt0\.o[ :]*,pupaof-boot_powerpc_ieee1275_crt0.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-boot_powerpc_ieee1275_crt0.d
|
||||
|
||||
pupaof-kern_main.o: kern/main.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_main.d: kern/main.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupaof-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_main.d
|
||||
|
||||
pupaof-kern_device.o: kern/device.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_device.d: kern/device.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,device\.o[ :]*,pupaof-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_device.d
|
||||
|
||||
pupaof-kern_disk.o: kern/disk.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_disk.d: kern/disk.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,disk\.o[ :]*,pupaof-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_disk.d
|
||||
|
||||
pupaof-kern_dl.o: kern/dl.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_dl.d: kern/dl.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,dl\.o[ :]*,pupaof-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_dl.d
|
||||
|
||||
pupaof-kern_file.o: kern/file.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_file.d: kern/file.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,file\.o[ :]*,pupaof-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_file.d
|
||||
|
||||
pupaof-kern_fs.o: kern/fs.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_fs.d: kern/fs.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,fs\.o[ :]*,pupaof-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_fs.d
|
||||
|
||||
pupaof-kern_err.o: kern/err.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_err.d: kern/err.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,err\.o[ :]*,pupaof-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_err.d
|
||||
|
||||
pupaof-kern_misc.o: kern/misc.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_misc.d: kern/misc.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupaof-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_misc.d
|
||||
|
||||
pupaof-kern_mm.o: kern/mm.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_mm.d: kern/mm.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,mm\.o[ :]*,pupaof-kern_mm.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_mm.d
|
||||
|
||||
pupaof-kern_loader.o: kern/loader.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_loader.d: kern/loader.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,loader\.o[ :]*,pupaof-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_loader.d
|
||||
|
||||
pupaof-kern_rescue.o: kern/rescue.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_rescue.d: kern/rescue.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,pupaof-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_rescue.d
|
||||
|
||||
pupaof-kern_term.o: kern/term.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_term.d: kern/term.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,term\.o[ :]*,pupaof-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_term.d
|
||||
|
||||
pupaof-kern_powerpc_ieee1275_init.o: kern/powerpc/ieee1275/init.c
|
||||
$(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_powerpc_ieee1275_init.d: kern/powerpc/ieee1275/init.c
|
||||
set -e; $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,init\.o[ :]*,pupaof-kern_powerpc_ieee1275_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_powerpc_ieee1275_init.d
|
||||
|
||||
pupaof-term_powerpc_ieee1275_ofconsole.o: term/powerpc/ieee1275/ofconsole.c
|
||||
$(BUILD_CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-term_powerpc_ieee1275_ofconsole.d: term/powerpc/ieee1275/ofconsole.c
|
||||
set -e; $(BUILD_CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ofconsole\.o[ :]*,pupaof-term_powerpc_ieee1275_ofconsole.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-term_powerpc_ieee1275_ofconsole.d
|
||||
|
||||
pupaof-kern_powerpc_ieee1275_openfw.o: kern/powerpc/ieee1275/openfw.c
|
||||
$(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_powerpc_ieee1275_openfw.d: kern/powerpc/ieee1275/openfw.c
|
||||
set -e; $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,openfw\.o[ :]*,pupaof-kern_powerpc_ieee1275_openfw.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_powerpc_ieee1275_openfw.d
|
||||
|
||||
pupaof-fs_ext2.o: fs/ext2.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-fs_ext2.d: fs/ext2.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,pupaof-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-fs_ext2.d
|
||||
|
||||
pupaof-normal_cmdline.o: normal/cmdline.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-normal_cmdline.d: normal/cmdline.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,pupaof-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-normal_cmdline.d
|
||||
|
||||
pupaof-normal_command.o: normal/command.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-normal_command.d: normal/command.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,command\.o[ :]*,pupaof-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-normal_command.d
|
||||
|
||||
pupaof-normal_main.o: normal/main.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-normal_main.d: normal/main.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupaof-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-normal_main.d
|
||||
|
||||
pupaof-normal_menu.o: normal/menu.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-normal_menu.d: normal/menu.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,menu\.o[ :]*,pupaof-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-normal_menu.d
|
||||
|
||||
pupaof-disk_powerpc_ieee1275_ofdisk.o: disk/powerpc/ieee1275/ofdisk.c
|
||||
$(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-disk_powerpc_ieee1275_ofdisk.d: disk/powerpc/ieee1275/ofdisk.c
|
||||
set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ofdisk\.o[ :]*,pupaof-disk_powerpc_ieee1275_ofdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-disk_powerpc_ieee1275_ofdisk.d
|
||||
|
||||
pupaof-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c
|
||||
$(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c
|
||||
set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,partition\.o[ :]*,pupaof-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-disk_powerpc_ieee1275_partition.d
|
||||
|
||||
pupaof-kern_env.o: kern/env.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-kern_env.d: kern/env.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,env\.o[ :]*,pupaof-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-kern_env.d
|
||||
|
||||
pupaof-normal_arg.o: normal/arg.c
|
||||
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $<
|
||||
|
||||
pupaof-normal_arg.d: normal/arg.c
|
||||
set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,arg\.o[ :]*,pupaof-normal_arg.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pupaof-normal_arg.d
|
||||
|
||||
pupaof_HEADERS = pupa/powerpc/ieee1275/ieee1275.h
|
||||
pupaof_CFLAGS = $(COMMON_CFLAGS)
|
||||
pupaof_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
pupaof_LDFLAGS = -Wl,-Ttext,0x200000,-Bstatic
|
||||
|
||||
# For genmoddep.
|
||||
genmoddep_SOURCES = util/genmoddep.c
|
||||
CLEANFILES += genmoddep genmoddep-util_genmoddep.o
|
||||
MOSTLYCLEANFILES += genmoddep-util_genmoddep.d
|
||||
|
||||
genmoddep: genmoddep-util_genmoddep.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(genmoddep_LDFLAGS)
|
||||
|
||||
genmoddep-util_genmoddep.o: util/genmoddep.c
|
||||
$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $<
|
||||
|
||||
genmoddep-util_genmoddep.d: util/genmoddep.c
|
||||
set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(genmoddep_CFLAGS) -M $< | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include genmoddep-util_genmoddep.d
|
||||
|
||||
|
||||
# Modules.
|
||||
CLEANFILES += moddep.lst
|
||||
pkgdata_DATA += moddep.lst
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
|
||||
cat $(DEFSYMFILES) /dev/null | ./genmoddep $(UNDSYMFILES) > $@ \
|
||||
|| (rm -f $@; exit 1)
|
51
conf/powerpc-ieee1275.rmk
Normal file
51
conf/powerpc-ieee1275.rmk
Normal file
|
@ -0,0 +1,51 @@
|
|||
|
||||
# -*- makefile -*-
|
||||
|
||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -D__ASSEMBLY__
|
||||
COMMON_CFLAGS = -fno-builtin -D__ASSEMBLY__
|
||||
|
||||
# Images.
|
||||
|
||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
symlist.c: $(addprefix include/pupa/,$(kernel_img_HEADERS)) gensymlist.sh
|
||||
sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
|
||||
|
||||
kernel_syms.lst: $(addprefix include/pupa/,$(kernel_img_HEADERS)) genkernsyms.sh
|
||||
sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
|
||||
|
||||
# Utilities.
|
||||
sbin_UTILITIES = pupaof
|
||||
bin_UTILITIES = pupa-emu
|
||||
noinst_UTILITIES = genmoddep
|
||||
|
||||
# For pupa-emu
|
||||
pupa_emu_SOURCES = kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
disk/powerpc/ieee1275/partition.c \
|
||||
util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c \
|
||||
normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
|
||||
util/console.c util/pupa-emu.c util/misc.c util/i386/pc/getroot.c \
|
||||
kern/env.c
|
||||
pupa_emu_LDFLAGS = -lncurses
|
||||
|
||||
pupaof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c \
|
||||
boot/powerpc/ieee1275/crt0.S kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \
|
||||
kern/powerpc/ieee1275/openfw.c fs/ext2.c normal/cmdline.c \
|
||||
normal/command.c normal/main.c normal/menu.c \
|
||||
disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \
|
||||
kern/env.c normal/arg.c
|
||||
pupaof_HEADERS = pupa/powerpc/ieee1275/ieee1275.h
|
||||
pupaof_CFLAGS = $(COMMON_CFLAGS)
|
||||
pupaof_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
pupaof_LDFLAGS = -Wl,-Ttext,0x200000,-Bstatic
|
||||
|
||||
# For genmoddep.
|
||||
genmoddep_SOURCES = util/genmoddep.c
|
||||
|
||||
# Modules.
|
16
configure
vendored
16
configure
vendored
|
@ -1363,6 +1363,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
|||
|
||||
case "$host_cpu" in
|
||||
i[3456]86) host_cpu=i386 ;;
|
||||
powerpc) ;;
|
||||
*) { { echo "$as_me:$LINENO: error: unsupported CPU type" >&5
|
||||
echo "$as_me: error: unsupported CPU type" >&2;}
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
|
@ -1370,6 +1371,7 @@ esac
|
|||
|
||||
case "$host_cpu"-"$host_vendor" in
|
||||
i386-*) host_vendor=pc ;;
|
||||
powerpc-*) host_vendor=ieee1275 ;;
|
||||
*) { { echo "$as_me:$LINENO: error: unsupported machine type" >&5
|
||||
echo "$as_me: error: unsupported machine type" >&2;}
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
|
@ -2737,6 +2739,7 @@ fi
|
|||
echo "$as_me:$LINENO: result: $pupa_cv_asm_uscore" >&5
|
||||
echo "${ECHO_T}$pupa_cv_asm_uscore" >&6
|
||||
|
||||
if test "x$host_cpu" = xi386; then
|
||||
|
||||
echo "$as_me:$LINENO: checking if start is defined by the compiler" >&5
|
||||
echo $ECHO_N "checking if start is defined by the compiler... $ECHO_C" >&6
|
||||
|
@ -3131,6 +3134,7 @@ echo "$as_me: error: neither end nor _end is defined" >&2;}
|
|||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if test "x$host_cpu" = xi386; then
|
||||
|
||||
|
@ -3877,9 +3881,6 @@ fi
|
|||
|
||||
# For cross-compiling.
|
||||
if test "x$build" = "x$host"; then
|
||||
BUILD_CC="$CC"
|
||||
|
||||
else
|
||||
for ac_prog in gcc egcs cc
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
|
@ -3923,6 +3924,9 @@ test -n "$BUILD_CC" || BUILD_CC="{ { echo "$as_me:$LINENO: error: none of gcc, e
|
|||
echo "$as_me: error: none of gcc, egcs and cc is found. set BUILD_CC manually." >&2;}
|
||||
{ (exit 1); exit 1; }; }"
|
||||
|
||||
else
|
||||
BUILD_CC="$CC"
|
||||
|
||||
fi
|
||||
|
||||
# Test the C compiler for the build environment.
|
||||
|
@ -5334,7 +5338,8 @@ _ACEOF
|
|||
|
||||
|
||||
|
||||
# Check LZO.
|
||||
# Check LZO when compiling for the i386.
|
||||
if test "x$host_cpu" = xi386; then
|
||||
|
||||
echo "$as_me:$LINENO: checking for __lzo_init2 in -llzo" >&5
|
||||
echo $ECHO_N "checking for __lzo_init2 in -llzo... $ECHO_C" >&6
|
||||
|
@ -5403,7 +5408,7 @@ echo "$as_me: error: LZO library version 1.02 or later is required" >&2;}
|
|||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for lzo1x_999_compress" >&5
|
||||
echo "$as_me:$LINENO: checking for lzo1x_999_compress" >&5
|
||||
echo $ECHO_N "checking for lzo1x_999_compress... $ECHO_C" >&6
|
||||
if test "${ac_cv_func_lzo1x_999_compress+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
|
@ -5483,6 +5488,7 @@ echo "$as_me: error: LZO1X-999 must be enabled" >&2;}
|
|||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
CC="$tmp_CC"
|
||||
CFLAGS="$tmp_CFLAGS"
|
||||
|
|
30
configure.ac
30
configure.ac
|
@ -1,6 +1,6 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 2002,2003 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002,2003,2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# This configure.ac is free software; the author
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -22,11 +22,13 @@ AC_CANONICAL_HOST
|
|||
|
||||
case "$host_cpu" in
|
||||
i[[3456]]86) host_cpu=i386 ;;
|
||||
powerpc) ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU type]) ;;
|
||||
esac
|
||||
|
||||
case "$host_cpu"-"$host_vendor" in
|
||||
i386-*) host_vendor=pc ;;
|
||||
powerpc-*) host_vendor=ieee1275 ;;
|
||||
*) AC_MSG_ERROR([unsupported machine type]) ;;
|
||||
esac
|
||||
|
||||
|
@ -80,9 +82,11 @@ AC_SUBST(CFLAGS)
|
|||
|
||||
# Defined in aclocal.m4.
|
||||
pupa_ASM_USCORE
|
||||
pupa_CHECK_START_SYMBOL
|
||||
pupa_CHECK_BSS_START_SYMBOL
|
||||
pupa_CHECK_END_SYMBOL
|
||||
if test "x$host_cpu" = xi386; then
|
||||
pupa_CHECK_START_SYMBOL
|
||||
pupa_CHECK_BSS_START_SYMBOL
|
||||
pupa_CHECK_END_SYMBOL
|
||||
fi
|
||||
|
||||
if test "x$host_cpu" = xi386; then
|
||||
pupa_I386_ASM_PREFIX_REQUIREMENT
|
||||
|
@ -106,11 +110,11 @@ AC_PATH_PROG(RUBY, ruby)
|
|||
|
||||
# For cross-compiling.
|
||||
if test "x$build" = "x$host"; then
|
||||
BUILD_CC="$CC"
|
||||
AC_SUBST(BUILD_CC)
|
||||
else
|
||||
AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
|
||||
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
|
||||
else
|
||||
BUILD_CC="$CC"
|
||||
AC_SUBST(BUILD_CC)
|
||||
fi
|
||||
|
||||
# Test the C compiler for the build environment.
|
||||
|
@ -126,11 +130,13 @@ AC_C_BIGENDIAN
|
|||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
# Check LZO.
|
||||
AC_CHECK_LIB(lzo, __lzo_init2, ,
|
||||
AC_MSG_ERROR([LZO library version 1.02 or later is required]))
|
||||
AC_CHECK_FUNC(lzo1x_999_compress, ,
|
||||
[AC_MSG_ERROR([LZO1X-999 must be enabled])])
|
||||
# Check LZO when compiling for the i386.
|
||||
if test "x$host_cpu" = xi386; then
|
||||
AC_CHECK_LIB(lzo, __lzo_init2, ,
|
||||
AC_MSG_ERROR([LZO library version 1.02 or later is required]))
|
||||
AC_CHECK_FUNC(lzo1x_999_compress, ,
|
||||
[AC_MSG_ERROR([LZO1X-999 must be enabled])])
|
||||
fi
|
||||
|
||||
CC="$tmp_CC"
|
||||
CFLAGS="$tmp_CFLAGS"
|
||||
|
|
161
disk/powerpc/ieee1275/ofdisk.c
Normal file
161
disk/powerpc/ieee1275/ofdisk.c
Normal file
|
@ -0,0 +1,161 @@
|
|||
/* ofdisk.c - Open Firmware disk access. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <pupa/misc.h>
|
||||
#include <pupa/disk.h>
|
||||
#include <pupa/mm.h>
|
||||
#include <pupa/machine/ieee1275.h>
|
||||
|
||||
static int
|
||||
pupa_ofdisk_iterate (int (*hook) (const char *name))
|
||||
{
|
||||
int dev_iterate (struct pupa_ieee1275_devalias *alias)
|
||||
{
|
||||
if (! pupa_strcmp (alias->type, "block"))
|
||||
hook (alias->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pupa_devalias_iterate (dev_iterate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static pupa_err_t
|
||||
pupa_ofdisk_open (const char *name, pupa_disk_t disk)
|
||||
{
|
||||
pupa_ieee1275_phandle_t devalias;
|
||||
pupa_ieee1275_phandle_t dev;
|
||||
pupa_ieee1275_ihandle_t dev_ihandle = 0;
|
||||
char *devpath = 0;
|
||||
/* XXX: This should be large enough for any possible case. */
|
||||
char prop[64];
|
||||
pupa_size_t pathlen;
|
||||
int actual;
|
||||
|
||||
if (pupa_ieee1275_finddevice ("/aliases", &devalias))
|
||||
return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Can't read the aliases");
|
||||
|
||||
pupa_ieee1275_get_property_length (devalias, name, &pathlen);
|
||||
devpath = pupa_malloc (pathlen);
|
||||
if (! devpath)
|
||||
return pupa_errno;
|
||||
|
||||
if (pupa_ieee1275_get_property (devalias, name, devpath, pathlen, &actual))
|
||||
return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "No such device alias");
|
||||
|
||||
/* To access the complete disk add `:0'. */
|
||||
pupa_strcat (devpath, ":0");
|
||||
pupa_ieee1275_open (devpath, &dev_ihandle);
|
||||
if (! dev_ihandle)
|
||||
return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Can't open device");
|
||||
|
||||
if (pupa_ieee1275_finddevice (devpath, &dev))
|
||||
{
|
||||
pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Can't read device properties");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (pupa_ieee1275_get_property (dev, "device_type", prop, sizeof (prop),
|
||||
&actual))
|
||||
{
|
||||
pupa_error (PUPA_ERR_BAD_DEVICE, "Can't read the device type");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (pupa_strcmp (prop, "block"))
|
||||
{
|
||||
pupa_error (PUPA_ERR_BAD_DEVICE, "Not a block device");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* XXX: There is no property to read the number of blocks. There
|
||||
should be a property `#blocks', but it is not there. Perhaps it
|
||||
is possible to use seek for this. */
|
||||
disk->total_sectors = 0xFFFFFFFFUL;
|
||||
|
||||
/* XXX: Is it ok to use this? Perhaps it is better to use the path
|
||||
or some property. */
|
||||
disk->id = dev;
|
||||
|
||||
/* XXX: Read this, somehow. */
|
||||
disk->has_partitions = 1;
|
||||
disk->data = (void *) dev_ihandle;
|
||||
|
||||
fail:
|
||||
if (pupa_errno)
|
||||
pupa_ieee1275_close (dev_ihandle);
|
||||
pupa_free (devpath);
|
||||
return pupa_errno;
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofdisk_close (pupa_disk_t disk)
|
||||
{
|
||||
pupa_ieee1275_close ((pupa_ieee1275_ihandle_t) disk->data);
|
||||
}
|
||||
|
||||
static pupa_err_t
|
||||
pupa_ofdisk_read (pupa_disk_t disk, unsigned long sector,
|
||||
unsigned long size, char *buf)
|
||||
{
|
||||
int status;
|
||||
int actual;
|
||||
unsigned long long pos;
|
||||
|
||||
pos = (unsigned long long) sector * 512UL;
|
||||
|
||||
pupa_ieee1275_seek ((pupa_ieee1275_ihandle_t) disk->data, (int) (pos >> 32),
|
||||
(int) pos & 0xFFFFFFFFUL, &status);
|
||||
if (status != 0)
|
||||
return pupa_error (PUPA_ERR_READ_ERROR,
|
||||
"Seek error, can't seek block %d", sector);
|
||||
pupa_ieee1275_read ((pupa_ieee1275_ihandle_t) disk->data, buf,
|
||||
size * 512UL, &actual);
|
||||
if (actual != actual)
|
||||
return pupa_error (PUPA_ERR_READ_ERROR, "Read error on block: %d", sector);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static pupa_err_t
|
||||
pupa_ofdisk_write (pupa_disk_t disk __attribute ((unused)),
|
||||
unsigned long sector __attribute ((unused)),
|
||||
unsigned long size __attribute ((unused)),
|
||||
const char *buf __attribute ((unused)))
|
||||
{
|
||||
return PUPA_ERR_NOT_IMPLEMENTED_YET;
|
||||
}
|
||||
|
||||
static struct pupa_disk_dev pupa_ofdisk_dev =
|
||||
{
|
||||
.name = "ofdisk",
|
||||
.iterate = pupa_ofdisk_iterate,
|
||||
.open = pupa_ofdisk_open,
|
||||
.close = pupa_ofdisk_close,
|
||||
.read = pupa_ofdisk_read,
|
||||
.write = pupa_ofdisk_write,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
void
|
||||
pupa_ofdisk_init (void)
|
||||
{
|
||||
pupa_disk_dev_register (&pupa_ofdisk_dev);
|
||||
}
|
120
disk/powerpc/ieee1275/partition.c
Normal file
120
disk/powerpc/ieee1275/partition.c
Normal file
|
@ -0,0 +1,120 @@
|
|||
/* partiton.c - Read macintosh partition tables. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <pupa/disk.h>
|
||||
#include <pupa/misc.h>
|
||||
#include <pupa/mm.h>
|
||||
#include <pupa/machine/partition.h>
|
||||
|
||||
pupa_err_t
|
||||
pupa_partition_iterate (pupa_disk_t disk,
|
||||
int (*hook) (const pupa_partition_t partition))
|
||||
{
|
||||
struct pupa_partition part;
|
||||
struct pupa_apple_part apart;
|
||||
struct pupa_disk raw;
|
||||
int partno = 0;
|
||||
int pos = PUPA_DISK_SECTOR_SIZE * 2;
|
||||
|
||||
/* Enforce raw disk access. */
|
||||
raw = *disk;
|
||||
raw.partition = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (pupa_disk_read (&raw, pos / PUPA_DISK_SECTOR_SIZE,
|
||||
pos % PUPA_DISK_SECTOR_SIZE,
|
||||
sizeof (struct pupa_apple_part), (char *) &apart))
|
||||
return pupa_errno;
|
||||
|
||||
if (apart.magic != PUPA_APPLE_PART_MAGIC)
|
||||
break;
|
||||
|
||||
part.start = apart.first_phys_block;
|
||||
part.len = apart.blockcnt;
|
||||
part.offset = pos;
|
||||
part.index = partno;
|
||||
|
||||
if (hook (&part))
|
||||
return pupa_errno;
|
||||
|
||||
if (apart.first_phys_block == PUPA_DISK_SECTOR_SIZE * 2)
|
||||
return 0;
|
||||
|
||||
pos += sizeof (struct pupa_apple_part);
|
||||
partno++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pupa_partition_t
|
||||
pupa_partition_probe (pupa_disk_t disk, const char *str)
|
||||
{
|
||||
pupa_partition_t p;
|
||||
int partnum = 0;
|
||||
char *s = (char *) str;
|
||||
|
||||
int find_func (const pupa_partition_t partition)
|
||||
{
|
||||
if (partnum == partition->index)
|
||||
{
|
||||
p = (pupa_partition_t) pupa_malloc (sizeof (*p));
|
||||
if (! p)
|
||||
return 1;
|
||||
|
||||
pupa_memcpy (p, partition, sizeof (*p));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the partition number. */
|
||||
partnum = pupa_strtoul (s, &s, 0);
|
||||
if (pupa_errno)
|
||||
{
|
||||
pupa_error (PUPA_ERR_BAD_FILENAME, "invalid partition");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pupa_partition_iterate (disk, find_func))
|
||||
goto fail;
|
||||
|
||||
return p;
|
||||
|
||||
fail:
|
||||
pupa_free (p);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
char *
|
||||
pupa_partition_get_name (const pupa_partition_t p)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = pupa_malloc (13);
|
||||
if (! name)
|
||||
return 0;
|
||||
|
||||
pupa_sprintf (name, "%d", p->index);
|
||||
return name;
|
||||
}
|
2
genmk.rb
2
genmk.rb
|
@ -170,7 +170,7 @@ class Utility
|
|||
def rule(sources)
|
||||
prefix = @name.to_var
|
||||
objs = sources.collect do |src|
|
||||
raise "unknown source file `#{src}'" if /\.c$/ !~ src
|
||||
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
||||
prefix + '-' + src.to_obj
|
||||
end
|
||||
objs_str = objs.join(' ');
|
||||
|
|
47
include/grub/powerpc/ieee1275/biosdisk.h
Normal file
47
include/grub/powerpc/ieee1275/biosdisk.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* PUPA is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PUPA; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_BIOSDISK_MACHINE_HEADER
|
||||
#define PUPA_BIOSDISK_MACHINE_HEADER 1
|
||||
|
||||
#define PUPA_BIOSDISK_FLAG_LBA 1
|
||||
|
||||
struct pupa_biosdisk_data
|
||||
{
|
||||
int drive;
|
||||
unsigned long cylinders;
|
||||
unsigned long heads;
|
||||
unsigned long sectors;
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
int pupa_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
|
||||
int pupa_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
|
||||
int soff, int nsec, int segment);
|
||||
int pupa_biosdisk_check_int13_extensions (int drive);
|
||||
int pupa_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp);
|
||||
int pupa_biosdisk_get_diskinfo_standard (int drive,
|
||||
unsigned long *cylinders,
|
||||
unsigned long *heads,
|
||||
unsigned long *sectors);
|
||||
int pupa_biosdisk_get_num_floppies (void);
|
||||
|
||||
void pupa_biosdisk_init (void);
|
||||
|
||||
#endif /* ! PUPA_BIOSDISK_MACHINE_HEADER */
|
56
include/grub/powerpc/ieee1275/console.h
Normal file
56
include/grub/powerpc/ieee1275/console.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_CONSOLE_MACHINE_HEADER
|
||||
#define PUPA_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
/* Define scan codes. */
|
||||
#define PUPA_CONSOLE_KEY_LEFT 0x4B00
|
||||
#define PUPA_CONSOLE_KEY_RIGHT 0x4D00
|
||||
#define PUPA_CONSOLE_KEY_UP 0x4800
|
||||
#define PUPA_CONSOLE_KEY_DOWN 0x5000
|
||||
#define PUPA_CONSOLE_KEY_IC 0x5200
|
||||
#define PUPA_CONSOLE_KEY_DC 0x5300
|
||||
#define PUPA_CONSOLE_KEY_BACKSPACE 0x0008
|
||||
#define PUPA_CONSOLE_KEY_HOME 0x4700
|
||||
#define PUPA_CONSOLE_KEY_END 0x4F00
|
||||
#define PUPA_CONSOLE_KEY_NPAGE 0x4900
|
||||
#define PUPA_CONSOLE_KEY_PPAGE 0x5100
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include <pupa/types.h>
|
||||
#include <pupa/symbol.h>
|
||||
|
||||
/* These are global to share code between C and asm. */
|
||||
extern pupa_uint8_t pupa_console_cur_color;
|
||||
void pupa_console_real_putchar (int c);
|
||||
int EXPORT_FUNC(pupa_console_checkkey) (void);
|
||||
int EXPORT_FUNC(pupa_console_getkey) (void);
|
||||
pupa_uint16_t pupa_console_getxy (void);
|
||||
void pupa_console_gotoxy (pupa_uint8_t x, pupa_uint8_t y);
|
||||
void pupa_console_cls (void);
|
||||
void pupa_console_setcursor (int on);
|
||||
|
||||
/* Initialize the console system. */
|
||||
void pupa_console_init (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! PUPA_CONSOLE_MACHINE_HEADER */
|
99
include/grub/powerpc/ieee1275/ieee1275.h
Normal file
99
include/grub/powerpc/ieee1275/ieee1275.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/* ieee1275.h - Access the Open Firmware client interface. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_IEEE1275_MACHINE_HEADER
|
||||
#define PUPA_IEEE1275_MACHINE_HEADER 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include <pupa/err.h>
|
||||
#include <pupa/types.h>
|
||||
|
||||
/* Maps a device alias to a pathname. */
|
||||
struct pupa_ieee1275_devalias
|
||||
{
|
||||
char *name;
|
||||
char *path;
|
||||
char *type;
|
||||
};
|
||||
|
||||
struct pupa_ieee1275_mem_region
|
||||
{
|
||||
unsigned int start;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
/* FIXME jrydberg: is this correct cell types? */
|
||||
typedef intptr_t pupa_ieee1275_ihandle_t;
|
||||
typedef intptr_t pupa_ieee1275_phandle_t;
|
||||
|
||||
extern intptr_t (*pupa_ieee1275_entry_fn) (void *);
|
||||
|
||||
|
||||
uint32_t EXPORT_FUNC(pupa_ieee1275_decode_int_4) (unsigned char *p);
|
||||
int EXPORT_FUNC(pupa_ieee1275_finddevice) (char *name,
|
||||
pupa_ieee1275_phandle_t *phandlep);
|
||||
int EXPORT_FUNC(pupa_ieee1275_get_property) (int handle, const char *property,
|
||||
void *buf, pupa_size_t size,
|
||||
pupa_size_t *actual);
|
||||
int EXPORT_FUNC(pupa_ieee1275_next_property) (int handle, char *prev_prop,
|
||||
char *prop, int *flags);
|
||||
int EXPORT_FUNC(pupa_ieee1275_get_property_length)
|
||||
(pupa_ieee1275_phandle_t handle, const char *prop, pupa_size_t *length);
|
||||
int EXPORT_FUNC(pupa_ieee1275_instance_to_package)
|
||||
(pupa_ieee1275_ihandle_t ihandle, pupa_ieee1275_phandle_t *phandlep);
|
||||
int EXPORT_FUNC(pupa_ieee1275_package_to_path) (pupa_ieee1275_phandle_t phandle,
|
||||
char *path, pupa_size_t len,
|
||||
pupa_size_t *actual);
|
||||
int EXPORT_FUNC(pupa_ieee1275_instance_to_path)
|
||||
(pupa_ieee1275_ihandle_t ihandle, char *path, pupa_size_t len,
|
||||
pupa_size_t *actual);
|
||||
int EXPORT_FUNC(pupa_ieee1275_write) (pupa_ieee1275_ihandle_t ihandle,
|
||||
void *buffer, pupa_size_t len,
|
||||
pupa_size_t *actualp);
|
||||
int EXPORT_FUNC(pupa_ieee1275_read) (pupa_ieee1275_ihandle_t ihandle,
|
||||
void *buffer, pupa_size_t len,
|
||||
pupa_size_t *actualp);
|
||||
int EXPORT_FUNC(pupa_ieee1275_seek) (pupa_ieee1275_ihandle_t ihandle,
|
||||
int pos_hi, int pos_lo, int *result);
|
||||
int EXPORT_FUNC(pupa_ieee1275_peer) (pupa_ieee1275_phandle_t node,
|
||||
pupa_ieee1275_phandle_t *result);
|
||||
int EXPORT_FUNC(pupa_ieee1275_child) (pupa_ieee1275_phandle_t node,
|
||||
pupa_ieee1275_phandle_t *result);
|
||||
int EXPORT_FUNC(pupa_ieee1275_parent) (pupa_ieee1275_phandle_t node,
|
||||
pupa_ieee1275_phandle_t *result);
|
||||
int EXPORT_FUNC(pupa_ieee1275_exit) (void);
|
||||
int EXPORT_FUNC(pupa_ieee1275_open) (char *node,
|
||||
pupa_ieee1275_ihandle_t *result);
|
||||
int EXPORT_FUNC(pupa_ieee1275_close) (pupa_ieee1275_ihandle_t ihandle);
|
||||
int EXPORT_FUNC(pupa_ieee1275_claim) (void *p, pupa_size_t size, unsigned int align,
|
||||
void **result);
|
||||
int EXPORT_FUNC(pupa_ieee1275_set_property) (pupa_ieee1275_phandle_t phandle,
|
||||
const char *propname, void *buf,
|
||||
pupa_size_t size,
|
||||
pupa_size_t *actual);
|
||||
int EXPORT_FUNC(pupa_ieee1275_set_color) (pupa_ieee1275_ihandle_t ihandle,
|
||||
int index, int r, int g, int b);
|
||||
|
||||
|
||||
pupa_err_t EXPORT_FUNC(pupa_devalias_iterate)
|
||||
(int (*hook) (struct pupa_ieee1275_devalias *alias));
|
||||
|
||||
|
||||
#endif /* ! PUPA_IEEE1275_MACHINE_HEADER */
|
51
include/grub/powerpc/ieee1275/loader.h
Normal file
51
include/grub/powerpc/ieee1275/loader.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2002 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
* Copyright (C) 2003 Jeroen Dekkers <jeroen@dekkers.cx>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_LOADER_MACHINE_HEADER
|
||||
#define PUPA_LOADER_MACHINE_HEADER 1
|
||||
|
||||
#include <pupa/types.h>
|
||||
#include <pupa/symbol.h>
|
||||
#include <pupa/machine/multiboot.h>
|
||||
|
||||
extern pupa_uint32_t EXPORT_VAR(pupa_linux_prot_size);
|
||||
extern char *EXPORT_VAR(pupa_linux_tmp_addr);
|
||||
extern char *EXPORT_VAR(pupa_linux_real_addr);
|
||||
|
||||
void EXPORT_FUNC(pupa_linux_boot_zimage) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(pupa_linux_boot_bzimage) (void) __attribute__ ((noreturn));
|
||||
|
||||
/* This is an asm part of the chainloader. */
|
||||
void EXPORT_FUNC(pupa_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
|
||||
|
||||
/* The asm part of the multiboot loader. */
|
||||
void EXPORT_FUNC(pupa_multiboot_real_boot) (pupa_addr_t entry,
|
||||
struct pupa_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
/* It is necessary to export these functions, because normal mode commands
|
||||
reuse rescue mode commands. */
|
||||
void pupa_rescue_cmd_chainloader (int argc, char *argv[]);
|
||||
void pupa_rescue_cmd_linux (int argc, char *argv[]);
|
||||
void pupa_rescue_cmd_initrd (int argc, char *argv[]);
|
||||
void pupa_rescue_cmd_multiboot (int argc, char *argv[]);
|
||||
void pupa_rescue_cmd_module (int argc, char *argv[]);
|
||||
|
||||
#endif /* ! PUPA_LOADER_MACHINE_HEADER */
|
184
include/grub/powerpc/ieee1275/multiboot.h
Normal file
184
include/grub/powerpc/ieee1275/multiboot.h
Normal file
|
@ -0,0 +1,184 @@
|
|||
/* multiboot.h - multiboot header file. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_MULTIBOOT_MACHINE_HEADER
|
||||
#define PUPA_MULTIBOOT_MACHINE_HEADER 1
|
||||
|
||||
/* How many bytes from the start of the file we search for the header. */
|
||||
#define PUPA_MB_SEARCH 8192
|
||||
|
||||
/* The magic field should contain this. */
|
||||
#define PUPA_MB_MAGIC 0x1BADB002
|
||||
|
||||
/* This should be in %eax. */
|
||||
#define PUPA_MB_MAGIC2 0x2BADB002
|
||||
|
||||
/* The bits in the required part of flags field we don't support. */
|
||||
#define PUPA_MB_UNSUPPORTED 0x0000fffc
|
||||
|
||||
/* Alignment of multiboot modules. */
|
||||
#define PUPA_MB_MOD_ALIGN 0x00001000
|
||||
|
||||
/*
|
||||
* Flags set in the 'flags' member of the multiboot header.
|
||||
*/
|
||||
|
||||
/* Align all boot modules on i386 page (4KB) boundaries. */
|
||||
#define PUPA_MB_PAGE_ALIGN 0x00000001
|
||||
|
||||
/* Must pass memory information to OS. */
|
||||
#define PUPA_MB_MEMORY_INFO 0x00000002
|
||||
|
||||
/* Must pass video information to OS. */
|
||||
#define PUPA_MB_VIDEO_MODE 0x00000004
|
||||
|
||||
/* This flag indicates the use of the address fields in the header. */
|
||||
#define PUPA_MB_AOUT_KLUDGE 0x00010000
|
||||
|
||||
/*
|
||||
* Flags to be set in the 'flags' member of the multiboot info structure.
|
||||
*/
|
||||
|
||||
/* is there basic lower/upper memory information? */
|
||||
#define PUPA_MB_INFO_MEMORY 0x00000001
|
||||
/* is there a boot device set? */
|
||||
#define PUPA_MB_INFO_BOOTDEV 0x00000002
|
||||
/* is the command-line defined? */
|
||||
#define PUPA_MB_INFO_CMDLINE 0x00000004
|
||||
/* are there modules to do something with? */
|
||||
#define PUPA_MB_INFO_MODS 0x00000008
|
||||
|
||||
/* These next two are mutually exclusive */
|
||||
|
||||
/* is there a symbol table loaded? */
|
||||
#define PUPA_MB_INFO_AOUT_SYMS 0x00000010
|
||||
/* is there an ELF section header table? */
|
||||
#define PUPA_MB_INFO_ELF_SHDR 0x00000020
|
||||
|
||||
/* is there a full memory map? */
|
||||
#define PUPA_MB_INFO_MEM_MAP 0x00000040
|
||||
|
||||
/* Is there drive info? */
|
||||
#define PUPA_MB_INFO_DRIVE_INFO 0x00000080
|
||||
|
||||
/* Is there a config table? */
|
||||
#define PUPA_MB_INFO_CONFIG_TABLE 0x00000100
|
||||
|
||||
/* Is there a boot loader name? */
|
||||
#define PUPA_MB_INFO_BOOT_LOADER_NAME 0x00000200
|
||||
|
||||
/* Is there a APM table? */
|
||||
#define PUPA_MB_INFO_APM_TABLE 0x00000400
|
||||
|
||||
/* Is there video information? */
|
||||
#define PUPA_MB_INFO_VIDEO_INFO 0x00000800
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include <pupa/types.h>
|
||||
|
||||
struct pupa_multiboot_header
|
||||
{
|
||||
/* Must be PUPA_MB_MAGIC - see above. */
|
||||
pupa_uint32_t magic;
|
||||
|
||||
/* Feature flags. */
|
||||
pupa_uint32_t flags;
|
||||
|
||||
/* The above fields plus this one must equal 0 mod 2^32. */
|
||||
pupa_uint32_t checksum;
|
||||
|
||||
/* These are only valid if PUPA_MB_AOUT_KLUDGE is set. */
|
||||
pupa_uint32_t header_addr;
|
||||
pupa_uint32_t load_addr;
|
||||
pupa_uint32_t load_end_addr;
|
||||
pupa_uint32_t bss_end_addr;
|
||||
pupa_uint32_t entry_addr;
|
||||
|
||||
/* These are only valid if PUPA_MB_VIDEO_MODE is set. */
|
||||
pupa_uint32_t mode_type;
|
||||
pupa_uint32_t width;
|
||||
pupa_uint32_t height;
|
||||
pupa_uint32_t depth;
|
||||
};
|
||||
|
||||
struct pupa_multiboot_info
|
||||
{
|
||||
/* MultiBoot info version number */
|
||||
pupa_uint32_t flags;
|
||||
|
||||
/* Available memory from BIOS */
|
||||
pupa_uint32_t mem_lower;
|
||||
pupa_uint32_t mem_upper;
|
||||
|
||||
/* "root" partition */
|
||||
pupa_uint32_t boot_device;
|
||||
|
||||
/* Kernel command line */
|
||||
pupa_uint32_t cmdline;
|
||||
|
||||
/* Boot-Module list */
|
||||
pupa_uint32_t mods_count;
|
||||
pupa_uint32_t mods_addr;
|
||||
|
||||
pupa_uint32_t syms[4];
|
||||
|
||||
/* Memory Mapping buffer */
|
||||
pupa_uint32_t mmap_length;
|
||||
pupa_uint32_t mmap_addr;
|
||||
|
||||
/* Drive Info buffer */
|
||||
pupa_uint32_t drives_length;
|
||||
pupa_uint32_t drives_addr;
|
||||
|
||||
/* ROM configuration table */
|
||||
pupa_uint32_t config_table;
|
||||
|
||||
/* Boot Loader Name */
|
||||
pupa_uint32_t boot_loader_name;
|
||||
|
||||
/* APM table */
|
||||
pupa_uint32_t apm_table;
|
||||
|
||||
/* Video */
|
||||
pupa_uint32_t vbe_control_info;
|
||||
pupa_uint32_t vbe_mode_info;
|
||||
pupa_uint16_t vbe_mode;
|
||||
pupa_uint16_t vbe_interface_seg;
|
||||
pupa_uint16_t vbe_interface_off;
|
||||
pupa_uint16_t vbe_interface_len;
|
||||
};
|
||||
|
||||
struct pupa_mod_list
|
||||
{
|
||||
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
|
||||
pupa_uint32_t mod_start;
|
||||
pupa_uint32_t mod_end;
|
||||
|
||||
/* Module command line */
|
||||
pupa_uint32_t cmdline;
|
||||
|
||||
/* padding to take it to 16 bytes (must be zero) */
|
||||
pupa_uint32_t pad;
|
||||
};
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! PUPA_MULTIBOOT_MACHINE_HEADER */
|
140
include/grub/powerpc/ieee1275/partition.h
Normal file
140
include/grub/powerpc/ieee1275/partition.h
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* PUPA is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PUPA; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_PARTITION_HEADER
|
||||
#define PUPA_PARTITION_HEADER 1
|
||||
|
||||
#include <pupa/symbol.h>
|
||||
#include <pupa/types.h>
|
||||
#include <pupa/err.h>
|
||||
|
||||
#define PUPA_APPLE_PART_MAGIC 0x504D
|
||||
|
||||
struct pupa_apple_part
|
||||
{
|
||||
/* The magic number to idenify this as a partition, it should have
|
||||
the value `0x504D'. */
|
||||
pupa_uint16_t magic;
|
||||
|
||||
/* Reserved. */
|
||||
pupa_uint16_t reserved;
|
||||
|
||||
/* The size of the partition map in blocks. */
|
||||
pupa_uint32_t partmap_size;
|
||||
|
||||
/* The first physical block of the partition. */
|
||||
pupa_uint32_t first_phys_block;
|
||||
|
||||
/* The amount of blocks. */
|
||||
pupa_uint32_t blockcnt;
|
||||
|
||||
/* The partition name. */
|
||||
char partname[32];
|
||||
|
||||
/* The partition type. */
|
||||
char parttype[32];
|
||||
|
||||
/* The first datablock of the partition. */
|
||||
pupa_uint32_t datablocks_first;
|
||||
|
||||
/* The amount datablocks. */
|
||||
pupa_uint32_t datablocks_count;
|
||||
|
||||
/* The status of the partition. (???) */
|
||||
pupa_uint32_t status;
|
||||
|
||||
/* The first block on which the bootcode can be found. */
|
||||
pupa_uint32_t bootcode_pos;
|
||||
|
||||
/* The size of the bootcode in bytes. */
|
||||
pupa_uint32_t bootcode_size;
|
||||
|
||||
/* The load address of the bootcode. */
|
||||
pupa_uint32_t bootcode_loadaddr;
|
||||
|
||||
/* Reserved. */
|
||||
pupa_uint32_t reserved2;
|
||||
|
||||
/* The entrypoint of the bootcode. */
|
||||
pupa_uint32_t bootcode_entrypoint;
|
||||
|
||||
/* Reserved. */
|
||||
pupa_uint32_t reserved3;
|
||||
|
||||
/* A checksum of the bootcode. */
|
||||
pupa_uint32_t bootcode_checksum;
|
||||
|
||||
/* The processor type. */
|
||||
char processor[16];
|
||||
|
||||
/* Padding. */
|
||||
pupa_uint16_t pad[187];
|
||||
};
|
||||
|
||||
/* Partition description. */
|
||||
struct pupa_partition
|
||||
{
|
||||
/* The start sector. */
|
||||
unsigned long start;
|
||||
|
||||
/* The length in sector units. */
|
||||
unsigned long len;
|
||||
|
||||
/* The offset of the partition table. */
|
||||
unsigned long offset;
|
||||
|
||||
/* The index of this partition in the partition table. */
|
||||
int index;
|
||||
|
||||
/* The DOS partition number. */
|
||||
int dos_part;
|
||||
|
||||
/* The BSD partition number (a == 0). */
|
||||
int bsd_part;
|
||||
|
||||
/* The DOS partition type. */
|
||||
int dos_type;
|
||||
|
||||
/* The BSD partition type. */
|
||||
int bsd_type;
|
||||
};
|
||||
typedef struct pupa_partition *pupa_partition_t;
|
||||
|
||||
struct pupa_disk;
|
||||
|
||||
pupa_partition_t EXPORT_FUNC(pupa_partition_probe) (struct pupa_disk *disk,
|
||||
const char *str);
|
||||
pupa_err_t EXPORT_FUNC(pupa_partition_iterate) (struct pupa_disk *disk,
|
||||
int (*hook) (const pupa_partition_t partition));
|
||||
char *EXPORT_FUNC(pupa_partition_get_name) (const pupa_partition_t partition);
|
||||
|
||||
|
||||
static inline unsigned long
|
||||
pupa_partition_get_start (const pupa_partition_t p)
|
||||
{
|
||||
return p->start;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
pupa_partition_get_len (const pupa_partition_t p)
|
||||
{
|
||||
return p->len;
|
||||
}
|
||||
|
||||
#endif /* ! PUPA_PARTITION_HEADER */
|
33
include/grub/powerpc/ieee1275/time.h
Normal file
33
include/grub/powerpc/ieee1275/time.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003 Marco Gerards <metgerards@student.han.nl>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_TIME_HEADER
|
||||
#define KERNEL_TIME_HEADER 1
|
||||
|
||||
#ifdef PUPA_UTIL
|
||||
# include <time.h>
|
||||
# define PUPA_TICKS_PER_SECOND CLOCKS_PER_SEC
|
||||
#else
|
||||
# define PUPA_TICKS_PER_SECOND 18
|
||||
#endif
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
pupa_uint32_t pupa_get_rtc (void);
|
||||
|
||||
#endif /* ! KERNEL_TIME_HEADER */
|
28
include/grub/powerpc/ieee1275/util/biosdisk.h
Normal file
28
include/grub/powerpc/ieee1275/util/biosdisk.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* biosdisk.h - emulate biosdisk */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* PUPA is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PUPA; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_BIOSDISK_MACHINE_UTIL_HEADER
|
||||
#define PUPA_BIOSDISK_MACHINE_UTIL_HEADER 1
|
||||
|
||||
void pupa_util_biosdisk_init (const char *dev_map);
|
||||
void pupa_util_biosdisk_fini (void);
|
||||
char *pupa_util_biosdisk_get_pupa_dev (const char *os_dev);
|
||||
|
||||
#endif /* ! PUPA_BIOSDISK_MACHINE_UTIL_HEADER */
|
25
include/grub/powerpc/setjmp.h
Normal file
25
include/grub/powerpc/setjmp.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_SETJMP_CPU_HEADER
|
||||
#define PUPA_SETJMP_CPU_HEADER 1
|
||||
|
||||
typedef unsigned long pupa_jmp_buf[6];
|
||||
|
||||
#endif /* ! PUPA_SETJMP_CPU_HEADER */
|
32
include/grub/powerpc/types.h
Normal file
32
include/grub/powerpc/types.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* PUPA is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PUPA; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef PUPA_TYPES_CPU_HEADER
|
||||
#define PUPA_TYPES_CPU_HEADER 1
|
||||
|
||||
/* The size of void *. */
|
||||
#define PUPA_HOST_SIZEOF_VOID_P 4
|
||||
|
||||
/* The size of long. */
|
||||
#define PUPA_HOST_SIZEOF_LONG 4
|
||||
|
||||
/* powerpc is little-endian. */
|
||||
#undef PUPA_HOST_WORDS_LITTLEENDIAN
|
||||
|
||||
#endif /* ! PUPA_TYPES_CPU_HEADER */
|
106
kern/powerpc/ieee1275/init.c
Normal file
106
kern/powerpc/ieee1275/init.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* init.c -- Initialize PUPA on the newworld mac (PPC). */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <pupa/kernel.h>
|
||||
#include <pupa/dl.h>
|
||||
#include <pupa/disk.h>
|
||||
#include <pupa/mm.h>
|
||||
#include <pupa/machine/partition.h>
|
||||
#include <pupa/machine/ieee1275.h>
|
||||
#include <pupa/normal.h>
|
||||
#include <pupa/fs.h>
|
||||
#include <pupa/setjmp.h>
|
||||
#include <env.h>
|
||||
|
||||
void pupa_ofdisk_init (void);
|
||||
void pupa_console_init (void);
|
||||
|
||||
|
||||
/* XXX: Modules are not yet supported. */
|
||||
pupa_addr_t pupa_end_addr = -1;
|
||||
pupa_addr_t pupa_total_module_size = 0;
|
||||
|
||||
void
|
||||
abort (void)
|
||||
{
|
||||
for (;;);
|
||||
}
|
||||
|
||||
void
|
||||
pupa_machine_init (void)
|
||||
{
|
||||
void *mem;
|
||||
|
||||
if (pupa_ieee1275_claim ((void *) 0x300000, 0x150000, 0, &mem) == -1)
|
||||
abort (); /* Damn, we are in trouble! */
|
||||
|
||||
/* The memory allocations were copied from yaboot. */
|
||||
pupa_mm_init_region ((void *) 0x300000, 0x150000);
|
||||
|
||||
/* XXX: Loadable modules are not supported. */
|
||||
pupa_env_set ("prefix", "");
|
||||
|
||||
pupa_ext2_init ();
|
||||
pupa_ofdisk_init ();
|
||||
pupa_console_init ();
|
||||
}
|
||||
|
||||
int
|
||||
pupa_arch_dl_check_header (void *ehdr __attribute ((unused)),
|
||||
pupa_size_t size __attribute ((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pupa_err_t
|
||||
pupa_arch_dl_relocate_symbols (pupa_dl_t mod __attribute ((unused)),
|
||||
void *ehdr __attribute ((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
pupa_stop (void)
|
||||
{
|
||||
for (;;);
|
||||
}
|
||||
|
||||
void
|
||||
pupa_register_exported_symbols (void)
|
||||
{
|
||||
}
|
||||
|
||||
pupa_uint32_t
|
||||
pupa_get_rtc (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pupa_setjmp (pupa_jmp_buf env __attribute ((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
pupa_longjmp (pupa_jmp_buf env __attribute ((unused)),
|
||||
int val __attribute ((unused)))
|
||||
{
|
||||
}
|
86
kern/powerpc/ieee1275/openfw.c
Normal file
86
kern/powerpc/ieee1275/openfw.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* openfw.c -- Open firmware support funtions. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <pupa/err.h>
|
||||
#include <pupa/misc.h>
|
||||
#include <pupa/mm.h>
|
||||
#include <pupa/machine/ieee1275.h>
|
||||
|
||||
/* Iterate through all device aliasses. Thisfunction can be used to
|
||||
find a device of a specific type. */
|
||||
pupa_err_t
|
||||
pupa_devalias_iterate (int (*hook) (struct pupa_ieee1275_devalias *alias))
|
||||
{
|
||||
pupa_ieee1275_phandle_t devalias;
|
||||
char aliasname[32];
|
||||
int actual;
|
||||
struct pupa_ieee1275_devalias alias;
|
||||
|
||||
if (pupa_ieee1275_finddevice ("/aliases", &devalias))
|
||||
return -1;
|
||||
|
||||
/* XXX: Is this the right way to find the first property? */
|
||||
aliasname[0] = '\0';
|
||||
|
||||
/* XXX: Are the while conditions correct? */
|
||||
while (pupa_ieee1275_next_property (devalias, aliasname, aliasname, &actual)
|
||||
|| actual)
|
||||
{
|
||||
pupa_ieee1275_phandle_t dev;
|
||||
pupa_size_t pathlen;
|
||||
char *devpath;
|
||||
/* XXX: This should be large enough for any possible case. */
|
||||
char devtype[64];
|
||||
|
||||
pupa_ieee1275_get_property_length (devalias, aliasname, &pathlen);
|
||||
devpath = pupa_malloc (pathlen);
|
||||
if (! devpath)
|
||||
return pupa_errno;
|
||||
|
||||
if (pupa_ieee1275_get_property (devalias, aliasname, devpath, pathlen,
|
||||
&actual))
|
||||
{
|
||||
pupa_free (devpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pupa_ieee1275_finddevice (devpath, &dev))
|
||||
{
|
||||
pupa_free (devpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pupa_ieee1275_get_property (dev, "device_type", devtype, sizeof devtype,
|
||||
&actual))
|
||||
{
|
||||
pupa_free (devpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
alias.name = aliasname;
|
||||
alias.path= devpath;
|
||||
alias.type = devtype;
|
||||
hook (&alias);
|
||||
|
||||
pupa_free (devpath);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -269,6 +269,7 @@ pupa_tab_complete (char *buf, int *restore)
|
|||
add_completion (devname, ")", "disks", print_simple_completion);
|
||||
}
|
||||
|
||||
pupa_errno = PUPA_ERR_NONE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
308
term/powerpc/ieee1275/ofconsole.c
Normal file
308
term/powerpc/ieee1275/ofconsole.c
Normal file
|
@ -0,0 +1,308 @@
|
|||
/* ofconsole.c -- Open Firmware console for PUPA. */
|
||||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <pupa/machine/console.h>
|
||||
#include <pupa/machine/ieee1275.h>
|
||||
#include <pupa/term.h>
|
||||
#include <pupa/types.h>
|
||||
#include <pupa/misc.h>
|
||||
|
||||
static pupa_ieee1275_ihandle_t stdout_ihandle;
|
||||
static pupa_ieee1275_ihandle_t stdin_ihandle;
|
||||
|
||||
static int pupa_curr_x;
|
||||
static int pupa_curr_y;
|
||||
|
||||
static int pupa_keybuf;
|
||||
static int pupa_buflen;
|
||||
|
||||
struct color
|
||||
{
|
||||
int red;
|
||||
int green;
|
||||
int blue;
|
||||
};
|
||||
|
||||
#define MAX 0xff
|
||||
static struct color colors[8] =
|
||||
{
|
||||
{ 0, 0, 0},
|
||||
{ MAX, 0, 0},
|
||||
{ 0, MAX, 0},
|
||||
{ MAX, MAX, 0},
|
||||
{ 0, 0, MAX},
|
||||
{ MAX, 0, MAX},
|
||||
{ 0, MAX, MAX},
|
||||
{ MAX, MAX, MAX}
|
||||
};
|
||||
|
||||
static int fgcolor = 7;
|
||||
static int bgcolor = 0;
|
||||
|
||||
/* Write control characters to the console. */
|
||||
static void
|
||||
pupa_ofconsole_writeesc (const char *str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
char chr = *(str++);
|
||||
pupa_ieee1275_write (stdout_ihandle, &chr, 1, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofconsole_putchar (pupa_uint32_t c)
|
||||
{
|
||||
char chr = c;
|
||||
if (c == '\n')
|
||||
{
|
||||
pupa_curr_y++;
|
||||
pupa_curr_x = 0;
|
||||
}
|
||||
else
|
||||
pupa_curr_x++;
|
||||
pupa_ieee1275_write (stdout_ihandle, &chr, 1, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofconsole_setcolorstate (pupa_term_color_state state)
|
||||
{
|
||||
char setcol[20];
|
||||
int fg;
|
||||
int bg;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case PUPA_TERM_COLOR_STANDARD:
|
||||
case PUPA_TERM_COLOR_NORMAL:
|
||||
fg = fgcolor;
|
||||
bg = bgcolor;
|
||||
break;
|
||||
case PUPA_TERM_COLOR_HIGHLIGHT:
|
||||
fg = bgcolor;
|
||||
bg = fgcolor;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
pupa_sprintf (setcol, "\e[3%dm\e[4%dm", fg, bg);
|
||||
pupa_ofconsole_writeesc (setcol);
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofconsole_setcolor (pupa_uint8_t normal_color,
|
||||
pupa_uint8_t highlight_color)
|
||||
{
|
||||
fgcolor = normal_color;
|
||||
bgcolor = highlight_color;
|
||||
}
|
||||
|
||||
static int
|
||||
pupa_ofconsole_readkey (int *key)
|
||||
{
|
||||
char c;
|
||||
int actual = 0;
|
||||
|
||||
pupa_ieee1275_read (stdin_ihandle, &c, 1, &actual);
|
||||
|
||||
if (actual && c == '\e')
|
||||
{
|
||||
pupa_ieee1275_read (stdin_ihandle, &c, 1, &actual);
|
||||
if (! actual)
|
||||
{
|
||||
*key = '\e';
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (c != 91)
|
||||
return 0;
|
||||
|
||||
pupa_ieee1275_read (stdin_ihandle, &c, 1, &actual);
|
||||
if (! actual)
|
||||
return 0;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 65:
|
||||
/* Up: Ctrl-p. */
|
||||
c = 16;
|
||||
break;
|
||||
case 66:
|
||||
/* Down: Ctrl-n. */
|
||||
c = 14;
|
||||
break;
|
||||
case 67:
|
||||
/* Right: Ctrl-f. */
|
||||
c = 6;
|
||||
break;
|
||||
case 68:
|
||||
/* Left: Ctrl-b. */
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*key = c;
|
||||
return actual;
|
||||
}
|
||||
|
||||
static int
|
||||
pupa_ofconsole_checkkey (void)
|
||||
{
|
||||
int key;
|
||||
int read;
|
||||
|
||||
if (pupa_buflen)
|
||||
return 1;
|
||||
|
||||
read = pupa_ofconsole_readkey (&key);
|
||||
if (read)
|
||||
{
|
||||
pupa_keybuf = key;
|
||||
pupa_buflen = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pupa_ofconsole_getkey (void)
|
||||
{
|
||||
int key;
|
||||
|
||||
if (pupa_buflen)
|
||||
{
|
||||
pupa_buflen =0;
|
||||
return pupa_keybuf;
|
||||
}
|
||||
|
||||
while (! pupa_ofconsole_readkey (&key));
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static pupa_uint16_t
|
||||
pupa_ofconsole_getxy (void)
|
||||
{
|
||||
return ((pupa_curr_x - 1) << 8) | pupa_curr_y;
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofconsole_gotoxy (pupa_uint8_t x, pupa_uint8_t y)
|
||||
{
|
||||
char s[11]; /* 5 + 3 + 3. */
|
||||
pupa_curr_x = x;
|
||||
pupa_curr_y = y;
|
||||
|
||||
pupa_sprintf (s, "\e[%d;%dH", y - 1, x + 1);
|
||||
pupa_ofconsole_writeesc (s);
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofconsole_cls (void)
|
||||
{
|
||||
/* Clear the screen. */
|
||||
pupa_ofconsole_writeesc ("");
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofconsole_setcursor (int on __attribute ((unused)))
|
||||
{
|
||||
/* XXX: Not supported. */
|
||||
}
|
||||
|
||||
static void
|
||||
pupa_ofconsole_refresh (void)
|
||||
{
|
||||
/* Do nothing, the current console state is ok. */
|
||||
}
|
||||
|
||||
static pupa_err_t
|
||||
pupa_ofconsole_init (void)
|
||||
{
|
||||
pupa_ieee1275_phandle_t chosen;
|
||||
char data[4];
|
||||
pupa_size_t actual;
|
||||
int col;
|
||||
|
||||
if (pupa_ieee1275_finddevice ("/chosen", &chosen))
|
||||
return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Cannot find /chosen");
|
||||
|
||||
if (pupa_ieee1275_get_property (chosen, "stdout", data, sizeof data,
|
||||
&actual)
|
||||
|| actual != sizeof data)
|
||||
return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
|
||||
|
||||
stdout_ihandle = pupa_ieee1275_decode_int_4 (data);
|
||||
|
||||
if (pupa_ieee1275_get_property (chosen, "stdin", data, sizeof data,
|
||||
&actual)
|
||||
|| actual != sizeof data)
|
||||
return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
|
||||
|
||||
stdin_ihandle = pupa_ieee1275_decode_int_4 (data);
|
||||
|
||||
/* Initialize colors. */
|
||||
for (col = 0; col < 7; col++)
|
||||
pupa_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
|
||||
colors[col].green, colors[col].blue);
|
||||
|
||||
/* Set the right fg and bg colors. */
|
||||
pupa_ofconsole_setcolorstate (PUPA_TERM_COLOR_NORMAL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static pupa_err_t
|
||||
pupa_ofconsole_fini (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct pupa_term pupa_ofconsole_term =
|
||||
{
|
||||
.name = "ofconsole",
|
||||
.init = pupa_ofconsole_init,
|
||||
.fini = pupa_ofconsole_fini,
|
||||
.putchar = pupa_ofconsole_putchar,
|
||||
.checkkey = pupa_ofconsole_checkkey,
|
||||
.getkey = pupa_ofconsole_getkey,
|
||||
.getxy = pupa_ofconsole_getxy,
|
||||
.gotoxy = pupa_ofconsole_gotoxy,
|
||||
.cls = pupa_ofconsole_cls,
|
||||
.setcolorstate = pupa_ofconsole_setcolorstate,
|
||||
.setcolor = pupa_ofconsole_setcolor,
|
||||
.setcursor = pupa_ofconsole_setcursor,
|
||||
.refresh = pupa_ofconsole_refresh,
|
||||
.flags = 0,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
void
|
||||
pupa_console_init (void)
|
||||
{
|
||||
pupa_term_register (&pupa_ofconsole_term);
|
||||
pupa_term_set_current (&pupa_ofconsole_term);
|
||||
}
|
Loading…
Reference in a new issue