[PATCH 2.6.9-bk7] Select cpio_list or source directory for initramfs image updates [u]

From: Martin Schlemmer [c] (azarah_at_nosferatu.za.org)
Date: 10/23/04

  • Next message: Roberto Nibali: "ext3 oops (probably I/O congestion/starvation related), already solved?"
    To: Andrew Morton <akpm@osdl.org>
    Date:	Sat, 23 Oct 2004 14:06:28 +0200
    
    
    
    

    Hi,

    Here is some updates after talking to Sam Ravnborg. He did not yet come
    back to me, I am not sure if I understood 100% what he meant, but hopefully
    somebody else will be so kind as to comment.

    Here is a shortish changelog:

    - Fix an issue reported by Esben Nielsen <simlo@phys.au.dk> (with
    suggestion from Sam Ravnborg). Build failed if $O (output dir) was
    set. This is done by pre-pending $srctree if the shipped list is
    referenced.

    - Also fix calling of gen_initramfs_list.sh if $O (output dir) is set
    by pre-pending $srctree.

    - I also moved initramfs_list to initramfs_list.shipped, to make sure we
    always have an 'fall back' list (say you unset CONFIG_INITRAMFS_SOURCE
    and deleted your custom intramfs source directory, then building will not
    fail).

    - Kbuild style cleanups.

    - Improved error checking. For example gen_initramfs_list.sh will
    output a simple list if the target directory is empty, and we verify
    that the shipped initramfs_list is present before touching it.

    - Only update the temp initramfs_list if the source list/directory have
    changed.

    - Cleanup temporary initramfs_list when 'make clean' or 'make mrproper'
    is called.

    This patch should apply to both 2.6.9-bk7 and 2.6.9-mm1.

    (Note that evo does some tab/newline damage)

    Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org>

    diff -uprN -X dontdiff linux-2.6.9-bk7.orig/scripts/gen_initramfs_list.sh linux-2.6.9-bk7/scripts/gen_initramfs_list.sh
    --- linux-2.6.9-bk7.orig/scripts/gen_initramfs_list.sh 2004-10-23 11:23:49.000000000 +0200
    +++ linux-2.6.9-bk7/scripts/gen_initramfs_list.sh 2004-10-23 11:26:52.000000000 +0200
    @@ -76,9 +76,23 @@ parse() {
             return 0
     }
     
    -find "${srcdir}" -printf "%p %m %U %G\n" | \
    -while read x; do
    - parse ${x}
    -done
    +dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null)
    +
    +# If $dirlist is only one line, then the directory is empty
    +if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
    + echo "${dirlist}" | \
    + while read x; do
    + parse ${x}
    + done
    +else
    + # Failsafe in case directory is empty
    + cat <<-EOF
    + # This is a very simple initramfs
    +
    + dir /dev 0755 0 0
    + nod /dev/console 0600 0 0 c 5 1
    + dir /root 0700 0 0
    + EOF
    +fi
     
     exit 0
    diff -uprN -X dontdiff linux-2.6.9-bk7.orig/usr/Makefile linux-2.6.9-bk7/usr/Makefile
    --- linux-2.6.9-bk7.orig/usr/Makefile 2004-10-23 11:23:54.000000000 +0200
    +++ linux-2.6.9-bk7/usr/Makefile 2004-10-23 13:56:28.691508824 +0200
    @@ -6,9 +6,11 @@ hostprogs-y := gen_init_cpio
     clean-files := initramfs_data.cpio.gz
     
     # If you want a different list of files in the initramfs_data.cpio
    -# then you can either overwrite the cpio_list in this directory
    -# or set INITRAMFS_LIST to another filename.
    -INITRAMFS_LIST := $(obj)/initramfs_list
    +# then you can either overwrite initramfs_list.shipped in this directory
    +# or set CONFIG_INITRAMFS_SOURCE to another filename or directory.
    +initramfs_list := initramfs_list
    +
    +clean-files += $(initramfs_list)
     
     # initramfs_data.o contains the initramfs_data.cpio.gz image.
     # The image is included using .incbin, a dependency which is not
    @@ -23,28 +25,75 @@ $(obj)/initramfs_data.o: $(obj)/initramf
     # Commented out for now
     # initramfs-y := $(obj)/root/hello
     
    -quiet_cmd_gen_list = GEN_INITRAMFS_LIST $@
    +# Returns:
    +# valid command if everything should be fine
    +# 'uptodate' if nothing needs to be done
    +# 'missing' if $(srctree)/$(src)/$(initramfs_list).shipped is missing
    +quiet_cmd_gen_list = GEN $@
           cmd_gen_list = $(shell \
    - if test -f $(CONFIG_INITRAMFS_SOURCE); then \
    - if [ $(CONFIG_INITRAMFS_SOURCE) != $@ ]; then \
    - echo 'cp -f $(CONFIG_INITRAMFS_SOURCE) $@'; \
    + if [ -d $(CONFIG_INITRAMFS_SOURCE) ]; \
    + then \
    + if [ ! -f "$(obj)/$(initramfs_list)" -o \
    + "x`find $(CONFIG_INITRAMFS_SOURCE) -newer "$(obj)/$(initramfs_list)" 2>/dev/null`" != "x" ]; \
    + then \
    + echo '$(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh \
    + $(CONFIG_INITRAMFS_SOURCE) > "$(obj)/$(initramfs_list)"'; \
               else \
    - echo 'echo Using shipped $@'; \
    - fi; \
    - elif test -d $(CONFIG_INITRAMFS_SOURCE); then \
    - echo 'scripts/gen_initramfs_list.sh $(CONFIG_INITRAMFS_SOURCE) > $@'; \
    + echo 'uptodate'; \
    + fi \
             else \
    - echo 'echo Using shipped $@'; \
    + if [ -f $(CONFIG_INITRAMFS_SOURCE) -a \
    + $(CONFIG_INITRAMFS_SOURCE) != "$(obj)/$(initramfs_list)" ]; \
    + then \
    + if [ ! -f "$(obj)/$(initramfs_list)" -o \
    + $(CONFIG_INITRAMFS_SOURCE) -nt "$(obj)/$(initramfs_list)" ]; \
    + then \
    + echo 'cp -f $(CONFIG_INITRAMFS_SOURCE) "$(obj)/$(initramfs_list)"'; \
    + else \
    + echo 'uptodate'; \
    + fi \
    + else \
    + if [ -f "$(srctree)/$(src)/$(initramfs_list).shipped" ]; \
    + then \
    + if [ ! -f "$(obj)/$(initramfs_list)" -o \
    + "$(srctree)/$(src)/$(initramfs_list).shipped" -nt "$(obj)/$(initramfs_list)" ]; \
    + then \
    + echo 'cp -f "$(srctree)/$(src)/$(initramfs_list).shipped" \
    + "$(obj)/$(initramfs_list)"'; \
    + else \
    + echo 'uptodate'; \
    + fi \
    + else \
    + echo 'missing'; \
    + fi \
    + fi \
             fi)
     
    -
    -$(INITRAMFS_LIST): FORCE
    - $(call cmd,gen_list)
    +initramfs_list_state_uptodate :=
    +initramfs_list_state_outofdate :=
    +initramfs_list_state_missing :=
    +
    +ifeq ($(cmd_gen_list),uptodate)
    + initramfs_list_state_uptodate := 1
    +else
    + ifeq ($(cmd_gen_list),missing)
    + initramfs_list_state_missing := 1
    + else
    + initramfs_list_state_outofdate := 1
    + endif
    +endif
    +
    +$(obj)/$(initramfs_list): FORCE
    + $(if $(nitramfs_list_state_uptodate),, \
    + $(if $(initramfs_list_state_outofdate), $(call cmd,gen_list), \
    + $(if $(initramfs_list_state_missing), \
    + @echo 'File "$(src)/$(initramfs_list).shipped" does not exist'; \
    + /bin/false)))
     
     quiet_cmd_cpio = CPIO $@
    - cmd_cpio = ./$< $(INITRAMFS_LIST) > $@
    + cmd_cpio = ./$< $(obj)/$(initramfs_list) > $@
     
    -$(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) $(INITRAMFS_LIST) FORCE
    +$(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) $(obj)/$(initramfs_list) FORCE
             $(call if_changed,cpio)
     
     targets += initramfs_data.cpio
    diff -uprN -X dontdiff linux-2.6.9-bk7.orig/usr/initramfs_list linux-2.6.9-bk7/usr/initramfs_list
    --- linux-2.6.9-bk7.orig/usr/initramfs_list 2004-10-23 11:23:54.000000000 +0200
    +++ linux-2.6.9-bk7/usr/initramfs_list 1970-01-01 02:00:00.000000000 +0200
    @@ -1,5 +0,0 @@
    -# This is a very simple initramfs - mostly preliminary for future expansion
    -
    -dir /dev 0755 0 0
    -nod /dev/console 0600 0 0 c 5 1
    -dir /root 0700 0 0
    diff -uprN -X dontdiff linux-2.6.9-bk7.orig/usr/initramfs_list.shipped linux-2.6.9-bk7/usr/initramfs_list.shipped
    --- linux-2.6.9-bk7.orig/usr/initramfs_list.shipped 1970-01-01 02:00:00.000000000 +0200
    +++ linux-2.6.9-bk7/usr/initramfs_list.shipped 2004-10-23 11:26:52.000000000 +0200
    @@ -0,0 +1,5 @@
    +# This is a very simple initramfs - mostly preliminary for future expansion
    +
    +dir /dev 0755 0 0
    +nod /dev/console 0600 0 0 c 5 1
    +dir /root 0700 0 0

    -- 
    Martin Schlemmer
    
    
    

    
    

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/





  • Next message: Roberto Nibali: "ext3 oops (probably I/O congestion/starvation related), already solved?"

    Relevant Pages

    • Re: Outlook 2003 Printing Message Headers
      ... this, I click on Edit> Edit Message then Format> Plain Text, the emails ... Windows XP SP2 (Assume updates are missing since user is using IE ...
      (microsoft.public.outlook.printing)
    • RE: update manager error
      ... Sometimes you can experience network issues with updates; ... mirror host experiencing problems etc. ... what am I missing? ...
      (Ubuntu)
    • Re: ms097.dll missing
      ... The message doesn't necessarily mean it is missing. ... find it available for download is if you do not get the correct ... I suspect the Quick Restore didn't include updates that were applied ... Due to a> number of issues with my computer I dedcided that it would> probably be best to do a Quick Restore and get it back in> to the same shape it was when we first bought it. ...
      (microsoft.public.word.application.errors)
    • Re: hta file refresh output in textarea
      ... >displays status messages in a scrolling textarea. ... > copy filename to destination ... > individual files) the updates appear in the text area. ... Set WSHShell = CreateObject ...
      (microsoft.public.scripting.vbscript)
    • Re: OE6 cannot open attachments
      ... Thank you for submitting an error report. ... >> report and the reply is that I propably have to search for missing updates. ...
      (microsoft.public.windows.inetexplorer.ie6_outlookexpress)

    Loading