Commit dbb2ae18 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86-64 Bootloader updates

Update the early 32bit bootloader for x86-64.  This stuff is near
completely identical to i386, except for a few Makefile changes to tell
the x86-64 toolkit to compile in 32bit mode.
parent 5e1c701f
...@@ -21,83 +21,75 @@ ROOT_DEV := CURRENT ...@@ -21,83 +21,75 @@ ROOT_DEV := CURRENT
SVGA_MODE := -DSVGA_MODE=NORMAL_VGA SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
# --------------------------------------------------------------------------- # If you want the RAM disk device, define this to be the size in blocks.
BOOT_INCL = $(TOPDIR)/include/linux/config.h \ #RAMDISK := -DRAMDISK=512
$(TOPDIR)/include/linux/autoconf.h \
$(TOPDIR)/include/asm/boot.h
zImage: bootsect setup compressed/vmlinux tools/build EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/vmlinux compressed/vmlinux.out setup setup.o zImage bzImage
tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage
bzImage: bbootsect bsetup compressed/bvmlinux tools/build CFLAGS += -m32
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/bvmlinux compressed/bvmlinux.out
tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage
bzImage-padded: bzImage host-progs := tools/build
dd if=/dev/zero bs=1k count=70 >> bzImage
compressed/vmlinux: $(TOPDIR)/vmlinux # Default
@$(MAKE) -C compressed vmlinux
compressed/bvmlinux: $(TOPDIR)/vmlinux boot: bzImage
@$(MAKE) -C compressed bvmlinux
zdisk: $(BOOTIMAGE) include $(TOPDIR)/Rules.make
dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0
zlilo: $(BOOTIMAGE) # ---------------------------------------------------------------------------
if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
cp $(TOPDIR)/System.map $(INSTALL_PATH)/
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
install: $(BOOTIMAGE)
sh -x ./install.sh $(KERNELRELEASE) $(BOOTIMAGE) $(TOPDIR)/System.map "$(INSTALL_PATH)"
tools/build: tools/build.c $(obj)/zImage: IMAGE_OFFSET := 0x1000
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< $(obj)/zImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK)
$(obj)/bzImage: IMAGE_OFFSET := 0x100000
$(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
$(obj)/bzImage: BUILDFLAGS := -b
bootsect: bootsect.o quiet_cmd_image = BUILD $(echo_target)
$(IA32_LD) -Ttext 0x0 -s --oformat binary -o $@ $< cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
$(obj)/vmlinux.bin $(ROOT_DEV) > $@
bootsect.o: bootsect.s $(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
$(IA32_AS) -o $@ $< $(obj)/vmlinux.bin $(obj)/tools/build FORCE
$(call if_changed,image)
bootsect.s: bootsect.S Makefile $(BOOT_INCL) $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
$(IA32_CPP) $(CPPFLAGS) -traditional -D__ASSEMBLY__ $(SVGA_MODE) $(RAMDISK) $< -o $@ $(call if_changed,objcopy)
bbootsect: bbootsect.o LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
$(IA32_LD) -Ttext 0x0 -s --oformat binary $< -o $@ LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
bbootsect.o: bbootsect.s $(obj)/setup $(obj)/bootsect: %: %.o FORCE
$(IA32_AS) -o $@ $< $(call if_changed,ld)
bbootsect.s: bootsect.S Makefile $(BOOT_INCL) $(obj)/compressed/vmlinux: FORCE
$(IA32_CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ +@$(call descend,$(obj)/compressed,IMAGE_OFFSET=$(IMAGE_OFFSET) \
$(obj)/compressed/vmlinux)
setup: setup.o
$(IA32_LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
setup.o: setup.s zdisk: $(BOOTIMAGE)
$(IA32_AS) -o $@ $< dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0
setup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h zlilo: $(BOOTIMAGE)
$(IA32_CPP) $(CPPFLAGS) -traditional -D__ASSEMBLY__ $(SVGA_MODE) $(RAMDISK) $< -o $@ if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
cp System.map $(INSTALL_PATH)/
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
bsetup: bsetup.o install: $(BOOTIMAGE)
$(IA32_LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $< sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
bsetup.o: bsetup.s clean:
$(IA32_AS) -o $@ $< @echo 'Cleaning up (boot)'
@rm -f $(host-progs) $(EXTRA_TARGETS)
+@$(call descend,$(obj)/compressed) clean
bsetup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h archhelp:
$(IA32_CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ @echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
@echo ' install - Install kernel using'
@echo ' (your) ~/bin/installkernel or'
@echo ' (distribution) /sbin/installkernel or'
@echo ' install to $$(INSTALL_PATH) and run lilo'
clean:
rm -f tools/build
rm -f setup bootsect zImage compressed/vmlinux.out
rm -f bsetup bbootsect bzImage compressed/bvmlinux.out
@$(MAKE) -C compressed clean
# #
# linux/arch/i386/boot/compressed/Makefile # linux/arch/x86_64/boot/compressed/Makefile
# #
# create a compressed vmlinux image from the original vmlinux # create a compressed vmlinux image from the original vmlinux
# #
# Note all the files here are compiled/linked as 32bit executables.
#
HEAD = head.o EXTRA_TARGETS := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
SYSTEM = $(TOPDIR)/vmlinux EXTRA_AFLAGS := -traditional -m32
OBJECTS = $(HEAD) misc.o
IA32_CFLAGS := -O2 -DSTDC_HEADERS # cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with
# -m32
CFLAGS := -m32 -D__KERNEL__ -I$(TOPDIR)/include -O2
LDFLAGS := -m elf_i386
# include $(TOPDIR)/Rules.make
# ZIMAGE_OFFSET is the load offset of the compression loader
# BZIMAGE_OFFSET is the load offset of the high loaded compression loader
#
BZIMAGE_OFFSET = 0x100000
BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS) LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 -m elf_i386
all: vmlinux $(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
$(call if_changed,ld)
bvmlinux: piggy.o $(OBJECTS) $(obj)/vmlinux.bin: vmlinux FORCE
$(IA32_LD) $(BZLINKFLAGS) -o bvmlinux $(OBJECTS) piggy.o strip vmlinux
$(call if_changed,objcopy)
head.o: head.S $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
$(IA32_AS) -c head.S $(call if_changed,gzip)
misc.o: misc.c LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
$(IA32_CC) $(IA32_CFLAGS) -c misc.c
piggy.o: $(SYSTEM) $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
tmppiggy=_tmp_$$$$piggy; \ $(call if_changed,ld)
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) $(OBJCOPYFLAGS) $< $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(IA32_LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
clean: clean:
rm -f vmlinux bvmlinux _tmp_* @echo 'Cleaning up (boot/compressed)'
@rm -f $(EXTRA_TARGETS)
...@@ -89,12 +89,8 @@ static long bytes_out = 0; ...@@ -89,12 +89,8 @@ static long bytes_out = 0;
static uch *output_data; static uch *output_data;
static unsigned long output_ptr = 0; static unsigned long output_ptr = 0;
static void *malloc(int size); static void *malloc(int size);
static void free(void *where); static void free(void *where);
static void error(char *m);
static void gzip_mark(void **);
static void gzip_release(void **);
static void puts(const char *); static void puts(const char *);
......
#define NULL 0 #define NULL 0
typedef unsigned int size_t; //typedef unsigned int size_t;
struct screen_info { struct screen_info {
......
SECTIONS
{
.data : {
input_len = .;
LONG(input_data_end - input_data) input_data = .;
*(.data)
input_data_end = .;
}
}
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
#define PARAM_VESAPM_SEG 0x2e #define PARAM_VESAPM_SEG 0x2e
#define PARAM_VESAPM_OFF 0x30 #define PARAM_VESAPM_OFF 0x30
#define PARAM_LFB_PAGES 0x32 #define PARAM_LFB_PAGES 0x32
#define PARAM_VESA_ATTRIB 0x34
/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
...@@ -220,6 +221,8 @@ mopar_gr: ...@@ -220,6 +221,8 @@ mopar_gr:
movl %eax, %fs:(PARAM_LFB_COLORS) movl %eax, %fs:(PARAM_LFB_COLORS)
movl 35(%di), %eax movl 35(%di), %eax
movl %eax, %fs:(PARAM_LFB_COLORS+4) movl %eax, %fs:(PARAM_LFB_COLORS+4)
movw 0(%di), %ax
movw %ax, %fs:(PARAM_VESA_ATTRIB)
# get video mem size # get video mem size
leaw modelist+1024, %di leaw modelist+1024, %di
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment