mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] scripts: add gen-linux-conf for remote kernel configuration
@ 2009-11-12 23:03 Luis R. Rodriguez
  2009-11-12 23:31 ` Alan Jenkins
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2009-11-12 23:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: sam, greg, akpm, mcgrof, lrodriguez

The new 'make localmodconfig' proves very useful but on low end
systems we do not want to 'git clone' an entire kernel tree or
download a whole kernel but just cross compile the kernel on a
bigger machine. The .config generated with 'make localmodconfig'
is still very helpfup though so to aid users and developers
with that add a script which builds a tarball with only the
necessary kernel glue stuff to be able to generate a local
minimum kernel configuration with 'make localmodconfig'.

With this you can copy to your target device a relatively
small tarball (1.2 MB currenty) and, allows you to modify
the kernel config for your tree (mconf, conf, etc) and
finally run 'make localmodconfig'.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---

I had an itch to scratch and that was to use 'localmodconfig'
on a small netbook but I didn't want to clone a whole tree
or even compile an entire kernel on it. This did the trick,
thought others might find it useful.

A little grimy the bash script, but hey it works and its simple
enough. I tried to reduce the Makefile count to only arch/ but
found that that didn't do the trick. Perhaps this can be optimized
more, suggestions welcomed. Maybe it should be written in Go :)

What would be *real* nice is to give an IP address of a box and
have it build and fetch a localmodconfig .config for you.

  Luis

 scripts/gen-linux-conf |   61 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100755 scripts/gen-linux-conf

diff --git a/scripts/gen-linux-conf b/scripts/gen-linux-conf
new file mode 100755
index 0000000..5c88a50
--- /dev/null
+++ b/scripts/gen-linux-conf
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+DEST=linux-conf
+rm -rf $DEST
+
+KCONFIGS=$(find ./ -type f -name Kconfig\*)
+MAKEFILES=$(find ./ -type f -name Makefile\*)
+KBUILDS=$(find ./ -type f -name Kbuild\*)
+
+COUNT=0
+echo -en "\nAdding Kconfigs"
+for i in ${KCONFIGS}; do
+	FILE=$(basename $i)
+	DIR=$(dirname $i)
+	DIR=${DEST}/${DIR}
+	mkdir -p ${DIR}
+	cp $i ${DIR}
+	echo -en "."
+	let COUNT=$COUNT+1
+done
+echo "$COUNT files copied"
+
+COUNT=0
+echo -en "Adding Makefiles"
+for i in ${MAKEFILES}; do
+	FILE=$(basename $i)
+	DIR=$(dirname $i)
+	DIR=${DEST}/${DIR}
+	mkdir -p ${DIR}
+	cp $i ${DIR}
+	echo -en "."
+	let COUNT=$COUNT+1
+done
+echo "$COUNT files copied"
+
+COUNT=0
+echo -en "Adding Kbuild files"
+for i in ${KBUILDS}; do
+	FILE=$(basename $i)
+	DIR=$(dirname $i)
+	DIR=${DEST}/${DIR}
+	mkdir -p ${DIR}
+	cp $i ${DIR}
+	echo -en "."
+	let COUNT=$COUNT+1
+done
+echo -e "$COUNT files copied\n"
+
+cp -af scripts/ ${DEST}
+cp -f Makefile ${DEST}
+
+TARBALL=${DEST}.tar.bz2
+
+tar -jcf ${TARBALL} ${DEST}
+rm -rf ${DEST}
+
+echo -e "Finished ${TARBALL} ($(du -h $TARBALL | cut -f 1))"
+echo -e "Now scp ${TARBALL} to target and run:\n"
+echo -e "cp /boot/your-config .config"
+echo -e "make menuconfig"
+echo -e "make localmodconfig"
-- 
1.6.5.2.155.gbb47


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] scripts: add gen-linux-conf for remote kernel configuration
  2009-11-12 23:03 [RFC] scripts: add gen-linux-conf for remote kernel configuration Luis R. Rodriguez
@ 2009-11-12 23:31 ` Alan Jenkins
  2009-11-13  0:31   ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Jenkins @ 2009-11-12 23:31 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-kernel, sam, greg, akpm, mcgrof

On 11/12/09, Luis R. Rodriguez <lrodriguez@atheros.com> wrote:
> The new 'make localmodconfig' proves very useful but on low end
> systems we do not want to 'git clone' an entire kernel tree or
> download a whole kernel but just cross compile the kernel on a
> bigger machine. The .config generated with 'make localmodconfig'
> is still very helpfup though so to aid users and developers
> with that add a script which builds a tarball with only the
> necessary kernel glue stuff to be able to generate a local
> minimum kernel configuration with 'make localmodconfig'.
>
> With this you can copy to your target device a relatively
> small tarball (1.2 MB currenty) and, allows you to modify
> the kernel config for your tree (mconf, conf, etc) and
> finally run 'make localmodconfig'.
>
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> ---
>
> I had an itch to scratch and that was to use 'localmodconfig'
> on a small netbook but I didn't want to clone a whole tree
> or even compile an entire kernel on it. This did the trick,
> thought others might find it useful.
>
> A little grimy the bash script, but hey it works and its simple
> enough. I tried to reduce the Makefile count to only arch/ but
> found that that didn't do the trick. Perhaps this can be optimized
> more, suggestions welcomed. Maybe it should be written in Go :)
>
> What would be *real* nice is to give an IP address of a box and
> have it build and fetch a localmodconfig .config for you.
>
>   Luis

Thanks for posting this.

When I tried this for my netbook, my approach was to copy
/proc/modules and /boot/config from the netbook.  As a shameless hack,
I temporarily bind mounted /proc/modules on the build system.  I guess
the cleaner way would be to copy the result of "lsmod", and have
localmodconfig accept "LSMOD_FILE=file".

Naturally I think my approach is simpler, despite not having actually
implemented it properly :).  What do you think about it?

Regards
Alan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] scripts: add gen-linux-conf for remote kernel configuration
  2009-11-12 23:31 ` Alan Jenkins
@ 2009-11-13  0:31   ` Luis R. Rodriguez
  0 siblings, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2009-11-13  0:31 UTC (permalink / raw)
  To: Alan Jenkins; +Cc: linux-kernel, sam, greg, akpm

On Thu, Nov 12, 2009 at 3:31 PM, Alan Jenkins
<sourcejedi.lkml@googlemail.com> wrote:
> On 11/12/09, Luis R. Rodriguez <lrodriguez@atheros.com> wrote:
>> The new 'make localmodconfig' proves very useful but on low end
>> systems we do not want to 'git clone' an entire kernel tree or
>> download a whole kernel but just cross compile the kernel on a
>> bigger machine. The .config generated with 'make localmodconfig'
>> is still very helpfup though so to aid users and developers
>> with that add a script which builds a tarball with only the
>> necessary kernel glue stuff to be able to generate a local
>> minimum kernel configuration with 'make localmodconfig'.
>>
>> With this you can copy to your target device a relatively
>> small tarball (1.2 MB currenty) and, allows you to modify
>> the kernel config for your tree (mconf, conf, etc) and
>> finally run 'make localmodconfig'.
>>
>> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
>> ---
>>
>> I had an itch to scratch and that was to use 'localmodconfig'
>> on a small netbook but I didn't want to clone a whole tree
>> or even compile an entire kernel on it. This did the trick,
>> thought others might find it useful.
>>
>> A little grimy the bash script, but hey it works and its simple
>> enough. I tried to reduce the Makefile count to only arch/ but
>> found that that didn't do the trick. Perhaps this can be optimized
>> more, suggestions welcomed. Maybe it should be written in Go :)
>>
>> What would be *real* nice is to give an IP address of a box and
>> have it build and fetch a localmodconfig .config for you.
>>
>>   Luis
>
> Thanks for posting this.
>
> When I tried this for my netbook, my approach was to copy
> /proc/modules and /boot/config from the netbook.  As a shameless hack,
> I temporarily bind mounted /proc/modules on the build system.  I guess
> the cleaner way would be to copy the result of "lsmod", and have
> localmodconfig accept "LSMOD_FILE=file".
>
> Naturally I think my approach is simpler, despite not having actually
> implemented it properly :).  What do you think about it?

It does sound simpler, but you'd still need the netbook's config and
upgrade it to the the desired kernel's config, so you'd need to
address that too. Just lsmod won't cut it I think.

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-13  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-12 23:03 [RFC] scripts: add gen-linux-conf for remote kernel configuration Luis R. Rodriguez
2009-11-12 23:31 ` Alan Jenkins
2009-11-13  0:31   ` Luis R. Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®