parisc: Add support for self-extracting kernel
Helge Deller
maintainerRFC PATCH 1/1 parisc: Add support for self-extracting kernel
Signed-off-by Helge Deller <[email protected]>
arch/parisc/Kconfig +6 -0
@@ -17,6 +17,12 @@ config PARISC select BUG select BUILDTIME_EXTABLE_SORT select HAVE_PERF_EVENTS + select HAVE_KERNEL_BZIP2 + select HAVE_KERNEL_GZIP + select HAVE_KERNEL_LZ4 + select HAVE_KERNEL_LZMA + select HAVE_KERNEL_LZO + select HAVE_KERNEL_XZ select GENERIC_ATOMIC64 if !64BIT select GENERIC_IRQ_PROBE select GENERIC_PCI_IOMAP
arch/parisc/Makefile +13 -3
@@ -24,15 +24,20 @@ KBUILD_DEFCONFIG := default_defconfig NM = sh $(srctree)/arch/parisc/nm CHECKFLAGS += -D__hppa__=1 LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) +export LIBGCC ifdef CONFIG_64BIT UTS_MACHINE := parisc64 CHECKFLAGS += -D__LP64__=1 -m64 CC_ARCHES = hppa64 +LD_BFD := elf64-hppa-linux else # 32-bit CC_ARCHES = hppa hppa2.0 hppa1.1 +LD_BFD := elf32-hppa-linux endif +export LD_BFD + ifneq ($(SUBARCH),$(UTS_MACHINE)) ifeq ($(CROSS_COMPILE),) CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
@@ -88,6 +93,8 @@ libs-y += arch/parisc/lib/ $(LIBGCC) drivers-$(CONFIG_OPROFILE) += arch/parisc/oprofile/ +boot := arch/parisc/boot + PALO := $(shell if (which palo 2>&1); then : ; \ elif [ -x /sbin/palo ]; then echo /sbin/palo; \ fi)
@@ -116,11 +123,14 @@ INSTALL_TARGETS = zinstall install PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) -bzImage zImage: vmlinuz +zImage: vmlinuz Image: vmlinux -vmlinuz: vmlinux - @gzip -cf -9 $< > $@ +bzImage: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ + +vmlinuz: bzImage + $(OBJCOPY) $(boot)/bzImage $@ install: $(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
arch/parisc/boot/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +image +bzImage
arch/parisc/boot/Makefile new file +26 -0
@@ -0,0 +1,26 @@ +# +# Makefile for the linux parisc-specific parts of the boot image creator. +# + +COMPILE_VERSION := __linux_compile_version_id__`hostname | \ + tr -c '[0-9A-Za-z]' '_'`__`date | \ + tr -c '[0-9A-Za-z]' '_'`_t + +ccflags-y := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I. + +targets := image +targets += bzImage +subdir- := compressed + +$(obj)/image: vmlinux FORCE + $(call if_changed,objcopy) + +$(obj)/bzImage: $(obj)/compressed/vmlinux FORCE + $(call if_changed,objcopy) + +$(obj)/compressed/vmlinux: FORCE + $(Q)$(MAKE) $(build)=$(obj)/compressed $@ + +install: $(CONFIGURE) $(obj)/bzImage + sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \ + System.map "$(INSTALL_PATH)"
arch/parisc/boot/compressed/.gitignore new file +3 -0
@@ -0,0 +1,3 @@ +sizes.h +vmlinux +vmlinux.lds
arch/parisc/boot/compressed/Makefile new file +87 -0
87 lines not on this page · raw message
arch/parisc/boot/compressed/head.S new file +85 -0
85 lines not on this page · raw message
arch/parisc/boot/compressed/misc.c new file +301 -0
301 lines not on this page · raw message
arch/parisc/boot/compressed/vmlinux.lds.S new file +101 -0
101 lines not on this page · raw message
arch/parisc/boot/compressed/vmlinux.scr new file +10 -0
@@ -0,0 +1,10 @@ +SECTIONS +{ + .rodata.compressed : { + input_len = .; + LONG(input_data_end - input_data) input_data = .; + *(.data) + output_len = . - 4; /* can be at unaligned address */ + input_data_end = .; + } +}
arch/parisc/boot/install.sh new file +65 -0
65 lines not on this page · raw message
arch/parisc/include/asm/page.h +4 -0
@@ -116,11 +116,15 @@ extern int npmem_ranges;/* This governs the relationship between virtual and physical addresses. * If you alter it, make sure to take care of our various fixed mapping * segments in fixmap.h */ +#if defined(BOOTLOADER ) +#define __PAGE_OFFSET (0)/* bootloader uses physical addresses */ +#else #ifdef CONFIG_64BIT #define __PAGE_OFFSET (0x40000000)/* 1GB */ #else #define __PAGE_OFFSET (0x10000000)/* 256MB */ #endif +#endif /* BOOTLOADER */ #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
arch/parisc/include/asm/pdc.h +2 -0
@@ -5,6 +5,8 @@#if !defined(__ASSEMBLY__) +extern int parisc_narrow_firmware; +extern int pdc_type;extern unsigned long parisc_cell_num;/* cell number the CPU runs on (PAT) */ extern unsigned long parisc_cell_loc;/* cell location of CPU (PAT) */
arch/parisc/kernel/firmware.c +14 -1
@@ -69,7 +69,15 @@#include <asm/pdcpat.h> #include <asm/processor.h> /* for boot_cpu_data */ +#if defined(BOOTLOADER ) +# undef spin_lock_irqsave +# define spin_lock_irqsave (a,b) b = 1 +# undef spin_unlock_irqrestore +# define spin_unlock_irqrestore (a,b) +#else static DEFINE_SPINLOCK (pdc_lock); +#endif +extern unsigned long pdc_result[NUM_PDC_RESULT ];extern unsigned long pdc_result2[NUM_PDC_RESULT ];
@@ -186,6 +194,8 @@ void set_firmware_width(void) }#endif /*CONFIG_64BIT*/ + +#if !defined(BOOTLOADER )/** * pdc_emergency_unlock - Unlock the linux pdc lock *
@@ -1143,6 +1153,8 @@ void pdc_io_reset_devices(void) spin_unlock_irqrestore(&pdc_lock, flags); } +#endif /* defined(BOOTLOADER) */ +/* locked by pdc_console_lock */ static int __attribute__((aligned (8 ))) iodc_retbuf[32 ];static char __attribute__((aligned (64 ))) iodc_dbuf[4096 ];
@@ -1187,6 +1199,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)return i; } +#if !defined(BOOTLOADER )/** * pdc_iodc_getc - Read a character (non-blocking) from the PDC console. *
@@ -1524,6 +1537,7 @@ int pdc_pat_mem_get_dimm_phys_location(return retval; }#endif /* CONFIG_64BIT */ +#endif /* defined(BOOTLOADER) */ /***************** 32-bit real-mode calls ***********/
@@ -1633,4 +1647,3 @@ long real64_call(unsigned long fn, ...) }#endif /* CONFIG_64BIT */ -
arch/parisc/kernel/real2.S +4 -0
@@ -162,6 +162,7 @@ ENDPROC_CFI(restore_control_regs) .text .align 128 ENTRY_CFI(rfi_virt2real) +#if !defined(BOOTLOADER) /* switch to real mode... */ rsm PSW_SM_I,%r0 load32 PA(rfi_v2r_1), %r1
@@ -191,6 +192,7 @@ ENTRY_CFI(rfi_virt2real) nop rfi_v2r_1: tophys_r1 %r2 +#endif /* defined(BOOTLOADER) */ bv 0(%r2) nop ENDPROC_CFI(rfi_virt2real)
@@ -198,6 +200,7 @@ ENDPROC_CFI(rfi_virt2real) .text .align 128 ENTRY_CFI(rfi_real2virt) +#if !defined(BOOTLOADER) rsm PSW_SM_I,%r0 load32 (rfi_r2v_1), %r1 nop
@@ -226,6 +229,7 @@ ENTRY_CFI(rfi_real2virt) nop rfi_r2v_1: tovirt_r1 %r2 +#endif /* defined(BOOTLOADER) */ bv 0(%r2) nop ENDPROC_CFI(rfi_real2virt)
Helge Deller
maintainerThe patch below is missing on top of the old patch I sent. It's needed to avoid usage of fp registers.
This patch unbreaks booting the lzma variants (XZ, LZO, LZMA,...)
Signed-off-by Helge Deller <[email protected]>
Helge
arch/parisc/boot/compressed/Makefile +1 -2
@@ -15,8 +15,7 @@ targets += misc.o piggy.o sizes.h head.o real2.o firmware.o KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -KBUILD_CFLAGS += $(call cc-option,-mpacked-stack) -KBUILD_CFLAGS += -fno-PIE -mno-space-regs +KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs ifndef CONFIG_64BIT KBUILD_CFLAGS += -mfast-indirect-calls endif