1 # 1 # 2 # arch/riscv/boot/Makefile !! 2 # arch/alpha/boot/Makefile 3 # << 4 # This file is included by the global makefile << 5 # architecture-specific flags and dependencies << 6 # 3 # 7 # This file is subject to the terms and condit 4 # This file is subject to the terms and conditions of the GNU General Public 8 # License. See the file "COPYING" in the main 5 # License. See the file "COPYING" in the main directory of this archive 9 # for more details. 6 # for more details. 10 # 7 # 11 # Copyright (C) 2018, Anup Patel. !! 8 # Copyright (C) 1994 by Linus Torvalds 12 # Author: Anup Patel <anup@brainfault.org> !! 9 # >> 10 # Creating a compressed kernel image (arch/alpha/boot/vmlinux.gz) >> 11 # is done via: >> 12 # >> 13 # make boot >> 14 # >> 15 # Creating a BOOTP image (arch/alpha/boot/bootpfile or bootpzfile) >> 16 # is done via: 13 # 17 # 14 # Based on the ia64 and arm64 boot/Makefile. !! 18 # make bootpfile # using an uncompressed kernel >> 19 # make bootpzfile # using a compressed kernel 15 # 20 # >> 21 # Adding an INITRD image to a BOOTP file (arch/alpha/boot/bootpzfile) >> 22 # can be done, e.g, via: >> 23 # >> 24 # INITRD=`pwd`/initrd.img make bootpzfile >> 25 >> 26 LINKFLAGS = -static -T bootloader.lds #-N -relax 16 27 17 OBJCOPYFLAGS_Image :=-O binary -R .note -R .no !! 28 .S.s: 18 OBJCOPYFLAGS_loader.bin :=-O binary !! 29 $(CPP) $(AFLAGS) -traditional -o $*.o $< 19 OBJCOPYFLAGS_xipImage :=-O binary -R .note -R !! 30 .S.o: >> 31 $(CC) $(AFLAGS) -traditional -c -o $*.o $< >> 32 >> 33 OBJECTS = head.o main.o >> 34 BPOBJECTS = head.o bootp.o >> 35 BPZOBJECTS = head.o bootpz.o misc.o >> 36 TARGETS = vmlinux.gz tools/objstrip # also needed by aboot & milo >> 37 VMLINUX = $(TOPDIR)/vmlinux >> 38 OBJSTRIP = tools/objstrip >> 39 >> 40 all: $(TARGETS) >> 41 @echo Ready to install kernel in $(shell pwd)/vmlinux.gz >> 42 >> 43 # normally no need to build these: >> 44 rawboot: vmlinux.nh tools/lxboot tools/bootlx >> 45 >> 46 msb: tools/lxboot tools/bootlx vmlinux.nh >> 47 ( cat tools/lxboot tools/bootlx vmlinux.nh ) > /dev/rz0a >> 48 disklabel -rw rz0 'linux' tools/lxboot tools/bootlx >> 49 >> 50 bootimage: tools/mkbb tools/lxboot tools/bootlx vmlinux.nh >> 51 ( cat tools/lxboot tools/bootlx vmlinux.nh ) > bootimage >> 52 tools/mkbb bootimage tools/lxboot >> 53 >> 54 bootpfile: tools/bootph vmlinux.nh >> 55 cat tools/bootph vmlinux.nh > bootpfile >> 56 ifdef INITRD >> 57 cat $(INITRD) >> bootpfile >> 58 endif 20 59 21 targets := Image Image.* loader loader.o loade !! 60 bootpzfile: tools/bootpzh vmlinux.nh.gz >> 61 cat tools/bootpzh vmlinux.nh.gz > bootpzfile >> 62 ifdef INITRD >> 63 cat $(INITRD) >> bootpzfile >> 64 endif 22 65 23 ifeq ($(CONFIG_XIP_KERNEL),y) !! 66 srmboot: bootdevice bootimage >> 67 dd if=bootimage of=$(BOOTDEV) bs=512 seek=1 skip=1 >> 68 tools/mkbb $(BOOTDEV) tools/lxboot 24 69 25 quiet_cmd_mkxip = $(quiet_cmd_objcopy) !! 70 bootdevice: 26 cmd_mkxip = $(cmd_objcopy) !! 71 @test "$(BOOTDEV)" != "" || (echo You must specify BOOTDEV ; exit -1) 27 72 28 $(obj)/xipImage: vmlinux FORCE !! 73 vmlinux.gz: $(TOPDIR)/vmlinux 29 $(call if_changed,mkxip) !! 74 gzip -fv9c $(TOPDIR)/vmlinux > vmlinux.gz 30 @$(kecho) ' Physical Address of xipIm << 31 75 >> 76 vmlinux.nh.gz: vmlinux.nh >> 77 gzip -fv9c vmlinux.nh > vmlinux.nh.gz >> 78 >> 79 main.o: ksize.h >> 80 >> 81 bootp.o: ksize.h >> 82 >> 83 bootpz.o: kzsize.h >> 84 >> 85 ksize.h: vmlinux.nh dummy >> 86 echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T >> 87 ifdef INITRD >> 88 [ ! \( -f $(INITRD) \) ] || exit 1 >> 89 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T 32 endif 90 endif >> 91 cmp -s $@T $@ || mv -f $@T $@ >> 92 rm -f $@T 33 93 34 ifdef CONFIG_RELOCATABLE !! 94 kzsize.h: vmlinux.nh.gz dummy 35 vmlinux.relocs: vmlinux !! 95 echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T 36 @ (! [ -f vmlinux.relocs ] && echo "vm !! 96 echo "#define KERNEL_Z_SIZE `ls -l vmlinux.nh.gz | awk '{print $$5}'`" >> $@T 37 !! 97 ifdef INITRD 38 $(obj)/Image: vmlinux.relocs FORCE !! 98 [ -f $(INITRD) ] || exit 1 39 else !! 99 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T 40 $(obj)/Image: vmlinux FORCE << 41 endif 100 endif 42 $(call if_changed,objcopy) !! 101 cmp -s $@T $@ || mv -f $@T $@ >> 102 rm -f $@T >> 103 >> 104 vmlinux.nh: $(VMLINUX) $(OBJSTRIP) >> 105 $(OBJSTRIP) -v $(VMLINUX) vmlinux.nh >> 106 >> 107 vmlinux: $(VMLINUX) >> 108 $(STRIP) -o vmlinux $(VMLINUX) >> 109 >> 110 tools/lxboot: $(OBJSTRIP) bootloader >> 111 $(OBJSTRIP) -p bootloader tools/lxboot 43 112 44 $(obj)/Image.gz: $(obj)/Image FORCE !! 113 tools/bootlx: bootloader $(OBJSTRIP) 45 $(call if_changed,gzip) !! 114 $(OBJSTRIP) -vb bootloader tools/bootlx 46 115 47 $(obj)/loader.o: $(src)/loader.S $(obj)/Image !! 116 tools/bootph: bootpheader $(OBJSTRIP) >> 117 $(OBJSTRIP) -vb bootpheader tools/bootph 48 118 49 $(obj)/loader: $(obj)/loader.o $(obj)/Image $( !! 119 tools/bootpzh: bootpzheader $(OBJSTRIP) 50 $(Q)$(LD) -T $(obj)/loader.lds -o $@ $ !! 120 $(OBJSTRIP) -vb bootpzheader tools/bootpzh 51 121 52 $(obj)/Image.bz2: $(obj)/Image FORCE !! 122 $(OBJSTRIP): $(OBJSTRIP).c 53 $(call if_changed,bzip2) !! 123 $(HOSTCC) $(HOSTCFLAGS) -I$(HPATH) $(OBJSTRIP).c -o $(OBJSTRIP) 54 124 55 $(obj)/Image.lz4: $(obj)/Image FORCE !! 125 tools/mkbb: tools/mkbb.c 56 $(call if_changed,lz4) !! 126 $(HOSTCC) tools/mkbb.c -o tools/mkbb 57 127 58 $(obj)/Image.lzma: $(obj)/Image FORCE !! 128 bootloader: $(OBJECTS) 59 $(call if_changed,lzma) !! 129 $(LD) $(LINKFLAGS) $(OBJECTS) $(LIBS) -o bootloader 60 130 61 $(obj)/Image.lzo: $(obj)/Image FORCE !! 131 bootpheader: $(BPOBJECTS) 62 $(call if_changed,lzo) !! 132 $(LD) $(LINKFLAGS) $(BPOBJECTS) $(LIBS) -o bootpheader 63 133 64 $(obj)/Image.zst: $(obj)/Image FORCE !! 134 bootpzheader: $(BPZOBJECTS) 65 $(call if_changed,zstd) !! 135 $(LD) $(LINKFLAGS) $(BPZOBJECTS) $(LIBS) -o bootpzheader 66 136 67 $(obj)/Image.xz: $(obj)/Image FORCE !! 137 misc.o: misc.c $(TOPDIR)/lib/inflate.c 68 $(call if_changed,xzkern) << 69 138 70 $(obj)/loader.bin: $(obj)/loader FORCE !! 139 clean: 71 $(call if_changed,objcopy) !! 140 rm -f $(TARGETS) bootloader bootimage bootpfile bootpheader >> 141 rm -f tools/mkbb tools/bootlx tools/lxboot tools/bootph >> 142 rm -f vmlinux.nh ksize.h 72 143 73 EFI_ZBOOT_PAYLOAD := Image !! 144 dep: 74 EFI_ZBOOT_BFD_TARGET := elf$(BITS)-littleri << 75 EFI_ZBOOT_MACH_TYPE := RISCV$(BITS) << 76 145 77 include $(srctree)/drivers/firmware/efi/libstu !! 146 dummy:
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.