Tony Breeds [Tue, 10 Feb 2009 03:11:23 +0000 (14:11 +1100)]
Be explicit in order of evaluation in the reiserfs code
GCC Has helpfully pointed out that we're doing some strange things:
second/fs_reiserfs.c: In function ‘block_read’:
second/fs_reiserfs.c:219: warning: operation on ‘journal_table’ may be undefined
second/fs_reiserfs.c:219: warning: operation on ‘journal_table’ may be undefined
second/fs_reiserfs.c:219: warning: operation on ‘journal_table’ may be undefined
second/fs_reiserfs.c: In function ‘next_key’:
second/fs_reiserfs.c:619: warning: operation on ‘depth’ may be undefined
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Tony Breeds [Tue, 10 Feb 2009 03:00:28 +0000 (14:00 +1100)]
Use explicit casts when dumping config data
GCC pointes out that we're in a gray area
second/cfg.c: In function ‘cfg_reset’:
second/cfg.c:437: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘void *’
second/cfg.c:442: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘void *’
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Tony Breeds [Tue, 10 Feb 2009 02:54:17 +0000 (13:54 +1100)]
phandle != int in prom.c
GCC this pointed out:
second/prom.c: In function ‘prom_get_netinfo’:
second/prom.c:692: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘prom_handle’
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Tony Breeds [Tue, 10 Feb 2009 03:37:44 +0000 (14:37 +1100)]
Add/Correct libgcc function prototypes
Add a prototype for ffs() from libgcc.
Instead of using log2 in reisrfs which has a different prototype to the
one libgcc, call the function reiser_log2()
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Paul Mackerras [Thu, 13 Oct 2011 18:01:12 +0000 (18:01 +0000)]
Save arguments as well as image name for CAS reboot
We were saving the image name that the user had typed (or had been
selected by default) in the "boot-last-label" property, but we were
losing any extra arguments that the user had typed after the image
name. On a pSeries machine, if the firmware decides to do a reboot
at the client-architecture-support call, we were then rebooting to
the right image but without any extra arguments that the user typed.
This fixes the problem by saving the arguments in boot-last-label,
separated from the image name by a space. When we use the value
of boot-last-label, we now call word_split to separate it into the
image name and arguments again.
Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Roman Rakus [Thu, 5 Aug 2010 05:04:46 +0000 (15:04 +1000)]
Treat iSCSI targets as block devices.
Currently iSCSI targets are treated as network devices, this doesn't always
work firmware is capable of treating them like block devices which seems more
reliable.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:44 +0000 (19:03 +0000)]
Link yaboot at 1MB
Give ourselves another 1MB of available space by moving yaboot
down to 1MB. With load-base at 0x4000, our yaboot image would have to
be 1MB-0x4000 before we should encounter problems (because firmware
would have issues relocating us from 0x4000 to 1MB).
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:43 +0000 (19:03 +0000)]
Allocate kernel and ramdisk as low as possible
We currently start the search for free memory for the kernel at
12MB. This made sense back when firmware (real-base) was always
12MB, but it doesn't now it is often at 32MB.
In light of this and now we have fixed the initrd load issues,
just try and allocate the kernel as low as possible.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:40 +0000 (19:03 +0000)]
Add prom_claim_chunk_top
We want temporary allocations to be taken from the top of our address
space so the kernel and initrd can be loaded as low as possible. The
very early kernel code uses the top of the initrd as the low watermark
for memory allocations so the lower this is the better.
We currently see a number of fails where a large initrd causes us
to run out of space in a 128MB RMO region. Allocating the temporary
areas up high and therefore the initrd lower fixes it.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:39 +0000 (19:03 +0000)]
Bump PROM_CLAIM_MAX_ADDR to 256MB
A number of machines are failing to boot because firmware takes up a
significant amount of the first 128MB. Bump our maximum to 256MB since these
boxes almost always have a 256MB RMO region.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:37 +0000 (19:03 +0000)]
print available ranges under control of linux, yaboot-debug property
Debugging yaboot failures is difficult because we often have to retest with a
yaboot built with debug enabled. As a first step to fixing this, look for a
linux,yaboot-debug property and dump the available ranges when it is non zero.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:36 +0000 (19:03 +0000)]
Use ino_size if available
If ino_size is available and returns > 0, then use it to allocate
the initrd. This allows us to claim it in one chunk and avoid
all the issues around requiring back to back claims to be
contiguous.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:35 +0000 (19:03 +0000)]
Add optional ino_size filesystem backend function
Our initrd loader is very fragile and the main reason is that it doesn't
know the size of the initrd. We end up claiming 1MB at a time and failing
completely if the new region isn't contiguous with the previous one.
Now that firmware is often at 32MB (real-base), and kernels have grown
much bigger (CONFIG_FUNCTION_TRACER and CONFIG_RELOCATABLE are two big
reasons), we see this failure a lot.
Create a function ino_size (similar to the silo bootloader) and
implement it for tftp and ext2 backends.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Thu, 8 Jul 2010 19:03:34 +0000 (19:03 +0000)]
Remove second zero of BSS
We zero the BSS in two places: once in _start() and then
again in yaboot_start(). The second time we actually get
it wrong and zero 1/4 of the BSS (since we subtract two
pointers).
Since this second zeroing is superfluous and buggy, remove
it.
While here, fix the comments in _start. It claims we aren't
clearing the BSS when we are.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Sat, 10 Apr 2010 18:05:59 +0000 (18:05 +0000)]
prom_getchar eats characters
This bug has been annoying me for a long time. If you copy and paste a
string into the yaboot prompt, or even type too fast, characters get
dropped.
It turns out we were asking OF for 4 characters, but only using the first one.
There is strange logic to look for \e[, and then oring the third character with
0x100. I haven't been able to find anyone that knows why that was there in the
first place, so just remove it and fix this bug once and for all.
Automated test infrastructures the world over will thank us for fixing this
bug!
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Anton Blanchard [Sat, 10 Apr 2010 18:05:21 +0000 (18:05 +0000)]
Remove MAX_HEADERS check
The comparison against MAX_HEADERS doesn't match the error message and
we are dynamically allocating memory for the program headers, so there
should not be a limit.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Tony Breeds [Sat, 6 Mar 2010 03:59:04 +0000 (14:59 +1100)]
extract_netinfo_args() should be a void function.
If there is no "netinfo" packet, extract_netinfo_args() will fail and cause
parse_device_path() to abort. This basically meant that yaboot will fail to
load any kernel/initrd under those circumstances.
This fix changes extract_netinfo_args() to be a void function.
Tony Breeds [Thu, 22 Oct 2009 05:20:47 +0000 (16:20 +1100)]
Do not of_open() LINUX_NATIVE partitions.
If for some reason a partition is LINUX_NATIVE but is not handled by one
of the existing filesystem drivers, of_open() /may/ appear to succeed,
but infact the ihandle is garbage.
Make sure we skip LINUX_NATIVE partitions.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Tony Breeds [Thu, 22 Oct 2009 04:53:00 +0000 (15:53 +1100)]
Handle ipv6 boot parameters for POWER architecture.
This is implementation derived.
This follows the semantics defined in section 4.3.1 of
http://www.power.org/apps/org/workgroup/parch/download.php/2380/latest
(It is under the Members area of TSC - Platform Architecture committee).
[ Fixed merge conflicts in second/file.c and second/fs_of.c ]
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Fix netboot fucntionality to use the parameters specified.
Currently, yaboot works properly when there is a tftp boot server serving
the broadcast requests sent in the network.
If the user specifies siaddr, ciaddr, and other arguments in the command
line, it is not handled appropriately.
This patch changes that behavior and make yaboot work properly in both cases.
The semantics specified in section 4.1 of
http://playground.sun.com/1275/practice/obp-tftp/tftp1_0.pdf is followed.
([bootp,]siaddr,filename,ciaddr,giaddr,bootp-retries,tftp-retries)
Will Woods [Fri, 14 Nov 2008 04:55:53 +0000 (04:55 +0000)]
ybin --bootonce doesn't work
1) It inverts the logic of a test to see if nvram is available, and
2) It assumes the output of 'nvsetenv VARNAME' will be 'VARNAME=VALUE', rather
than just 'VALUE' (as it is when using the "nvram" utility).
From bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=471425
The attached patch fixes these problems and makes --bootonce work as expected.
Signed-off-by: Roman Rakus <rrakus@redhat.com> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Mohan Kumar M [Fri, 12 Dec 2008 03:31:38 +0000 (03:31 +0000)]
Allow yaboot to load relocatable kernel
PPC64 relocatable kernels (built with CONFIG_RELOCATABLE=y) have the type of
ET_DYN. But yaboot code won't load the kernel if the ELF type is not
ET_EXEC. Attached patch adds support to yaboot to load relocatable kernels
also (ie load ET_DYN type also)
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
David Woodhouse [Fri, 28 Mar 2008 00:04:02 +0000 (00:04 +0000)]
Pegasos and partition numbering
The whole bplan partition numbering thing is a clusterfuck, but it
shouldn't be as crappy as it is.
We can _cope_ with the fact that firmware is broken and has an
off-by-one in its partition numbering. All we need to do in yaboot is
add 1 to the partition numbers we infer from in /chosen/boot-device, if
we detect that we're on an afflicted machine. That's all we need to do,
and all we ever _should_ have done. And is already in yaboot. Yaboot
does its own block device handling, including partitions, and doesn't
ever care about the firmware's problems (in that respect, at least).
It doesn't affect the installer at _all_, because the installer can't
set up the firmware's boot-device anyway and it has to be done by hand.
All it affects is the release notes telling the user how to make it
bootable.
Unfortunately, we didn't make it that simple when we first supported the
Pegasos. For reasons which aren't entirely clear to me, we ended up with
Amiga partition table support in yaboot with the _same_ off-by-one
error, to match the firmware. And thus we have hacks in the installer to
use amiga partitions for Pegasos, and to cope with the off-by-one crap.
It's only after avoiding all this crap purely by accident on Efika, by
using DOS partition tables, that I realise how stupid I was to blindly
copy the crap that other people were doing, and to believe that Pegasos
would only work with Amiga partition tables.
I'd like to get rid of the off-by-one bug in yaboot's Amiga partition
handling. At the moment, our simple 'if bplan, partition++' in
yaboot_main() is wrong when we have Amiga partitions, although it's fine
for other partition types.
Actually, I'd also like to make that same increment conditional on
!conf_given, so that if someone specifies 'conf=hd:1,/yaboot.conf' on
the command line, that partition number _isn't_ incremented.
So any time you see a proper path specified as 'dev:part,/path/name' you
know it's a real one with proper partition numbers. Remember, the bplan
firmware doesn't allow that form, and takes a space between the
'dev:part' bit and the filename:
boot hd:0 /yaboot/yaboot conf=hd:1,/yaboot/yaboot.conf
Fixing the off-by-one bug in the Amiga partition handling means that
upgrades might break. I suppose we could have a 'noamigaoffbyone'
configuration option which all newly-written yaboot.conf files would
have, which controls this behaviour. But to be honest I just don't think
it's worth it.
Mike Wolf [Tue, 15 Jan 2008 20:33:51 +0000 (14:33 -0600)]
use public interface to detect CAS reboots (take 2)
This is the second pass of this patch. The fw variable name is changed
to use ibm,client-architecture-support-reboot field which is already present
in the firmware. Please disregard the previous patch.
The firmware field used to detect CAS reboots (ibm,fw-nbr-reboots) is
really a private field that could change without warning. A new field
ibm,#reconfig-reboots will be added as a public interface intended to
be used for this detection. The patch will first check for
ibm,client-architecture-support-reboot if that is not found it will see
if ibm,fw-nbr-reboots is present and will use that instead.
Paul Nasrat [Fri, 4 Jan 2008 13:00:19 +0000 (13:00 +0000)]
The CAS (Client-Architecture Support) call tells firmware what capabilities the
OS has. These capabilities result in different modes which the device-tree is
configured in, as well as what processor capabilities are presented. So, if
the capabilities are different from what was previously booted, firmware has to
reboot to reconfigure the device-tree. The second boot will have the updated
device-tree and we can boot as normal.
When this firmware initiated reboot occurs yaboot will now boot the same kernel
as the previous boot attempt with no action by the user needed. I have
successfully booted on POWER5 and POWER6 machines using various levels of the
kernel.
Paul Nasrat [Tue, 4 Dec 2007 08:43:32 +0000 (08:43 +0000)]
The attached patch adds support for writing the nvram using the nvram
utility from the new powerpc-utils pkg from IBM; it also simplify a bit
the code.
Paul Nasrat [Mon, 3 Dec 2007 12:41:42 +0000 (12:41 +0000)]
These patch provides the function of load a alternative initrd file
specified by the user via Yaboot prompt. To load the new file, just use
the "initrd=<name_of_file>" command. The <name_of_file> could include
all the directory path to the file.
Using only the "initrd" command, Yaboot will load the default kernel
specified in the configuration file and the initrd file specified by the
user. The user can, also, specify an initrd file to any other label of
the configuration file, just adding the "initrd" command before the
label's name.
Signed-off-by: Paulo Ricardo Paz Vital <vital@br.ibm.com>
Paul Nasrat [Mon, 3 Dec 2007 12:37:10 +0000 (12:37 +0000)]
The patch from Scott Moser moves the "search-for-prom_claim'able" routine that
was present in load_elf64 and load_elf32 to a function named
prom_claim_chunk. This reduces the code-snippit duplication and makes
the function available for of_net_open.
Paul Nasrat [Fri, 17 Aug 2007 14:22:00 +0000 (15:22 +0100)]
On some of the larger kernels we are starting to see a space squeeze.
The kernel is currently being put at 20MBs and on some of the newer
pSeries systems we are getting real-bases at 32MBs (plus AIX 5.3 has
real-base at 32MB, so if AIX is ever booted, everything gets shifted).
If the uncompressed kernel+initrd is larger than 12MBs then we see
truncation (typical on install kernels).
This patch moves the KERNELADDR to 0x00C00000 (12MB). If real-base is
12MB and is loaed there, yaboot will keep going up by a megabyte until
prom_claim finds space. And the uncompressed kernel should be
indifferent where it's loaded because there's nothing at 32MB (ie it
will operate as it does today). If OF is loaded at 32MB then the 12MB
region is free and the uncompressed kernel will have more space to grow.
I have tested this on numerous pSeries boxes. I have not tested on
anything else.
Paul Nasrat [Thu, 17 May 2007 12:54:20 +0000 (13:54 +0100)]
Netboot fixes:
- the ARRAY_SIZE macro is no more needed here,
- use of cfgpath to have the actual config path to apply for mac *and* ip
lookup,
- no need to free a buffer big enough, and besides malloc(9) was not
enough ("/etc/" missed),
- use of intermediate length variables to avoid unneeded calls to strlen()
and strrchr().
benoit.guillon <benoit.guillon@tele2.fr>
Paul Nasrat [Tue, 15 May 2007 13:24:06 +0000 (14:24 +0100)]
load_my_config_file() modifications in yaboot.c
This second part, deletes the netbooting like PXE algorithm from
yaboot.c (reallocated in prom.c) and sets the use of prom_get_netinfo(),
prom_get_mac (), prom_get_ip () functions in load_my_config_file()
function to netbooting work like before the changes.
Signed-off-by: Paulo Ricardo Paz Vital <vital@br.ibm.com>
Paul Nasrat [Tue, 15 May 2007 13:23:26 +0000 (14:23 +0100)]
prom functions
This first part creates the prom_get_netinfo (), prom_get_mac (),
prom_get_ip () functions, and some structures to get the necessary
information about the MAC and IP addresses.
Actually, this is a reallocation of netbooting like PXE algorithm wrote
by Benoit Guillon [1], to be used by any other part of Yaboot to get the
netbooting information.
Paul Nasrat [Tue, 15 May 2007 13:14:43 +0000 (14:14 +0100)]
User-specified config file on Yaboot's prompt
This patch clears out the kernel image list before loading a new config file.
Leonardo Rangel lrangel at linux.vnet.ibm.com