From: Ujjwal Kumar <ujjwalkumar0501@gmail.com>
To: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] kconfig: Prepend interpeters when calling scripts
Date: Tue, 29 Sep 2020 23:17:37 +0530 [thread overview]
Message-ID: <ea21b166-70b4-a03f-4258-6c2015189db7@gmail.com> (raw)
In-Reply-To: <a24ccaf7-a96f-0ca1-cc36-135f88497ac4@gmail.com>
On 26/09/20 2:53 pm, Ujjwal Kumar wrote:
> On 26/09/20 11:24 am, Lukas Bulwahn wrote:
>>
>>
>> On Sat, 26 Sep 2020, Ujjwal Kumar wrote:
>>>
>>> To unset the executable bit I ran following command:
>>> for i in $(find -executable -type f); do chmod -x $i; done
>>>
>>> One thing that I noticed is, once we initiate a kernel build some
>>> programs are compiled and removing their executable bit is not desirable.
>>> Even after performing "make clean" some of those programs still persist and
>>> removing their executable bit fails any further attempt to build the kernel.
>>>
>>> For instance, tools/objtool/objtool file. In my case I had a total of 19
>>> files remaining after performing make clean.
>>>
>>
>> Good observation.
>>
>> You can properly clean your build with make mrproper, but maybe that is
>> not even enough... all generated files might not mean _all generated
>> tools_, such as objtool, etc.
>>
>> $ make help
>>
>> Cleaning targets:
>> clean - Remove most generated files but keep the config and
>> enough build support to build external modules
>> mrproper - Remove all generated files + config + various backup files
>> distclean - mrproper + remove editor backup and patch files
>>
>> [...]
>>
>> After for i in $(find -executable -type f); do chmod -x $i; done:
>> I saw those failures (probably as you did as well):
>
> Yes these are the same errors that I received.
>
>>
>> *** Default configuration is based on 'x86_64_defconfig'
>> sh: 1: ./scripts/gcc-version.sh: Permission denied
>> init/Kconfig:34: syntax error
>> init/Kconfig:33: invalid statement
>> init/Kconfig:34: invalid statement
>> sh: 1: ./scripts/ld-version.sh: Permission denied
>> init/Kconfig:39: syntax error
>> init/Kconfig:38: invalid statement
>> sh: 1: ./scripts/clang-version.sh: Permission denied
>> init/Kconfig:49: syntax error
>> init/Kconfig:48: invalid statement
>> scripts/kconfig/Makefile:80: recipe for target 'defconfig' failed
>> make[1]: *** [defconfig] Error 1
>> Makefile:606: recipe for target 'defconfig' failed
>> make: *** [defconfig] Error 2
>>
>>
>> After your patch was applied, they disappear. So, it does the job.
>> More comments on the patch itself later.
>>
>> make defconfig works.
>>
>
> Yes, these errors appeared when we unset executable bits on files after
> performing 'make clean' and then perform a kernel build.
>
>> make then fails:
>>
>> HOSTCC /home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/objtool/fixdep.o
>> /bin/sh: 1: /home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/objtool//fixdep: Permission denied
>> /home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/build/Makefile.build:96: recipe for target
>> '/home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/objtool/fixdep.o' failed
>> make[4]: *** [/home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/objtool/fixdep.o] Error 126
>> Makefile:43: recipe for target '/home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/objtool/fixdep-in.o' failed
>> make[3]: *** [/home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/objtool/fixdep-in.o] Error 2
>> /home/lukas/repositories/kernel.org/pub/scm/linux/kernel/git/torvalds/linux/tools/build/Makefile.include:5: recipe for target 'fixdep' failed
>> make[2]: *** [fixdep] Error 2
>> Makefile:68: recipe for target 'objtool' failed
>> make[1]: *** [objtool] Error 2
>> Makefile:1885: recipe for target 'tools/objtool' failed
>> make: *** [tools/objtool] Error 2
>> make: *** Waiting for unfinished jobs....
>>
>> The make target also goes into tools/build/ and requires some targets
>> there and then uses those tools during the further build.
>>
>> So, we need some more patches here as well.
>>
>> Can you share the list of 19 files that remained even with make clean?
>>
>
> After performing a make clean, the files that persist are:
> ./tools/objtool/objtool
> ./tools/objtool/fixdep
> ./scripts/sorttable
> ./scripts/mod/mk_elfconfig
> ./scripts/mod/modpost
> ./scripts/unifdef
> ./scripts/basic/fixdep
> ./scripts/bin2c
> ./scripts/extract-cert
> ./scripts/kconfig/conf
> ./scripts/selinux/mdp/mdp
> ./scripts/selinux/genheaders/genheaders
> ./scripts/asn1_compiler
> ./scripts/kallsyms
> ./scripts/sign-file
> ./scripts/genksyms/genksyms
> ./scripts/recordmcount
> ./scripts/insert-sys-cert
> ./scripts/dtc/dtc
>
> After performing 'make mrproper'/'make distclean' the files that persist
> are:
> ./tools/objtool/objtool
> ./tools/objtool/fixdep
These files can be removed using following command from srctree:
make tools/objtool_clean
So after performing 'make mrproper' and 'make tools/objtool_clean', we get
rid of all the compiled programs.
Instead of 'make tools/objtool_clean' we can perform following commands:
From the srctree directory, make tools/clean
From the tools directory, make clean
From the tools directory, make objtool_clean
to remove the 2 files.
>
>> Then, we go through them and check if they disappear with make mrproper or
>> with a different make target to clean them. Potentially, we also hook
>> those identified targets up into make mrproper then.
I tried hooking the clean task with 'make mrproper' in top-level Makefile
as follows:
$ git diff Makefile
diff --git a/Makefile b/Makefile
index 5f1399a576d4..43ab6ce98c64 100644
--- a/Makefile
+++ b/Makefile
@@ -1498,6 +1498,7 @@ $(mrproper-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
mrproper: clean $(mrproper-dirs)
+ $(Q)$(MAKE) tools/objtool_clean
$(call cmd,rmfiles)
# distclean
---
Instead of '$(Q)$(MAKE) tools/objtool_clean' we can perform following
command:
'$(Q)$(MAKE) tools/clean' to clean the entire tools/ directory.
>
> Is it appropriate to include the files here:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Makefile?h=next-20200925#n1466
> ?
> Or should it be included inside tools/objtool/Makefile here:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/objtool/Makefile?h=next-20200925#n78
> ?
> In the second link, it appears to me that the files are already included for
> clean task but still they are not cleaned.
>
>>> Lukas
>>
>
> Thanks
> Ujjwal Kumar
>
Ujjwal Kumar
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-09-29 17:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 21:20 [Linux-kernel-mentees] [PATCH] kconfig: Prepend interpeters when calling scripts Ujjwal Kumar
2020-09-25 21:25 ` Ujjwal Kumar
2020-09-26 5:54 ` Lukas Bulwahn
2020-09-26 9:23 ` Ujjwal Kumar
2020-09-29 17:47 ` Ujjwal Kumar [this message]
2020-09-30 19:53 ` Lukas Bulwahn
2020-09-26 6:11 ` Greg KH
2020-09-26 6:19 ` Lukas Bulwahn
2020-09-26 6:26 ` Greg KH
2020-09-26 6:12 ` Lukas Bulwahn
2020-09-26 10:24 ` Ujjwal Kumar
2020-09-26 11:01 ` Lukas Bulwahn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea21b166-70b4-a03f-4258-6c2015189db7@gmail.com \
--to=ujjwalkumar0501@gmail.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=lukas.bulwahn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).