Skip to content

Commit 684151a

Browse files
daniel-hellstromdavem330
authored andcommitted
sparc32: added U-Boot build target: uImage
This is only for LEON as u-boot for SPARC only supports LEON. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 44ed3c0 commit 684151a

3 files changed

Lines changed: 66 additions & 1 deletion

File tree

‎arch/sparc/Kconfig‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,39 @@ config SPARC_LEON
461461
from www.gaisler.com. You can download a sparc-linux cross-compilation
462462
toolchain at www.gaisler.com.
463463

464+
if SPARC_LEON
465+
menu "U-Boot options"
466+
467+
config UBOOT_LOAD_ADDR
468+
hex "uImage Load Address"
469+
default 0x40004000
470+
---help---
471+
U-Boot kernel load address, the address in physical address space
472+
where u-boot will place the Linux kernel before booting it.
473+
This address is normally the base address of main memory + 0x4000.
474+
475+
config UBOOT_FLASH_ADDR
476+
hex "uImage.o Load Address"
477+
default 0x00080000
478+
---help---
479+
Optional setting only affecting the uImage.o ELF-image used to
480+
download the uImage file to the target using a ELF-loader other than
481+
U-Boot. It may for example be used to download an uImage to FLASH with
482+
the GRMON utility before even starting u-boot.
483+
484+
config UBOOT_ENTRY_ADDR
485+
hex "uImage Entry Address"
486+
default 0xf0004000
487+
---help---
488+
Do not change this unless you know what you're doing. This is
489+
hardcoded by the SPARC32 and LEON port.
490+
491+
This is the virtual address u-boot jumps to when booting the Linux
492+
Kernel.
493+
494+
endmenu
495+
endif
496+
464497
endmenu
465498

466499
menu "Bus options (PCI etc.)"

‎arch/sparc/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ boot := arch/sparc/boot
8888
# Default target
8989
all: zImage
9090

91-
image zImage tftpboot.img vmlinux.aout: vmlinux
91+
image zImage uImage tftpboot.img vmlinux.aout: vmlinux
9292
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
9393

9494
archclean:
@@ -102,6 +102,7 @@ ifeq ($(ARCH),sparc)
102102
define archhelp
103103
echo '* image - kernel image ($(boot)/image)'
104104
echo '* zImage - stripped kernel image ($(boot)/zImage)'
105+
echo ' uImage - U-Boot SPARC32 Image (only for LEON)'
105106
echo ' tftpboot.img - image prepared for tftp'
106107
endef
107108
else

‎arch/sparc/boot/Makefile‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
ROOT_IMG := /usr/src/root.img
77
ELFTOAOUT := elftoaout
8+
MKIMAGE := $(srctree)/scripts/mkuboot.sh
89

910
hostprogs-y := piggyback btfixupprep
1011
targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout
@@ -77,6 +78,36 @@ $(obj)/zImage: $(obj)/image
7778
$(obj)/vmlinux.aout: vmlinux FORCE
7879
$(call if_changed,elftoaout)
7980
@echo ' kernel: $@ is ready'
81+
else
82+
83+
# The following lines make a readable image for U-Boot.
84+
# uImage - Binary file read by U-boot
85+
# uImage.o - object file of uImage for loading with a
86+
# flash programmer understanding ELF.
87+
88+
OBJCOPYFLAGS_image.bin := -S -O binary -R .note -R .comment
89+
$(obj)/image.bin: $(obj)/image FORCE
90+
$(call if_changed,objcopy)
91+
92+
$(obj)/image.gz: $(obj)/image.bin
93+
$(call if_changed,gzip)
94+
95+
quiet_cmd_uimage = UIMAGE $@
96+
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sparc -O linux -T kernel \
97+
-C gzip -a $(CONFIG_UBOOT_LOAD_ADDR) \
98+
-e $(CONFIG_UBOOT_ENTRY_ADDR) -n 'Linux-$(KERNELRELEASE)' \
99+
-d $< $@
100+
101+
quiet_cmd_uimage.o = UIMAGE.O $@
102+
cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \
103+
-r -b binary $@ -o $@.o
104+
105+
targets += uImage
106+
$(obj)/uImage: $(obj)/image.gz
107+
$(call if_changed,uimage)
108+
$(call if_changed,uimage.o)
109+
@echo ' Image $@ is ready'
110+
80111
endif
81112

82113
$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE

0 commit comments

Comments
 (0)