From 96f935934591b72f5b05fd6923bc8cdcae92f2e5 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 31 Oct 2010 10:56:23 +0100 Subject: initramfs: Fix initramfs size for 32-bit arches Commit ffe8018c3424 ("initramfs: fix initramfs size calculation") broke 32-bit big-endian arches like (on ARAnyM): VFS: Cannot open root device "hda1" or unknown-block(3,1) Please append a correct "root=" boot option; here are the available partitions: fe80 1059408 nfhd8 (driver?) fe81 921600 nfhd8p1 00000000-0000-0000-0000-000000000nfhd8p1 fe82 137807 nfhd8p2 00000000-0000-0000-0000-000000000nfhd8p2 0200 3280 fd0 (driver?) 0201 3280 fd1 (driver?) 0300 1059408 hda driver: ide-gd 0301 921600 hda1 00000000-0000-0000-0000-000000000hda1 0302 137807 hda2 00000000-0000-0000-0000-000000000hda2 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(3,1) As pointed out by Kerstin Jonsson , this is due to CONFIG_32BIT not being defined, so the initramfs size field is done as a 64-bit quad. On little-endian (like x86) this doesn matter, but on a big-endian machine the 32-bit reads will see the (zero) high bits. Only mips, s390, and score set CONFIG_32BIT for 32-bit builds, so fix it for all other 32-bit arches by inverting the logic and testing for CONFIG_64BIT, which should be defined on all 64-bit arches. Signed-off-by: Geert Uytterhoeven [ I think we should just make it "u64" on all architectures and get rid of the whole #ifdef CONFIG_xxBIT - Linus ] Signed-off-by: Linus Torvalds --- usr/initramfs_data.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr/initramfs_data.S') diff --git a/usr/initramfs_data.S b/usr/initramfs_data.S index b9efed5e35cc..792a750d9441 100644 --- a/usr/initramfs_data.S +++ b/usr/initramfs_data.S @@ -30,8 +30,8 @@ __irf_end: .section .init.ramfs.info,"a" .globl __initramfs_size __initramfs_size: -#ifdef CONFIG_32BIT - .long __irf_end - __irf_start -#else +#ifdef CONFIG_64BIT .quad __irf_end - __irf_start +#else + .long __irf_end - __irf_start #endif -- cgit v1.2.3 From 1198c6d45a1ef5f4f7fdfbf33ef7d270493ec575 Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Mon, 29 Nov 2010 14:38:50 -0800 Subject: initramfs: Really fix build break on symbol-prefixed archs Define the __initramfs_size variable using VMLINUX_SYMBOL() to take care of symbol-prefixed architectures, for example, blackfin. Signed-off-by: Hendrik Brueckner Cc: Mike Frysinger Cc: Hendrik Brueckner , Cc: Michal Marek Cc: Sam Ravnborg Signed-off-by: Andrew Morton [mmarek: leave out Makefile change, since d63f6d1 already takes care of the SYMBOL_PREFIX define] Signed-off-by: Michal Marek --- usr/initramfs_data.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'usr/initramfs_data.S') diff --git a/usr/initramfs_data.S b/usr/initramfs_data.S index 792a750d9441..c14322d1c0cf 100644 --- a/usr/initramfs_data.S +++ b/usr/initramfs_data.S @@ -22,14 +22,15 @@ */ #include +#include .section .init.ramfs,"a" __irf_start: .incbin __stringify(INITRAMFS_IMAGE) __irf_end: .section .init.ramfs.info,"a" -.globl __initramfs_size -__initramfs_size: +.globl VMLINUX_SYMBOL(__initramfs_size) +VMLINUX_SYMBOL(__initramfs_size): #ifdef CONFIG_64BIT .quad __irf_end - __irf_start #else -- cgit v1.2.3