android_kernel_xiaomi_sm8350/include/asm-generic
Hendrik Brueckner ffe8018c34 initramfs: fix initramfs size calculation
The size of a built-in initramfs is calculated in init/initramfs.c by
"__initramfs_end - __initramfs_start".  Those symbols are defined in the
linker script include/asm-generic/vmlinux.lds.h:

#define INIT_RAM_FS                                                     \
        . = ALIGN(PAGE_SIZE);                                           \
        VMLINUX_SYMBOL(__initramfs_start) = .;                          \
        *(.init.ramfs)                                                  \
        VMLINUX_SYMBOL(__initramfs_end) = .;

If the initramfs file has an odd number of bytes, the "__initramfs_end"
symbol points to an odd address, for example, the symbols in the
System.map might look like:

    0000000000572000 T __initramfs_start
    00000000005bcd05 T __initramfs_end	  <-- odd address

At least on s390 this causes a problem:

Certain s390 instructions, especially instructions for loading addresses
(larl) or branch addresses must be on even addresses.  The compiler loads
the symbol addresses with the "larl" instruction.  This instruction sets
the last bit to 0 and, therefore, for odd size files, the calculated size
is one byte less than it should be:

    0000000000540a9c <populate_rootfs>:
      540a9c:     eb cf f0 78 00 24       stmg    %r12,%r15,120(%r15),
      540aa2:     c0 10 00 01 8a af       larl    %r1,572000 <__initramfs_start>
      540aa8:     c0 c0 00 03 e1 2e       larl    %r12,5bcd04 <initramfs_end>
                                                  (Instead of  5bcd05)
      ...
      540abe:     1b c1                   sr      %r12,%r1

To fix the problem, this patch introduces the global variable
__initramfs_size, which is calculated in the "usr/initramfs_data.S" file.
The populate_rootfs() function can then use the start marker of the
.init.ramfs section and the value of __initramfs_size for loading the
initramfs.  Because the start marker and size is sufficient, the
__initramfs_end symbol is no longer needed and is removed.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: Michal Marek <mmarek@suse.cz>
Acked-by: "H. Peter Anvin" <hpa@zytor.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-09-29 16:28:59 +02:00
..
bitops arch, hweight: Fix compilation errors 2010-05-04 10:25:27 -07:00
4level-fixup.h
atomic64.h
atomic-long.h
atomic.h asm-generic: don't warn that atomic_t is only 24 bit 2010-05-25 08:07:03 -07:00
audit_change_attr.h
audit_dir_write.h
audit_read.h
audit_signal.h
audit_write.h
auxvec.h
bitops.h
bitsperlong.h
bug.h panic: Allow warnings to set different taint flags 2010-05-19 08:36:48 +01:00
bugs.h
cache.h
cacheflush.h
checksum.h
cmpxchg-local.h
cmpxchg.h
cputime.h
current.h
delay.h
device.h
div64.h
dma-coherent.h
dma-mapping-broken.h
dma-mapping-common.h dma-mapping: remove unnecessary sync_single_range_* in dma_map_ops 2010-05-27 09:12:52 -07:00
dma.h
emergency-restart.h
errno-base.h
errno.h
fb.h
fcntl.h fix up O_SYNC comments 2009-12-17 11:03:24 -05:00
futex.h
getorder.h
gpio.h gpiolib: introduce set_debounce method 2010-05-27 09:12:42 -07:00
hardirq.h
hw_irq.h
ide_iops.h
int-l64.h
int-ll64.h
io.h
ioctl.h
ioctls.h
iomap.h
ipcbuf.h
irq_regs.h
irq.h
irqflags.h
Kbuild
Kbuild.asm
kdebug.h
kmap_types.h include/asm-generic/kmap_types.h: add helpful reminder 2010-05-25 08:07:03 -07:00
libata-portmap.h
linkage.h
local.h local_t: Remove cpu_local_xx macros 2010-01-05 15:34:49 +09:00
memory_model.h tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
mm_hooks.h
mman-common.h HWPOISON: Add a madvise() injector for soft page offlining 2009-12-16 12:20:00 +01:00
mman.h
mmu_context.h
mmu.h
module.h
msgbuf.h
mutex-dec.h
mutex-null.h
mutex-xchg.h
mutex.h
page.h
param.h
parport.h
pci-dma-compat.h dma-mapping: pci: move pci_set_dma_mask and pci_set_consistent_dma_mask to pci-dma-compat.h 2010-03-12 15:52:42 -08:00
pci.h
percpu.h Merge branch 'for-35' of git://repo.or.cz/linux-kbuild 2010-06-01 08:55:52 -07:00
pgalloc.h
pgtable-nopmd.h
pgtable-nopud.h
pgtable.h
poll.h
posix_types.h
resource.h
rtc.h
scatterlist.h asm-generic: remove ARCH_HAS_SG_CHAIN in scatterlist.h 2010-05-27 09:12:54 -07:00
sections.h
segment.h
sembuf.h
serial.h
setup.h
shmbuf.h
shmparam.h
siginfo.h
signal-defs.h
signal.h
socket.h
sockios.h
spinlock.h
stat.h
statfs.h
string.h
swab.h
syscall.h
syscalls.h
system.h
termbits.h
termios-base.h
termios.h
timex.h
tlb.h
tlbflush.h
topology.h numa: introduce numa_mem_id()- effective local memory node id 2010-05-27 09:12:57 -07:00
types.h
uaccess-unaligned.h
uaccess.h
ucontext.h
unaligned.h
unistd.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic 2009-12-11 20:57:31 -08:00
user.h
vga.h
vmlinux.lds.h initramfs: fix initramfs size calculation 2010-09-29 16:28:59 +02:00
xor.h