trying to understand BBB kernel source patch.sh script at github

for the purpose of configuring and building a current kernel for my
BBB, i'm checking out the kernel source here (3.11 branch):

  https://github.com/beagleboard/kernel/tree/3.11

and what's there *seems* straightforward enough but i'm puzzled as to
what's going on in the "patch.sh" script (if there's a README
somewhere that clarifies it, that would be most excellent).

  in general, i'm assuming that whipping up an appropriate kernel
source tree for the BBB consists of two basic steps:

  * check out some recent kernel source (via tag or SHA or whatever)
  * patch the heck out of it (https://github.com/beagleboard/kernel/tree/3.11/patches)

so some questions about that patch.sh script.

  first, why are there references to two git repos for the kernel
source that would seem to be equivalent? early on, there's this
reference:

EXTERNAL_TREE="git://github.com/torvalds/linux.git"
EXTERNAL_BRANCH="master"
EXTERNAL_SHA="e4ef108fcde0b97ed38923ba1ea06c7a152bab9e"

while later on, the mainline kernel source is checked out:

if [ ! -f ./.git/config ] ; then
        git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git .

are those two repos not functionally equivalent? if not, what's the
difference?

  also, the mainline kernel source is checked out as of tag v3.11-rc4,
while that "EXTERNAL_TREE" is checked out based on an SHA -- what's
the difference between them? "git diff" tells me that the difference
is only a few hundred lines, so what does that represent?

  in the end, i don't need all the functionality of that script in the
sense of being able to build a recipe file; i'm assuming that, if all
i want is a compilable kernel source tree, i need only:

  * check out some appropriate kernel tree, then
  * apply all those patches

is that correct? so what is the minimal formula for getting a relevant
kernel source tree? thanks.

rday

  for the purpose of configuring and building a current kernel for my
BBB, i'm checking out the kernel source here (3.11 branch):

  https://github.com/beagleboard/kernel/tree/3.11

and what's there *seems* straightforward enough but i'm puzzled as to
what's going on in the "patch.sh" script (if there's a README
somewhere that clarifies it, that would be most excellent).

  in general, i'm assuming that whipping up an appropriate kernel
source tree for the BBB consists of two basic steps:

  * check out some recent kernel source (via tag or SHA or whatever)
  * patch the heck out of it (https://github.com/beagleboard/kernel/tree/3.11/patches)

so some questions about that patch.sh script.

  first, why are there references to two git repos for the kernel
source that would seem to be equivalent? early on, there's this
reference:

EXTERNAL_TREE="git://github.com/torvalds/linux.git"
EXTERNAL_BRANCH="master"
EXTERNAL_SHA="e4ef108fcde0b97ed38923ba1ea06c7a152bab9e"

Some context might help from the original 3.2 branch:
https://github.com/beagleboard/kernel/blob/beaglebone-3.2/patch.sh

Essentially the tree's goal is to always use linux's tree as a base,
but from time to time we would in the past have to use some fork
branch. Of course since then other features have been bolted onto the
patch.sh script to make it more automated. It could be refactored,
but it just works. :wink:

while later on, the mainline kernel source is checked out:

if [ ! -f ./.git/config ] ; then
        git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git .

are those two repos not functionally equivalent? if not, what's the
difference?

  also, the mainline kernel source is checked out as of tag v3.11-rc4,
while that "EXTERNAL_TREE" is checked out based on an SHA -- what's
the difference between them? "git diff" tells me that the difference
is only a few hundred lines, so what does that represent?

  in the end, i don't need all the functionality of that script in the
sense of being able to build a recipe file; i'm assuming that, if all
i want is a compilable kernel source tree, i need only:

  * check out some appropriate kernel tree, then
  * apply all those patches

Correct..

is that correct? so what is the minimal formula for getting a relevant
kernel source tree? thanks.

run ./patch.sh :wink: and it'll generated one for you.. Once you run it
'once' you could even push that tree to your own private repo to have
your own personal .git tree..

Regards,

>
> for the purpose of configuring and building a current kernel for my
> BBB, i'm checking out the kernel source here (3.11 branch):
>
> https://github.com/beagleboard/kernel/tree/3.11
>
> and what's there *seems* straightforward enough but i'm puzzled as to
> what's going on in the "patch.sh" script (if there's a README
> somewhere that clarifies it, that would be most excellent).
>
> in general, i'm assuming that whipping up an appropriate kernel
> source tree for the BBB consists of two basic steps:
>
> * check out some recent kernel source (via tag or SHA or whatever)
> * patch the heck out of it (https://github.com/beagleboard/kernel/tree/3.11/patches)
>
> so some questions about that patch.sh script.
>
> first, why are there references to two git repos for the kernel
> source that would seem to be equivalent? early on, there's this
> reference:
>
> EXTERNAL_TREE="git://github.com/torvalds/linux.git"
> EXTERNAL_BRANCH="master"
> EXTERNAL_SHA="e4ef108fcde0b97ed38923ba1ea06c7a152bab9e"

Some context might help from the original 3.2 branch:
https://github.com/beagleboard/kernel/blob/beaglebone-3.2/patch.sh

Essentially the tree's goal is to always use linux's tree as a base,
but from time to time we would in the past have to use some fork
branch. Of course since then other features have been bolted onto the
patch.sh script to make it more automated. It could be refactored,
but it just works. :wink:

  i suspected as much. :slight_smile:

> while later on, the mainline kernel source is checked out:
>
> if [ ! -f ./.git/config ] ; then
> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git .
>
> are those two repos not functionally equivalent? if not, what's the
> difference?
>
> also, the mainline kernel source is checked out as of tag v3.11-rc4,
> while that "EXTERNAL_TREE" is checked out based on an SHA -- what's
> the difference between them? "git diff" tells me that the difference
> is only a few hundred lines, so what does that represent?
>
> in the end, i don't need all the functionality of that script in the
> sense of being able to build a recipe file; i'm assuming that, if all
> i want is a compilable kernel source tree, i need only:
>
> * check out some appropriate kernel tree, then
> * apply all those patches

Correct..

  but i'm still unclear on the subtle difference between the
"EXTERNAL" tree mentioned above, and the mainstream linux kernel tree
at kernel.org. are those two kernel git repos -- the one at github,
and the one at kernel.org -- supposed to be equivalent? if so, why are
they both being used here?

> is that correct? so what is the minimal formula for getting a relevant
> kernel source tree? thanks.

run ./patch.sh :wink: and it'll generated one for you.. Once you run it
'once' you could even push that tree to your own private repo to
have your own personal .git tree..

  i did just to see the end result, but if i want to simplify all
that, again, i'd just want to check out a kernel source tree and apply
all those patches so, of the two kernel source trees mentioned above,
which one would i use and, again, what is the fundamental difference
between them?

  as a first attempt, i would simply:

  * check out tag "v3.11-rc4" from mainline source tree
  * apply patches

is there any more to it than that?

rday

p.s. i notice that there is a "tscadc" directory under "patches" that
isn't being processed by the patch.sh script. historical leftover?

  but i'm still unclear on the subtle difference between the
"EXTERNAL" tree mentioned above, and the mainstream linux kernel tree
at kernel.org. are those two kernel git repos -- the one at github,
and the one at kernel.org -- supposed to be equivalent? if so, why are
they both being used here?

They are the same, have the same objects behind it.. Maybe it was
changed last year when git.kernel was down, so at the time
github.linux was the only option and no one bothered to change it
back...

> is that correct? so what is the minimal formula for getting a relevant
> kernel source tree? thanks.

run ./patch.sh :wink: and it'll generated one for you.. Once you run it
'once' you could even push that tree to your own private repo to
have your own personal .git tree..

  i did just to see the end result, but if i want to simplify all
that, again, i'd just want to check out a kernel source tree and apply
all those patches so, of the two kernel source trees mentioned above,
which one would i use and, again, what is the fundamental difference
between them?

  as a first attempt, i would simply:

  * check out tag "v3.11-rc4" from mainline source tree
  * apply patches

is there any more to it than that?

Correct, although the patches also apply to rc7.. I think we are all
waiting for v3.12-rc1 to drop as usb is broken in the v3.11 branch..

p.s. i notice that there is a "tscadc" directory under "patches" that
isn't being processed by the patch.sh script. historical leftover?

or still experimental, every branch as a few 'testing' directories...

Regards,

ok, that would make sense, since the end result of running patch.sh
is that there is no difference between the kernel.org master branch,
and the master branch checked out from github.

rday

... snip ...

> i did just to see the end result, but if i want to simplify all
> that, again, i'd just want to check out a kernel source tree and
> apply all those patches so, of the two kernel source trees
> mentioned above, which one would i use and, again, what is the
> fundamental difference between them?
>
> as a first attempt, i would simply:
>
> * check out tag "v3.11-rc4" from mainline source tree
> * apply patches
>
> is there any more to it than that?

Correct, although the patches also apply to rc7.. I think we are
all waiting for v3.12-rc1 to drop as usb is broken in the v3.11
branch..

  so, to summarize what i'm going to try later to build a kernel for
my BBB (to make sure i'm not missing anything):

  * checkout kernel mainline tag v3.11-rc4 (although, as you suggest,
-rc7 would probably work just as well)
  * apply all patches here: https://github.com/beagleboard/kernel/tree/3.11/patches
  * use generated defconfig-mainline file as basis for .config
  * make

does that sound about right?

rday

  so, to summarize what i'm going to try later to build a kernel for
my BBB (to make sure i'm not missing anything):

  * checkout kernel mainline tag v3.11-rc4 (although, as you suggest,
-rc7 would probably work just as well)
  * apply all patches here: https://github.com/beagleboard/kernel/tree/3.11/patches
  * use generated defconfig-mainline file as basis for .config
  * make

does that sound about right?

Correct, and it 'should' boot with working mmc/ethernet...

If not, compare the config you built with, this one...
https://github.com/RobertCNelson/linux-dev/blob/am33x-v3.11/patches/defconfig

Regards,