Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Mar 2012 21:49:41 -0800
From:      Rob Ballantyne <robballantyne3@gmail.com>
To:        Milan Obuch <freebsd-ppc@dino.sk>, jeremyhu@freedesktop.org
Cc:        freebsd-ppc@freebsd.org
Subject:   Re: Question about bootup
Message-ID:  <CAKLrb5fqn0jHrL78-%2B35bBesVkDPw8C_GfRiLuWPCJL3GgtdWg@mail.gmail.com>
In-Reply-To: <20120306075045.5be555b9@zeta.dino.sk>
References:  <CAKLrb5d=fos09L0fHY3Qdf4YRZ5FYBmHTV21iMzEybB65DpoSw@mail.gmail.com> <20120306075045.5be555b9@zeta.dino.sk>

next in thread | previous in thread | raw e-mail | index | archive | help
Thank you Milan and Jeremy,

  That helped a lot.

  I looked at the code for bsdinstall that sets up the bootable disk
and it appears
to use GEOM/gpart to partition the disk.  The manpage for gpart
indicates it understands
the Apple Partition system (APM).

  It appears that an HFS image file is manipulated during the kernel
build process in
the following section of a Makefile (/usr/src/sys/boot/powerpc/boot1.chrp)

boot1.hfs: boot1.elf bootinfo.txt
	echo ${.OBJDIR}
	uudecode ${.CURDIR}/hfs.tmpl.bz2.uu
	mv hfs.tmpl.bz2 ${.TARGET}.bz2
	bzip2 -f -d ${.TARGET}.bz2
	dd if=3Dboot1.elf of=3D${.TARGET} seek=3D${BOOT1_OFFSET} conv=3Dnotrunc
	dd if=3D${.CURDIR}/bootinfo.txt of=3D${.TARGET} seek=3D${BOOTINFO_OFFSET} =
\
	    conv=3Dnotrunc

  It appears you may be able to substitute your own
boot.elf/bootinfo.txt files at
this stage (although it appears since the file content is being
'poked' into an existing
hfs image this might be a bit sensitive to changes).

  Cheers,

Rob


On Mon, Mar 5, 2012 at 10:50 PM, Milan Obuch <freebsd-ppc@dino.sk> wrote:
> On Mon, 5 Mar 2012 22:24:36 -0800
> Rob Ballantyne <robballantyne3@gmail.com> wrote:
>
>> Hi All,
>>
>> =A0 I've been poking around trying to understand the boot up process of
>> a ppc64 G5 machine.
>>
>
> Hi,
>
> I think it is basically the same for G4 too :)
>
>> =A0 I was slightly surprised to still find an Apple Partition map disk.
>> I would have thought it was an ordinary fdisk (PC) partition setup.
>>
>
> This is most probably OpenFirmware (or implementation on machine in
> question) dependency - at least on Apple's boxes ability to load kernel
> from UFS filesystem in some newer version was removed.
>
>> =A0 Let me see if I have it right:
>>
>> 1 - OpenFirmware (OFW) load Apple_Bootstrap/boot1.elf
>
> Actually, there is Apple_Bootstrap/bootinfo.txt, a Forth wrapper script
> which is loaded first and it loads boot1.elf.
>
>> 2 - boot1.elf runs to gain enough to understand
>> UFS filesystems and loads FreeBSD UFS partition /boot/loader
>> 3 - loader loads /boot/kernel/kernel
>>
>> ... and we're off to the races.
>>
>> =A0 This strikes me as fairly simplistic so I'm sure there are more
>> details. =A0I'm curious about /boot/*.4th OpenFirmware forth code, for
>> example. =A0Is it involved in a substantial way?
>>
>
> I did not investigate here much, but as soon as /boot/kernel/loader is
> called, it should work 'the usual way' as on any other platform, i.
> e. /boot/*.4th files are used accordingly. Just a nit-pick, they have
> no relation to OpenFirmware, all they have in common is they are
> written in the same language. At least that's the way I understand it.
>
>> =A0 The other thing I'm curious about is the Apple_Bootstrap partition.
>> How is it written? =A0I've discovered parteditor within the bsdinstall
>> installer. =A0I suspect that does it but it doesn't appear to let one
>> write their own bootloader code =A0image.
>>
>
> It is small partition in Apple's HFS format or whatever the acronym is
> because it is the only format Apple's OpenFirmware understands now.
> Basically, there are two files in it - bootinfo.txt and boot1.elf, in a
> ppc directory. Both are already mentioned above.
>
>> =A0 As I said mostly curiosity and trying to understand. =A0If anyone ha=
s
>> a few words of confirmation/advice I would be glad to hear them.
>>
>
> Well, I am not an expert, I am interested in this area too, trying to
> understand, and be able to modify the boot process too. But as there
> are some differences with what I already know, sometimes it is not
> easy :)
>
> Regards,
> Milan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKLrb5fqn0jHrL78-%2B35bBesVkDPw8C_GfRiLuWPCJL3GgtdWg>