9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] restoring p9 boot blocks
@ 2003-11-29 21:49 John Stalker
  2003-11-29 23:17 ` mirtchov
  0 siblings, 1 reply; 9+ messages in thread
From: John Stalker @ 2003-11-29 21:49 UTC (permalink / raw)
  To: 9fans

I seem to have blown away the boot loader on my plan9 slice.
I can still boot fine using the WinNT bootloader, so I don't
need to dust off the install CD.  At some point it would be
nice to have a working boot sector again, though.  What is
the command to write one?  Thanks.
--
John Stalker
Department of Mathematics
Princeton University
(609)258-6469


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] restoring p9 boot blocks
  2003-11-29 21:49 [9fans] restoring p9 boot blocks John Stalker
@ 2003-11-29 23:17 ` mirtchov
  2003-11-29 23:40   ` John Stalker
  0 siblings, 1 reply; 9+ messages in thread
From: mirtchov @ 2003-11-29 23:17 UTC (permalink / raw)
  To: 9fans

man mbr, the command you need is 'disk/mbr' i believe...

andrey


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] restoring p9 boot blocks
  2003-11-29 23:17 ` mirtchov
@ 2003-11-29 23:40   ` John Stalker
  2003-11-29 23:52     ` mirtchov
  0 siblings, 1 reply; 9+ messages in thread
From: John Stalker @ 2003-11-29 23:40 UTC (permalink / raw)
  To: 9fans

I read that.  Both the man page and the name suggest that this
writes a Master Boot Record.  I have a working Master Boot Record,
however.  It is the boot sector of the plan9 partition which I
seem to have hosed.  Please correct me if I am mistaken about
what disk/mbr does.  I think I need something like
disk/format -b something /dev/sdC0/9fat some other options.
Sorry if my original message was rather confused.

> man mbr, the command you need is 'disk/mbr' i believe...
>
> andrey
>

--
John Stalker
Department of Mathematics
Princeton University
(609)258-6469


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] restoring p9 boot blocks
  2003-11-29 23:40   ` John Stalker
@ 2003-11-29 23:52     ` mirtchov
  2003-11-30  0:23       ` John Stalker
  2003-11-30  1:48       ` [9fans] A question for Russ Ishwar Rattan
  0 siblings, 2 replies; 9+ messages in thread
From: mirtchov @ 2003-11-29 23:52 UTC (permalink / raw)
  To: 9fans

try setting the 'bootable' flag on the 9fat partition in disk/prep...

i remember this solving my problem several times in both plan9 and freesbd :)

andrey


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] restoring p9 boot blocks
  2003-11-29 23:52     ` mirtchov
@ 2003-11-30  0:23       ` John Stalker
  2003-11-30 14:28         ` Russ Cox
  2003-11-30  1:48       ` [9fans] A question for Russ Ishwar Rattan
  1 sibling, 1 reply; 9+ messages in thread
From: John Stalker @ 2003-11-30  0:23 UTC (permalink / raw)
  To: 9fans

Unfortunately it's an extended partition, so disk/fdisk won't
set it as active.  I believe that's a limitation of the pc
architecture rather than of fdisk itself.  This is, in fact,
the main problem with installing FreeBSD on an extended
partition.  plan9 is supposed to be happy on an extended
partition, or rather I know I've done it in the past without
incident.


> try setting the 'bootable' flag on the 9fat partition in disk/prep...
>
> i remember this solving my problem several times in both plan9 and freesbd :)
>
> andrey
>

--
John Stalker
Department of Mathematics
Princeton University
(609)258-6469


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [9fans] A question for Russ..
  2003-11-29 23:52     ` mirtchov
  2003-11-30  0:23       ` John Stalker
@ 2003-11-30  1:48       ` Ishwar Rattan
  2003-11-30 14:18         ` [9fans] using plan 9 libraries on unix Russ Cox
  1 sibling, 1 reply; 9+ messages in thread
From: Ishwar Rattan @ 2003-11-30  1:48 UTC (permalink / raw)
  To: 9fans

How does one the use Plan 9 libraries under Linux
after installation in /usr/local/Plan9?

Thanks in advance,
-ishwar




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] using plan 9 libraries on unix
  2003-11-30  1:48       ` [9fans] A question for Russ Ishwar Rattan
@ 2003-11-30 14:18         ` Russ Cox
  0 siblings, 0 replies; 9+ messages in thread
From: Russ Cox @ 2003-11-30 14:18 UTC (permalink / raw)
  To: 9fans

> How does one the use Plan 9 libraries under Linux
> after installation in /usr/local/Plan9?

I'm assuming you built and installed them (see /usr/local/plan9/NOTES).

In your environment set

	PLAN9=/usr/local/plan9 export PLAN9
	PATH=$PATH:/usr/local/plan9/bin export PATH

Then you'll have 9c, 9a, 9l, and 9ar that are
shell scripts around the system tools to make
them behave mostly like the Plan 9 tools.

So

	cat >x.c <<EOF
	#include <u.h>
	#include <libc.h>

	void
	main(void)
	{
		print("hello, world\n");
	}
	EOF
	9c x.c
	9l x.o
	./a.out

You can use mkfiles too, with minimal changes.
Instead of </$objtype/mkfile use <$PLAN9/src/mkhdr
and instead of </sys/src/cmd/mkone use <$PLAN9/src/mkone.
Ditto for mkmany, mksyslib.

<u.h> is an empty file, but <libc.h> (really <lib9.h>)
does not play nicely with the other headers.  It #defines
a few things to make the compilation world look
like Plan 9.  If you want to include other system
headers, you're likely to have to

	#define NOPLAN9DEFINES
	#include <u.h>
	#include <libc.h>
	#include <other headers>

and then put p9 at the beginning of calls to the various
renamed functions (e.g., p9wait, p9dup, p9open).
I am not happy with this, but there's no easy
way around it.  At some point I might shift things
around so you can say

	#include <u.h>
	#include <other headers>
	#include <libc.h>

The problem with doing that now is that libc.h defines
things like _POSIX_SOURCE and _BSD_SOURCE, which cause
headers like <sys/types.h> to behave differently.
If the other headers have already included <sys/types.h>
then when libc.h includes it, it will be a no-op and
not set things up as expected.  If I move all the _POSIX_SOURCE
and such into <u.h> then the above example would work.
In general I don't mix these in the same file (except
in the implementation of lib9) so it's not an issue.

Russ


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] restoring p9 boot blocks
  2003-11-30  0:23       ` John Stalker
@ 2003-11-30 14:28         ` Russ Cox
  2003-11-30 20:58           ` John Stalker
  0 siblings, 1 reply; 9+ messages in thread
From: Russ Cox @ 2003-11-30 14:28 UTC (permalink / raw)
  To: 9fans

> Unfortunately it's an extended partition, so disk/fdisk won't
> set it as active.  I believe that's a limitation of the pc
> architecture rather than of fdisk itself.  This is, in fact,
> the main problem with installing FreeBSD on an extended
> partition.  plan9 is supposed to be happy on an extended
> partition, or rather I know I've done it in the past without
> incident.
>
>
> > try setting the 'bootable' flag on the 9fat partition in disk/prep...
> >
> > i remember this solving my problem several times in both plan9 and freesbd
> :)

if it were a primary partition you'd use

	disk/format -b /386/pbslba /dev/sdC0/9fat

however, as an extended partition i'm not sure
you can actually boot from it.  which boot loader
were you using before?  i'm not sure i know of any
that will boot extended partitions.

	disk/mbr -m /386/mbr /dev/sdC0/data

will install a new mbr, as andrey said, but that
shouldn't be necessary -- the windows one is
typically fine.

how were you selecting between windows and plan 9?
the windows boot menu perhaps?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] restoring p9 boot blocks
  2003-11-30 14:28         ` Russ Cox
@ 2003-11-30 20:58           ` John Stalker
  0 siblings, 0 replies; 9+ messages in thread
From: John Stalker @ 2003-11-30 20:58 UTC (permalink / raw)
  To: 9fans

I was using GAG, which is functionally similar to LILO but less
hideous.  It just loads the boot sector of the selected
partition into memory and jumps.  Yesterday I tried

disk/format -b /386/pbslba -d -r 2 /dev/sdC0/9fat \
	/386/9load /386/9pcdisk /386/9paddington

9paddington was a 9pcauth variant I was playing with.  This
more or less worked.  I neglected to include plan9.ini, so
I had to recontruct that from memory and the man page.  9load
can't find 9paddington.  I assume this is the usual 8+3 nonsense.
It doesn't matter much as (a) 9load can still find it as
sdC0!fs!/386/9paddington and (b) it doesn't work properly so I
am using 9pcdisk anyway.

The current status is that I have a working boot loader chain
again, so there is no need to bother anyone further.  Thanks to
all who sent suggestions, either by mail or on 9fans.  I'm still
not sure how I blew away the boot blocks in the first place.
Once I figure that out, presumably by repeating the same error,
I will warn others here.


> > Unfortunately it's an extended partition, so disk/fdisk won't
> > set it as active.  I believe that's a limitation of the pc
> > architecture rather than of fdisk itself.  This is, in fact,
> > the main problem with installing FreeBSD on an extended
> > partition.  plan9 is supposed to be happy on an extended
> > partition, or rather I know I've done it in the past without
> > incident.
> >
> >
> > > try setting the 'bootable' flag on the 9fat partition in disk/prep...
> > >
> > > i remember this solving my problem several times in both plan9 and freesb
d
> > :)
>
> if it were a primary partition you'd use
>
> 	disk/format -b /386/pbslba /dev/sdC0/9fat
>
> however, as an extended partition i'm not sure
> you can actually boot from it.  which boot loader
> were you using before?  i'm not sure i know of any
> that will boot extended partitions.
>
> 	disk/mbr -m /386/mbr /dev/sdC0/data
>
> will install a new mbr, as andrey said, but that
> shouldn't be necessary -- the windows one is
> typically fine.
>
> how were you selecting between windows and plan 9?
> the windows boot menu perhaps?
>
>

--
John Stalker
Department of Mathematics
Princeton University
(609)258-6469


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-11-30 20:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-29 21:49 [9fans] restoring p9 boot blocks John Stalker
2003-11-29 23:17 ` mirtchov
2003-11-29 23:40   ` John Stalker
2003-11-29 23:52     ` mirtchov
2003-11-30  0:23       ` John Stalker
2003-11-30 14:28         ` Russ Cox
2003-11-30 20:58           ` John Stalker
2003-11-30  1:48       ` [9fans] A question for Russ Ishwar Rattan
2003-11-30 14:18         ` [9fans] using plan 9 libraries on unix Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).