<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/init/initramfs.c, branch v3.2.13-rt22</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6</title>
<updated>2010-10-28T22:13:55+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-10-28T22:13:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c9e2a72ff1acfdffdecb338b3d997f90c507e665'/>
<id>c9e2a72ff1acfdffdecb338b3d997f90c507e665</id>
<content type='text'>
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
  initramfs: Fix build break on symbol-prefixed archs
  initramfs: fix initramfs size calculation
  initramfs: generalize initramfs_data.xxx.S variants
  scripts/kallsyms: Enable error messages while hush up unnecessary warnings
  scripts/setlocalversion: update comment
  kbuild: Use a single clean rule for kernel and external modules
  kbuild: Do not run make clean in $(srctree)
  scripts/mod/modpost.c: fix commentary accordingly to last changes
  kbuild: Really don't clean bounds.h and asm-offsets.h
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
  initramfs: Fix build break on symbol-prefixed archs
  initramfs: fix initramfs size calculation
  initramfs: generalize initramfs_data.xxx.S variants
  scripts/kallsyms: Enable error messages while hush up unnecessary warnings
  scripts/setlocalversion: update comment
  kbuild: Use a single clean rule for kernel and external modules
  kbuild: Do not run make clean in $(srctree)
  scripts/mod/modpost.c: fix commentary accordingly to last changes
  kbuild: Really don't clean bounds.h and asm-offsets.h
</pre>
</div>
</content>
</entry>
<entry>
<title>init: mark __user address space on string literals</title>
<updated>2010-10-26T23:52:15+00:00</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@gmail.com</email>
</author>
<published>2010-10-26T21:22:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=562f5e638de4ef451226552fe8dd7847bacea24e'/>
<id>562f5e638de4ef451226552fe8dd7847bacea24e</id>
<content type='text'>
When calling syscall service routines in kernel, some of arguments should
be user pointers but were missing __user markup on string literals.  Add
it.  Removes some sparse warnings.

Signed-off-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: Phillip Lougher &lt;phillip@lougher.demon.co.uk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When calling syscall service routines in kernel, some of arguments should
be user pointers but were missing __user markup on string literals.  Add
it.  Removes some sparse warnings.

Signed-off-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: Phillip Lougher &lt;phillip@lougher.demon.co.uk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>initramfs: fix initramfs size calculation</title>
<updated>2010-09-29T14:28:59+00:00</updated>
<author>
<name>Hendrik Brueckner</name>
<email>brueckner@linux.vnet.ibm.com</email>
</author>
<published>2010-09-17T22:24:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ffe8018c3424892c9590048fc36caa6c3e0c8a76'/>
<id>ffe8018c3424892c9590048fc36caa6c3e0c8a76</id>
<content type='text'>
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	  &lt;-- 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 &lt;populate_rootfs&gt;:
      540a9c:     eb cf f0 78 00 24       stmg    %r12,%r15,120(%r15),
      540aa2:     c0 10 00 01 8a af       larl    %r1,572000 &lt;__initramfs_start&gt;
      540aa8:     c0 c0 00 03 e1 2e       larl    %r12,5bcd04 &lt;initramfs_end&gt;
                                                  (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 &lt;holzheu@linux.vnet.ibm.com&gt;
Signed-off-by: Hendrik Brueckner &lt;brueckner@linux.vnet.ibm.com&gt;
Reviewed-by: WANG Cong &lt;xiyou.wangcong@gmail.com&gt;
Acked-by: Michal Marek &lt;mmarek@suse.cz&gt;
Acked-by: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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	  &lt;-- 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 &lt;populate_rootfs&gt;:
      540a9c:     eb cf f0 78 00 24       stmg    %r12,%r15,120(%r15),
      540aa2:     c0 10 00 01 8a af       larl    %r1,572000 &lt;__initramfs_start&gt;
      540aa8:     c0 c0 00 03 e1 2e       larl    %r12,5bcd04 &lt;initramfs_end&gt;
                                                  (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 &lt;holzheu@linux.vnet.ibm.com&gt;
Signed-off-by: Hendrik Brueckner &lt;brueckner@linux.vnet.ibm.com&gt;
Reviewed-by: WANG Cong &lt;xiyou.wangcong@gmail.com&gt;
Acked-by: Michal Marek &lt;mmarek@suse.cz&gt;
Acked-by: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>initramfs: handle unrecognised decompressor when unpacking</title>
<updated>2010-04-24T18:31:26+00:00</updated>
<author>
<name>Phillip Lougher</name>
<email>phillip@lougher.demon.co.uk</email>
</author>
<published>2010-04-23T17:18:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=df37bd156dcb4f5441beaf5bde444adac974e9a0'/>
<id>df37bd156dcb4f5441beaf5bde444adac974e9a0</id>
<content type='text'>
The unpack routine fails to handle the decompress_method() returning
unrecognised decompressor (compress_name == NULL).  This results in the
routine looping eventually oopsing on an out of bounds memory access.

Note this bug is usually hidden, only triggering on trailing junk after
one or more correct compressed blocks.  The case of the compressed archive
being complete junk is (by accident?) caught by the if (state != Reset)
check because state is initialised to Start, but not updated due to the
decompressor not having been called.  Obviously if the junk is trailing a
correctly decompressed buffer, state == Reset from the previous call to
the decompressor.

Signed-off-by: Phillip Lougher &lt;phillip@lougher.demon.co.uk&gt;
Reported-by: Aaro Koskinen &lt;aaro.koskinen@iki.fi&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The unpack routine fails to handle the decompress_method() returning
unrecognised decompressor (compress_name == NULL).  This results in the
routine looping eventually oopsing on an out of bounds memory access.

Note this bug is usually hidden, only triggering on trailing junk after
one or more correct compressed blocks.  The case of the compressed archive
being complete junk is (by accident?) caught by the if (state != Reset)
check because state is initialised to Start, but not updated due to the
decompressor not having been called.  Obviously if the junk is trailing a
correctly decompressed buffer, state == Reset from the previous call to
the decompressor.

Signed-off-by: Phillip Lougher &lt;phillip@lougher.demon.co.uk&gt;
Reported-by: Aaro Koskinen &lt;aaro.koskinen@iki.fi&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>init/initramfs.c: fix "symbol shadows an earlier one" noise</title>
<updated>2010-03-06T19:26:29+00:00</updated>
<author>
<name>H Hartley Sweeten</name>
<email>hartleys@visionengravers.com</email>
</author>
<published>2010-03-05T21:42:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8aaed5bec2b9177eab1796c8c4f7a4c90804eef6'/>
<id>8aaed5bec2b9177eab1796c8c4f7a4c90804eef6</id>
<content type='text'>
The symbol 'count' is a local global variable in this file.  The function
clean_rootfs() should use a different symbol name to prevent "symbol
shadows an earlier one" noise.

Signed-off-by: H Hartley Sweeten &lt;hsweeten@visionengravers.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The symbol 'count' is a local global variable in this file.  The function
clean_rootfs() should use a different symbol name to prevent "symbol
shadows an earlier one" noise.

Signed-off-by: H Hartley Sweeten &lt;hsweeten@visionengravers.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>initramfs: add missing decompressor error check</title>
<updated>2009-12-15T22:04:24+00:00</updated>
<author>
<name>Phillip Lougher</name>
<email>phillip@lougher.demon.co.uk</email>
</author>
<published>2009-12-14T21:45:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=54291362d2a5738e1b0495df2abcb9e6b0563a3f'/>
<id>54291362d2a5738e1b0495df2abcb9e6b0563a3f</id>
<content type='text'>
The decompressors return error by calling a supplied error function, and/or
by returning an error return value.  The initramfs code, however, fails to
check the exit code returned by the decompressor, and only checks the error
status set by calling the error function.

This patch adds a return code check and calls the error function.

Signed-off-by: Phillip Lougher &lt;phillip@lougher.demon.co.uk&gt;
LKML-Reference: &lt;4b26b1ef.0+ZWxT6886olqcSc%phillip@lougher.demon.co.uk&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The decompressors return error by calling a supplied error function, and/or
by returning an error return value.  The initramfs code, however, fails to
check the exit code returned by the decompressor, and only checks the error
status set by calling the error function.

This patch adds a return code check and calls the error function.

Signed-off-by: Phillip Lougher &lt;phillip@lougher.demon.co.uk&gt;
LKML-Reference: &lt;4b26b1ef.0+ZWxT6886olqcSc%phillip@lougher.demon.co.uk&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>initramfs: clean up messages related to initramfs unpacking</title>
<updated>2009-05-06T23:36:10+00:00</updated>
<author>
<name>Eric Piel</name>
<email>eric.piel@tremplin-utc.net</email>
</author>
<published>2009-05-06T23:03:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a1e6b6c1a676d25acdf079ee8ab5cdfeb5e5b835'/>
<id>a1e6b6c1a676d25acdf079ee8ab5cdfeb5e5b835</id>
<content type='text'>
With the removal of duplicate unpack_to_rootfs() (commit
df52092f3c97788592ef72501a43fb7ac6a3cfe0) the messages displayed do not
actually correspond to what the kernel is doing.  In addition, depending
if ramdisks are supported or not, the messages are not at all the same.

So keep the messages more in sync with what is really doing the kernel,
and only display a second message in case of failure.  This also ensure
that the printk message cannot be split by other printk's.

Signed-off-by: Eric Piel &lt;eric.piel@tremplin-utc.net&gt;
Acked-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With the removal of duplicate unpack_to_rootfs() (commit
df52092f3c97788592ef72501a43fb7ac6a3cfe0) the messages displayed do not
actually correspond to what the kernel is doing.  In addition, depending
if ramdisks are supported or not, the messages are not at all the same.

So keep the messages more in sync with what is really doing the kernel,
and only display a second message in case of failure.  This also ensure
that the printk message cannot be split by other printk's.

Signed-off-by: Eric Piel &lt;eric.piel@tremplin-utc.net&gt;
Acked-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>initramfs: fix initramfs to work with hardlinked init</title>
<updated>2009-04-13T22:04:31+00:00</updated>
<author>
<name>Randy Robertson</name>
<email>rmrobert@vmware.com</email>
</author>
<published>2009-04-13T21:40:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d20d5a7456d57d8affa88f45f27ae96ea49c29e4'/>
<id>d20d5a7456d57d8affa88f45f27ae96ea49c29e4</id>
<content type='text'>
Change cb6ff208076b5f434db1b8c983429269d719cef5 ("NOMMU: Support XIP on
initramfs") seems to have broken booting from initramfs with /sbin/init
being a hardlink.

It seems like the logic required for XIP on nommu, i.e.  ftruncate to
reported cpio header file size (body_len) is broken for hardlinks, which
have a reported size of 0, and the truncate thus nukes the contents of the
file (in my case busybox), making boot impossible and ending with runaway
loop modprobe binfmt-0000 - and of course 0000 is not a valid binary
format.

My fix is to only call ftruncate if size is non-zero which fixes things
for me, but I'm not certain whether this will break XIP for those files on
nommu systems, although I would guess not.

Signed-off-by: Randy Robertson &lt;rmrobert@vmware.com&gt;
Acked-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Paul Mundt &lt;lethal@linux-sh.org&gt;
Acked-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change cb6ff208076b5f434db1b8c983429269d719cef5 ("NOMMU: Support XIP on
initramfs") seems to have broken booting from initramfs with /sbin/init
being a hardlink.

It seems like the logic required for XIP on nommu, i.e.  ftruncate to
reported cpio header file size (body_len) is broken for hardlinks, which
have a reported size of 0, and the truncate thus nukes the contents of the
file (in my case busybox), making boot impossible and ending with runaway
loop modprobe binfmt-0000 - and of course 0000 is not a valid binary
format.

My fix is to only call ftruncate if size is non-zero which fixes things
for me, but I'm not certain whether this will break XIP for those files on
nommu systems, although I would guess not.

Signed-off-by: Randy Robertson &lt;rmrobert@vmware.com&gt;
Acked-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Paul Mundt &lt;lethal@linux-sh.org&gt;
Acked-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>init/initramfs: fix warning with CONFIG_BLK_DEV_RAM=n</title>
<updated>2009-04-13T22:04:28+00:00</updated>
<author>
<name>Nikanth Karthikesan</name>
<email>knikanth@suse.de</email>
</author>
<published>2009-04-13T21:39:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b52bb3712a64c404846f30300b339cfd01e316be'/>
<id>b52bb3712a64c404846f30300b339cfd01e316be</id>
<content type='text'>
init/initramfs.c:520: warning: 'clean_rootfs' defined but not used

Signed-off-by: Nikanth Karthikesan &lt;knikanth@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
init/initramfs.c:520: warning: 'clean_rootfs' defined but not used

Signed-off-by: Nikanth Karthikesan &lt;knikanth@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>initramfs: prevent initramfs printk message being split by messages from other code.</title>
<updated>2009-04-03T02:04:51+00:00</updated>
<author>
<name>Simon Kitching</name>
<email>skitching@apache.org</email>
</author>
<published>2009-04-02T23:57:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c1c490e017b66b31f6559db9cbb51a3ce00cf639'/>
<id>c1c490e017b66b31f6559db9cbb51a3ce00cf639</id>
<content type='text'>
initramfs uses printk without a linefeed, then does some work, then uses
printk to finish the message off.  However if some other code does a
printk in between, then the messages get mixed together.  Better for each
message to be an independent line...

Example of problem that this fixes:

    checking if image is initramfs...&lt;7&gt;Switched to high resolution mode on CPU 1
    Switched to high resolution mode on CPU 0
    it is

Signed-off-by: Simon Kitching &lt;skitching@apache.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
initramfs uses printk without a linefeed, then does some work, then uses
printk to finish the message off.  However if some other code does a
printk in between, then the messages get mixed together.  Better for each
message to be an independent line...

Example of problem that this fixes:

    checking if image is initramfs...&lt;7&gt;Switched to high resolution mode on CPU 1
    Switched to high resolution mode on CPU 0
    it is

Signed-off-by: Simon Kitching &lt;skitching@apache.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
