1# ============================================================= 2# 3# linux/arch/mips/galileo/compressed/Makefile 4# 5# By RidgeRun Inc. 6# 7# Description: 8# Create a system containing a copy of the compressed vmlinux kernel. 9# The system knows how to decompress the contained kernel and then 10# jump to it resulting in a linux kernel boot. 11# 12# The system comes in three forms: 13# 14# 1. - ramsys - 15# to be loaded into ram then run. When run 16# it decompresses the kernel housed in its internal 17# data structures and then jumps to the image which 18# results in a linux kernel boot. 19# 20# 2. - flashsys - 21# to be loaded into ram so that it can be 22# burned into the onboard flash. Then the board jumpers 23# can be switched so that the next power cycle caused 24# the system in flash to run which then proceeds as 25# described by #1 above. 26# Note: burner.srec is the utility that will allow 27# the user to get this image into flash. 28# 29# 3. - flashsys2 - 30# to be loaded into ram so that it can be 31# burned into the onboard flash. Then on each power 32# cycle when the standard PMON prompt is presented 33# the user can type `call 0xbf000000` to invoke 34# the system in flash which then proceeds as 35# described by #1 above. 36# Note: burner.srec is the utility that will allow 37# the user to get this image into flash. 38# 39# 4. - burner.srec - 40# related to #2 and #3 above. 41# 42# ============================================================= 43 44USE_STANDARD_AS_RULE := true 45 46all: ramsys.srec \ 47 flashsys.srec \ 48 flashsys2.srec \ 49 burner.srec 50 51SYSTEM = $(TOPDIR)/vmlinux 52 53CFLAGS_2 = -DCONSOLE_SERIAL -DDELIMITERLINES -DGALILEO_PORT \ 54 -DANSIESC -DELF_IMAGE -DELF_IMAGE -DDOWNLOAD_PROTO_TFTP \ 55 -DEVB64120A -D__MIPSEB__ -DINCLUDE_EEPRO100 \ 56 -DINCLUDE_GETH0 -DNOPRINTK -DPROM -DCOMPRESSEDVMLINUX 57 58sbdreset_evb64120A.o: 59 $(CC) $(CFLAGS) $(CFLAGS_2) -c sbdreset_evb64120A.S -o $*.o 60memory.o: 61 $(CC) $(CFLAGS) $(CFLAGS_2) -c memory.c -o $*.o 62pci.o: 63 $(CC) $(CFLAGS) $(CFLAGS_2) -c pci.c -o $*.o 64pci_etherboot.o: 65 $(CC) $(CFLAGS) $(CFLAGS_2) -c pci_etherboot.c -o $*.o 66load.o: 67 $(CC) $(CFLAGS) $(CFLAGS_2) -c load.c -o $*.o 68flashdrv.o: 69 $(CC) $(CFLAGS) $(CFLAGS_2) -c flashdrv.c -o $*.o 70 71gz2asm: gz2asm.c 72 g++ -o gz2asm gz2asm.c 73 74doit: doit.c 75 gcc -o doit doit.c 76 77piggy.gz: $(SYSTEM) 78 rm -f piggy piggy.gz 79 $(OBJCOPY) -S -O binary $(SYSTEM) piggy 80 gzip -f -9 < piggy > piggy.gz 81 82piggy.S: doit fixit piggy.gz 83 ./doit < piggy.gz > piggy.S; . ./fixit piggy.S 84 85OBJECTS_ramsys = head.o misc.o piggy.o ../serialGT.o 86OBJECTS_flashsys = sbdreset_evb64120A.o evb64120A_Setup.o pci_etherboot.o memory.o pci.o head.o misc.o piggy.o ../serialGT.o 87OBJECTS_flashsys2 = xfer.o head.o misc.o piggy.o ../serialGT.o 88OBJECTS_burner = burner.o load.o flashdrv.o 89 90ramsys.srec : $(OBJECTS_ramsys) ld.script.gal 91 @# Note: this image is intended to run out of ram. No flash involved. 92 $(LD) -T ld.script.gal -o ramsys $(OBJECTS_ramsys) 93 $(NM) ramsys | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System_ramsys.map 94 $(OBJCOPY) -O srec ramsys ramsys.srec 95 cp ramsys.srec $(TOPDIR)/. 96 97flashsys.srec : $(OBJECTS_flashsys) ld.sys.big.Flash 98 @# Note1: Use the burn utility to get this image into flash. 99 @# Note2: This image is intended to run out of flash as invoked 100 @# directly at powerup when EVB64120A jumpers are configured to 101 @# bypass the onboard eprom. 102 @# Assumes that 0xBFC00000 is the bootup run address (normal MIPS). 103 @# And assumes that EVB64120A jumber J11 is added to the board and jumber 104 @# J20 is moved from the 2&3 position to the 1&2 position instead. Without 105 @# the jumper settings the system will execute at address 0xBFC00000, 106 @# as normal, yet that address will map to the onboard eeprom instead 107 @# of the onboard flash. 108 @# 109 $(LD) -T ld.sys.big.Flash -o flashsys $(OBJECTS_flashsys) 110 $(NM) flashsys | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System_flashsys.map 111 @# 112 @# Next, Create the image that we want to place in the flash part. 113 $(OBJCOPY) -S -g --strip-unneeded \ 114 --adjust-section-vma=.text+0x3f820000 \ 115 --adjust-section-vma=.rodata+0x3f820000 \ 116 --adjust-section-vma=.reginfo+0x3f820000 \ 117 --adjust-section-vma=.data+0x3f820000 \ 118 --remove-section=.bss \ 119 --remove-section=.scommon \ 120 --remove-section=.note \ 121 --remove-section=.comment \ 122 flashsys flashsys.temp 123 @# 124 @# Next, change the addresses so that when we download to 125 @# to the board's ram it will land starting at address 0xA0300000 126 @# because this is where we have choosen to have the image temporarily sit 127 @# while we subsequently burn it (using some method not revealed here) into 128 @# the board's flash. After the burn the system can be setup (via jumpers) 129 @# to boot this image directory from the flash part. 130 $(OBJCOPY) -O srec --adjust-vma=0xe0700000 flashsys.temp flashsys.srec 131 cp flashsys.srec $(TOPDIR)/. 132 133flashsys2.srec : $(OBJECTS_flashsys2) ld.sys.big.Flash2 134 @# Note1: Use the burn utility to get this image into flash. 135 @# Note2: This image is intended to be run out of flash as invoked 136 @# manually from the standard PMON running in eprom. This means that 137 @# the image will be set to run from location 0xBF000000 which is the 138 @# location the flash is mapped to when the board jumpers are set to 139 @# the standard location such that the board boots out of onboard 140 @# eprom. From the PMON prompt the user can type `call 0xbf000000` 141 @# to transfer control to the image we are constructing here. 142 @# 143 $(LD) -T ld.sys.big.Flash2 -o flashsys2 $(OBJECTS_flashsys2) 144 $(NM) flashsys2 | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System_flashsys2.map 145 @# 146 @# Next, Create the image that we want to place in the flash part. 147 $(OBJCOPY) -S -g --strip-unneeded \ 148 --adjust-section-vma=.text+0x3ec20000 \ 149 --adjust-section-vma=.rodata+0x3ec20000 \ 150 --adjust-section-vma=.reginfo+0x3ec20000 \ 151 --adjust-section-vma=.data+0x3ec20000 \ 152 --remove-section=.bss \ 153 --remove-section=.scommon \ 154 --remove-section=.note \ 155 --remove-section=.comment \ 156 flashsys2 flashsys2.temp 157 @# 158 @# Next, change the addresses so that when we download to 159 @# to the board's ram it will land starting at address 0xA0300000 160 @# because this is where we have choosen to have the image temporarily sit 161 @# while we subsequently burn it (using some method not revealed here) into 162 @# the board's flash. After the burn a user will then be able to type 163 @# `call 0xbf000000` at the PMON prompt (following a power cycle) to invoke 164 @# the linux kernel. 165 $(OBJCOPY) -O srec --adjust-vma=0xe1300000 flashsys2.temp flashsys2.srec 166 cp flashsys2.srec $(TOPDIR)/. 167 168burner.srec : $(OBJECTS_burner) ld.sys.big.burner 169 @# This utility can be used to burn the flashsys.srec or flashsys2.srec 170 @# into the EVB64120A's on board flash part (1Meg minimum). 171 $(LD) -T ld.sys.big.burner -o burner $(OBJECTS_burner) 172 $(NM) burner | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System_burner.map 173 $(OBJCOPY) -O srec burner burner.srec 174 cp burner.srec $(TOPDIR)/. 175 176clean: 177 rm -f doit piggy.S piggy.gz piggy burner *.o ramsys* flashsys* System*.map *.srec 178