diff mbox

x86,build: Fix make -jN modules_install install

Message ID 37910a32e3d223a688a2743376bdde8fbdc8ef5c.1402515662.git.luto@amacapital.net (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Lutomirski June 11, 2014, 7:41 p.m. UTC
Every few months, I forget why I type:

$ sudo make -j12 modules_install && sudo make -j12 install

instead of just:

$ sudo make -j12 modules_install install

I try the latter, it appears to work, and then my machine won't boot
because dracut got confused.  This fixes it once and for all: if you
ask make to install modules and a kernel, you almost certainly want
the modules installed *first* so that your initramfs scripts can
find the modules.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
---
 arch/x86/Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Sam Ravnborg June 11, 2014, 7:44 p.m. UTC | #1
On Wed, Jun 11, 2014 at 12:41:57PM -0700, Andy Lutomirski wrote:
> Every few months, I forget why I type:
> 
> $ sudo make -j12 modules_install && sudo make -j12 install
> 
> instead of just:
> 
> $ sudo make -j12 modules_install install
> 
> I try the latter, it appears to work, and then my machine won't boot
> because dracut got confused.  This fixes it once and for all: if you
> ask make to install modules and a kernel, you almost certainly want
> the modules installed *first* so that your initramfs scripts can
> find the modules.

Is this problem x86 specific?

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Lutomirski June 11, 2014, 7:46 p.m. UTC | #2
On Wed, Jun 11, 2014 at 12:44 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Wed, Jun 11, 2014 at 12:41:57PM -0700, Andy Lutomirski wrote:
>> Every few months, I forget why I type:
>>
>> $ sudo make -j12 modules_install && sudo make -j12 install
>>
>> instead of just:
>>
>> $ sudo make -j12 modules_install install
>>
>> I try the latter, it appears to work, and then my machine won't boot
>> because dracut got confused.  This fixes it once and for all: if you
>> ask make to install modules and a kernel, you almost certainly want
>> the modules installed *first* so that your initramfs scripts can
>> find the modules.
>
> Is this problem x86 specific?

I don't know.  But I also don't want to have 'make modules_install
install' on an arch without an install target appear to work, so I
don't know how to do it in the kbuild core.  That is, I don't want to
define an install target; I just want to add a dependency if the
target is already there.

Also, this patch has a repeated ifneq.  I'll fix it in v2.

>
>         Sam
Michal Marek June 12, 2014, 8:33 a.m. UTC | #3
Dne 11.6.2014 21:41, Andy Lutomirski napsal(a):
> Every few months, I forget why I type:
> 
> $ sudo make -j12 modules_install && sudo make -j12 install
> 
> instead of just:
> 
> $ sudo make -j12 modules_install install
> 
> I try the latter, it appears to work, and then my machine won't boot
> because dracut got confused.  This fixes it once and for all: if you
> ask make to install modules and a kernel, you almost certainly want
> the modules installed *first* so that your initramfs scripts can
> find the modules.
> 
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
>  arch/x86/Makefile | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 33f71b0..7280d28 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -240,6 +240,15 @@ PHONY += install
>  install:
>  	$(Q)$(MAKE) $(build)=$(boot) $@
>  
> +# If installing modules and a kernel, it's very likely that some initramfs
> +# script associated with installing the kernel will reference the modules,
> +# so make sure that modules are installed first.
> +ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
> +  ifneq ($(filter modules_install,$(MAKECMDGOALS)),)

The two conditions are identical. Did you mean to check for "install" in
one of them?

Thanks,
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Lutomirski June 13, 2014, 1:28 a.m. UTC | #4
On Thu, Jun 12, 2014 at 1:33 AM, Michal Marek <mmarek@suse.cz> wrote:
> Dne 11.6.2014 21:41, Andy Lutomirski napsal(a):
>> Every few months, I forget why I type:
>>
>> $ sudo make -j12 modules_install && sudo make -j12 install
>>
>> instead of just:
>>
>> $ sudo make -j12 modules_install install
>>
>> I try the latter, it appears to work, and then my machine won't boot
>> because dracut got confused.  This fixes it once and for all: if you
>> ask make to install modules and a kernel, you almost certainly want
>> the modules installed *first* so that your initramfs scripts can
>> find the modules.
>>
>> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
>> ---
>>  arch/x86/Makefile | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
>> index 33f71b0..7280d28 100644
>> --- a/arch/x86/Makefile
>> +++ b/arch/x86/Makefile
>> @@ -240,6 +240,15 @@ PHONY += install
>>  install:
>>       $(Q)$(MAKE) $(build)=$(boot) $@
>>
>> +# If installing modules and a kernel, it's very likely that some initramfs
>> +# script associated with installing the kernel will reference the modules,
>> +# so make sure that modules are installed first.
>> +ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
>> +  ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
>
> The two conditions are identical. Did you mean to check for "install" in
> one of them?

Yes, although I think that the check for "install" is actually unnecessary.

Is there some way to do this in the core kbuild?

--Andy

>
> Thanks,
> Michal
diff mbox

Patch

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 33f71b0..7280d28 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -240,6 +240,15 @@  PHONY += install
 install:
 	$(Q)$(MAKE) $(build)=$(boot) $@
 
+# If installing modules and a kernel, it's very likely that some initramfs
+# script associated with installing the kernel will reference the modules,
+# so make sure that modules are installed first.
+ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
+  ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
+    install: modules_install
+  endif
+endif
+
 PHONY += vdso_install
 vdso_install:
 	$(Q)$(MAKE) $(build)=arch/x86/vdso $@