Skip to contentSkip to conversation

preploader (re:Linux-2.1.129 boot on MCP750)

DISCUSSION Gabriel Paubert 3 participants 4 messages Dec 15, 1998 – Dec 16, 1998 1 message not in the archive Kbuild

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 13936.2484.315786.483720@porto

#1 lore raw

[Sorry for the other readers, part of this message is in French, but Loic found the most serious problem in the new preploader. I have also added all the people who have been interested in this at one time or another, including the last discussion about MILO like things.]

Quoted 3 lines · Loic Prylli

Youpi, j'ai enfin reussi a utiliser preploader !! :-)

Great.

[snipped]

[Loic explaining how he found the bug, and the patch he used, which unfortunately would not work on a 601]

Quoted 32 lines

En fait ma question originale n'etait pas sur la MMU dans la partie principale de preploader, mais dans les dernieres instructions apres le decompress_kernel, et dans le code initial du noyau, la ou le plantage survient. Je me suis fait une fonction serial_putc qui:
- active la MMU si elle ne l'est pas avec un mapping de base
- rajoute une entree dans les BAT si la MMU est activee mais la zone PCI/IO non configuree

Cela m'a permis de localiser le probleme en faisant des sorties series a intervalles reguliers: il y avait un plantage dans le memcpy qui recopie le residual dans arch/ppc/kernel/setup.c, ceci parce que le residual etait a la fin des 64Mo de memoire alors que dans sa premier phase de bootstrap le noyau ne mappe que les premiers 4Mo, le probleme est resolu en changeant arch/ppc/kernel/head.S pour mapper initialement le maximum, c'est a dire 256 Mo de memoire:

RCS file: /cvsroot/linux/arch/ppc/kernel/head.S,v
retrieving revision 1.112
diff -u -r1.112 head.S

12/10 17:36:01 renamed from 11/15 19:49:18 1.112 +1 -1
@@ -237,7 +258,7 @@
        b       5f
 4:
 #ifndef CONFIG_APUS
-       ori     r11,r11,0x1fe           /* set up BAT registers for 604 */
+       ori     r11,r11,0x1ffe          /* set up BAT registers for 604 */
        li      r8,2                    /* R/W access */
 #else
        ori     r11,r11,0xfe            /* set up an 8MB mapping */
Quoted 2 lines

Le probleme ne se posait pas avec le boot par defaut parce que celui recopiait le residual au debut de la memoire avant de lancer le noyau.

Indeed, I did not experience any problem because I do all my developments on a poor 16Mb machine. You'll find a new version of the preploader at the usual site:

ftp://vcorr1.iram.es/pub/preploader.tgz

ands the corresponding 2.1.130 zImage with builtin de4x5 and ncr53c8xx drivers (ext2 and nfs filesystems but no root on NFS). This kernel also includes support for OpenPIC on Raven machines.

I would like to have as many reports as possible, both from failures and successes.

There is also a problem which bothers me because I simply can't understand how some people do not get a boot prompt for kernel parameters. I have never encountered this problem and absolutely need to track it down.

What is preploader (and how does it compare to MILO):

- it is an attempt at a clean linux loader for Linux/PPC on PreP machines (might be extended to other machines too).

- it configures PCI resources in a saner way than most firmware (I/O and memory mapped regions), I needed this to work around bugs in some S3 boards (there is a blakclist with one entry now, but it could and should be extended). However it does not yet support PCI<->PCI bridges, I would need the help of somebody with a such a beast with some actual devices plugged-in (any MCP750 with additional CompactPCI boards for example).

- it includes an x86 emulator which allows me to properly initialize my S3 board.

- if no graphics adapter is detected or the keyboard is disconnected, it automatically falls back to serial console (at least it should).

What's new in this version:

- problems with memory > 16Mb should be solved

- the makefile has been improved and should work right out of the box

- by default the -DEBUG flag is set in the makefile and it will spit out a lot of info about PCI mappings and some relocation information.

- it needs to shuffle much more data around to work with the weirdest possible memory maps (it should correctly handle any combination of residual data and load addresses), so don't be surprised if it takes a full 10-20ms more to boot than the preceding version ;-)

Future plans (if Cort agrees):

- if I have enough success reports, I plan to include it in an arch/ppc/prepboot directory so that it can become part of the general linux-kernel archives (at least at vger for now). For this step I will need the help of some makefile gurus, I'm unfortunately completely hermetic to makefile concepts and syntax, and experience has shown that it takes me more time to debug a makefile of 50 lines than 5000 lines of PPC assembly.

How to use it:

- unpack preploader.tgz in any directory (it will create a preploader subdirectory). Then 'cd preploader; make' should take your /usr.src/linux/vmlinux file and pack it into a zImage suitable for booting.

- warning: you need binutils>=2.9.1.0.13

May I insist again that both *success* and *failure* reports are very important. They should include all possible details on the HW, as well as the console logs if the loader gets to the point of spitting out any information.

Regards,
Gabriel.

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]] [[ the message 'unsubscribe' to [email protected] ]]

#2 lore raw
Quoted 10 lines · Gabriel Paubert

usual site:

ftp://vcorr1.iram.es/pub/preploader.tgz

ands the corresponding 2.1.130 zImage with builtin de4x5 and ncr53c8xx drivers (ext2 and nfs filesystems but no root on NFS). This kernel also includes support for OpenPIC on Raven machines.

I would like to have as many reports as possible, both from failures and successes.

Ok, here is my success report:

Tested on MVME230x,2300SC,2400,260x,2700, and 3600 as well as MTX. Everything appears to be detected properly as with my hacked version of the arch/ppc/boot/ code. I didn't bother trying to root to something since that should work as before.

I'm including two patches which provide for some general cleanup, cross compilation support, and inclusion into the arch/ppc/ tree. The first patch to arch/ppc/Makefile enables building in the arch/ppc/prepboot directory. The second patch is to be applied to the current preploader.tgz and then the resultant directory should be placed in arch/ppc/ and name 'prepboot'. Doing the usual build routine will then also build a zImage with the alternative prep loader.

This should not break anything to put the alternative prep loader into CVS so if Cort is happy with this then I can provide one diff versus current CVS to make inclusion easy.

Oh, and I've made a local copy of preploader.tgz available at
http://members.home.net/mmporter/linux.html for anyone else in the states that might have the same kind of bandwidth problems I had going to Gabriel's ftp server (took me 30+ minutes to get the 90k file).

...patches follow...

arch/ppc/Makefile +3 -0
@@ -45,6 +45,7 @@
 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
 MAKECOFFBOOT = $(MAKE) -C arch/$(ARCH)/coffboot
 MAKECHRPBOOT = $(MAKE) -C arch/$(ARCH)/chrpboot
+MAKEPREPBOOT = $(MAKE) -C arch/$(ARCH)/prepboot
 
 ifdef CONFIG_8xx
 SUBDIRS += arch/ppc/8xx_io
@@ -67,6 +68,7 @@
 	@$(MAKECOFFBOOT) $@
 	@$(MAKEBOOT) $@
 	@$(MAKECHRPBOOT) $@
+	@$(MAKEPREPBOOT) $@
 
 pmac_config:
 	rm -f .config arch/ppc/defconfig
@@ -100,6 +102,7 @@
 	@$(MAKECOFFBOOT) clean
 	@$(MAKEBOOT) clean
 	@$(MAKECHRPBOOT) clean
+	@$(MAKEPREPBOOT) clean
 
 archmrproper:
 

....preploader patch....

Makefile +11 -10
diff -urN preploader/Makefile prepboot/Makefile
@@ -1,5 +1,5 @@
 #
-# arch/ppc/boot/Makefile
+# arch/ppc/prepboot/Makefile
 #
 # This file is subject to the terms and conditions of the GNU General Public
 # License.  See the file "COPYING" in the main directory of this archive
@@ -10,12 +10,10 @@
 # modified by Cort ([email protected])
 # revised for PreP boot by Gabriel Paubert ([email protected])
 
-
 # I tried to use r2 for the basic structure but it seems to be incompatible
 # with the -m relocatable option.
-INCPATH		= /usr/src/linux/arch/ppc/boot
+
 ASFLAGS		= -mrelocatable
-CFLAGSINC	= -D__KERNEL__ -I/usr/src/linux/include -D__powerpc__
 CFLAGS		:= $(CFLAGS) -D__powerpc__ -msoft-float -pipe \
 		-fno-builtin -Wall -mmultiple -mstring -I$(INCPATH)\
 		-D__KERNEL__ -O2 -fomit-frame-pointer \
@@ -60,20 +58,23 @@
 #OBJECTS += vreset.o kbd.o
 
 zImage: $(OBJECTS) $(IMAGES) $(SIZES) ppcboot.lds
-	ld -o zImage $(OBJECTS) -b binary $(IMAGES) -T ppcboot.lds \
-	--defsym _vmlinux_size=`cut -f 1 <.vmlinux.size` -Map zImage.map
+	$(CROSS_COMPILE)ld -o zImage $(OBJECTS) -b binary $(IMAGES) \
+	-T ppcboot.lds --defsym _vmlinux_size=`cut -f 1 <.vmlinux.size` \
+	-Map zImage.map
 
 # The 2 objcopy are quite ugly, but for now it was the simplest solution
 # since the flags to expand the bss do not work on a binary output format.
 # It would be better to know where the bss is and clear it in the bootloader,
 # but the resulting vmlinux.gz expansion is  257 bytes, so it's not so bad.
-vmlinux.gz .vmlinux.size: /usr/src/linux/vmlinux
-	objcopy /usr/src/linux/vmlinux -S vmlinux -R .comment \
-		--set-section-flags=.bss=alloc,load,data
-	objcopy vmlinux vmlinux -O binary
+vmlinux.gz .vmlinux.size: /usr/local/src/ppc/linux/vmlinux
+	$(CROSS_COMPILE)objcopy /usr/local/src/ppc/linux/vmlinux -S vmlinux \
+	-R .comment --set-section-flags=.bss=alloc,load,data
+	$(CROSS_COMPILE)objcopy vmlinux vmlinux -O binary
 	du --bytes vmlinux >.vmlinux.size
 	gzip -vf9 vmlinux
 
 .depend dep:
 	$(CPP) -M *.S *.c -I$(INCPATH) > .depend
 
+clean:
+	rm -f *.o vmlinux* zImage*
zlib.c +1 -1
diff -urN preploader/zlib.c prepboot/zlib.c
@@ -80,7 +80,7 @@
 
          /* functions */
 
-#include <string.h>
+#include <linux/string.h>
 #define zmemcpy memcpy
 #define zmemzero(dest, len)	memset(dest, 0, len)
 

--
Matt Porter
[email protected]
Unix is a Linux-like operating system.

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]] [[ the message 'unsubscribe' to [email protected] ]]

#3 lore raw
Quoted 13 lines · Matt Porter
Quoted 10 lines · Gabriel Paubert

usual site:

ftp://vcorr1.iram.es/pub/preploader.tgz

ands the corresponding 2.1.130 zImage with builtin de4x5 and ncr53c8xx drivers (ext2 and nfs filesystems but no root on NFS). This kernel also includes support for OpenPIC on Raven machines.

I would like to have as many reports as possible, both from failures and successes.

Quoted 6 lines

Ok, here is my success report:

Tested on MVME230x,2300SC,2400,260x,2700, and 3600 as well as MTX. Everything appears to be detected properly as with my hacked version of the arch/ppc/boot/ code. I didn't bother trying to root to something since that should work as before.

Wow, MVME people are going to be happy. Did you try both net and disk boots or only net ?

Do you have any lspci -vvx output. I would also like people to test the zImage on MVME 2700 to see it interrupts work (and cat /proc/interrupts as a proof).

Quoted 7 lines

I'm including two patches which provide for some general cleanup, cross compilation support, and inclusion into the arch/ppc/ tree. The first patch to arch/ppc/Makefile enables building in the arch/ppc/prepboot directory. The second patch is to be applied to the current preploader.tgz and then the resultant directory should be placed in arch/ppc/ and name 'prepboot'. Doing the usual build routine will then also build a zImage with the alternative prep loader.

Thanks, from a Makefile-impaired hacker.

Quoted 3 lines

This should not break anything to put the alternative prep loader into CVS so if Cort is happy with this then I can provide one diff versus current CVS to make inclusion easy.

I leave this up to Cort.

Quoted 4 lines

Oh, and I've made a local copy of preploader.tgz available at
http://members.home.net/mmporter/linux.html for anyone else in the states that might have the same kind of bandwidth problems I had going to Gabriel's ftp server (took me 30+ minutes to get the 90k file).

Not surprising, 3k/min is still 50 bytes/s. Still high by local standards where surfing the web (U.S. sites) at anything higher than 20 bytes/second can be qualified as an exhilarating experience :-(

[snipped]

Quoted 4 lines

--
Matt Porter
[email protected]
Unix is a Linux-like operating system.

Indeed... ;-)

Regards,
Gabriel.

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]] [[ the message 'unsubscribe' to [email protected] ]]

#4 lore raw

preploader loader sucess here on MCP750

In reply to Gabriel Paubert
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Gabriel" == Gabriel Paubert <[email protected]> writes:

Gabriel> [Sorry for the other readers, part of this message is in French, but Loic Gabriel> found the most serious problem in the new preploader. I have also added Gabriel> all the people who have been interested in this at one time or another, Gabriel> including the last discussion about MILO like things.]

Moi le francais ca me va bien :)

for non french reader the above sentence means : french is no problem for me

Gabriel> Indeed, I did not experience any problem because I do all my developments Gabriel> on a poor 16Mb machine. You'll find a new version of the preploader at the Gabriel> usual site:

Gabriel> ftp://vcorr1.iram.es/pub/preploader.tgz

Works fine here on MCP750. Hopefully matt porter did a copy on a better ftp site :)

Gabriel> ands the corresponding 2.1.130 zImage with builtin de4x5 and ncr53c8xx Gabriel> drivers (ext2 and nfs filesystems but no root on NFS). This kernel also Gabriel> includes support for OpenPIC on Raven machines.

Was unable to test it because I could not get in ... Could you copy the zImage elsewhere so that I can test the RAVEN feature?

Gabriel> I would like to have as many reports as possible, both from failures and Gabriel> successes.

-------------------------------------Success report-----------------------------

Model: cpx2208-sk2 (e2)
Serial: MOT030E5E7
Processor/Bus frequencies (Hz): 233362000/66668152 Time Base Divisor: 4000
Original MSR: 3040
Original HID0: 80a4
Original R31: 0

PCI: Probing PCI hardware
Configurable PCI resources:

  1e9e048 :1e9e270  14     3c000000 40000    0
  1e9e270 :1e9e258  8018   3bffe000 1000     0
  1e9e258 :1e9e1e0  8014   3bfffe00 100      0
  1e9e1e0 :1e9e240  7014   3bffff00 80       0
  1e9e240 :1e9e1c8  8010   ffffe00  100      1
  1e9e1c8 :0        7010   fffff00  80       1
alloc_area called:
  PCI I/O areas:
    1e9e338 :1e9e2f0  1f71e84  10000    10fff   
    1e9e2f0 :0        0        11000    7ff000  
  PCI memory areas:
    1e9e308 :0        0        1000000  3cf00000
alloc_area called:
  PCI I/O areas:
    1e9e338 :1e9e2f0  1f71e84  10000    10fff   
    1e9e2f0 :0        0        11000    7ff000  
  PCI memory areas:
    1e9e368 :1e9e308  1f71e84  1000000  10fffff 
    1e9e308 :0        0        1100000  3cf00000
Allocated PCI resources:
  1e9e048 :1e9e270  14     1000000  40000    0
  1e9e270 :1e9e258  8018   1040000  1000     0
  1e9e258 :1e9e1e0  8014   1041000  100      0
  1e9e1e0 :1e9e240  7014   1041100  80       0
  1e9e240 :1e9e1c8  8010   10000    100      1
  1e9e1c8 :0        7010   10100    80       1

Linux/PPC load: console=ttyS0

Uncompressing the kernel...Kernel at 0, size=0x1d1284
Residual data at 0x1d2000
Command line at 0x1d9000
done
Now booting...
Total memory = 32MB; using 128kB for hash table (at c01e0000)
Linux version 2.1.129 ([email protected]) (gcc version egcs-2.91.57 19980901 (egcs-1.1 release)) #112 Mon Dec 7 20:42:22 CET 1998
------------------------------------------------------------------

Gabriel> - if I have enough success reports, I plan to include it in an Gabriel> arch/ppc/prepboot directory so that it can become part of the general Gabriel> linux-kernel archives (at least at vger for now).

I'm in favor of that :)

Gabriel> For this step I will
Gabriel> need the help of some makefile gurus, I'm unfortunately completely Gabriel> hermetic to makefile concepts and syntax, and experience has shown that it Gabriel> takes me more time to debug a makefile of 50 lines than 5000 lines of PPC Gabriel> assembly.

Well I can help here. I add to modify several line in the Makefile because the PATH /usr/src/linux was used at several places. While preloader is not the official preboot code It could help to have a line like

LINUX_DIR=/usr/src/linux

and then replace any /usr/src/linux by $(LINUX_DIR)...

Things are a little bit worse for console.c that has an absolute PATH.

I would suggest to make something like

console.c : defkeymap.c

defkeymap.c:

	ln -s $(LINUX_DIR)/drivers/char/defkeymap.c .

and to have only

#include <defkeymap.c> in console.c

NOTE : of course this is needed only while we have it in a separate directory
as other Makefile variable can be used if compiled in the linux tree...

Signature · 13 lines
   __                 
  /  `                   	Eric Valette
 /--   __  o _.          	Canon CRF
(___, / (_(_(__         	Rue de la touche lambert
				35517 Cesson-Sevigne  Cedex
				FRANCE
Tel: +33 (0)2 99 87 68 91	Fax: +33 (0)2 99 84 11 30
E-mail: [email protected]

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to [email protected] ]]