Kernel Newbies archive mirror
 help / color / mirror / Atom feed
From: Lucas Tanure <tanure@linux.com>
To: kernelnewbies <kernelnewbies@kernelnewbies.org>,
	linux-amlogic@lists.infradead.org
Subject: Better way to upstream a single-board computer?
Date: Tue, 13 Jun 2023 11:02:01 +0100	[thread overview]
Message-ID: <CAJX_Q+0Ei+6gueLBxnRsaqS8HeFPJC2UU1+k7rxd68Tdq1NyJg@mail.gmail.com> (raw)

Hi,

I have been trying to port Vim4 to Mainline for the past few weeks.
Downstream branch:
  https://github.com/khadas/linux/tree/khadas-vims-5.4.y

- First approach: The compatible string way
In that 5.4 branches, clean the device tree to the bare minimum to
have a serial console, sd-card mount and ethernet, and reduce the
kernel config to only build the necessary modules.
With those 2 in hand (minimum dts and config), I could port the
necessary drivers for which the dts have compatible strings. I did
manage to boot once a v6.3 kernel with that dts and config.
But it would hang a few seconds after booting the kernel. And after a
few days of trying to debug the problem without success, I decided to
move to another approach.

- Second approach: The fat patch
I compared a clean 5.4 branch and khadas 5.4 branch and generated a
big fat patch with around 2.5 million lines, where when applied to
clean 5.4, it would boot and work.
I started to chop the fat patch to remove stuff that did not need to
get vim4 working with only serial, ethernet and sd-card.
I managed to reduce to 1.3 million lines the fat patch, but after
that, things started to hang and crash, so I was unable to move on.
At this point, I realized that 5.4 khadas was actually an
Android12-5.4 branch with amlogic and khadas stuff.

- Thrid approch: The android fat patch
I am doing the same thing as the second approach but using an
android12-5.4-lts branch as the start, where the comparison shows me
only the amlogic and khadas changes made.
I am still going through this method, but it is promising. Right now,
I have the fat patch with 0.9 million lines.
My idea here is that when that fat patch becomes small enough, I can
apply it to a clean 5.4 (no Android) to work it out more. And when
that patch becomes something tinny, I could apply it on mainline,
adjusting for the kernel version jump.

- Fourth approach: The rebase way (On hold)
I could compare the android12-5.4-lts git log with the khandas-5.4 log
and start to cherry-pick patches to a clean 5.4 (no Android), but from
experience, I think that's going to take forever, and it would be very
hard to apply patches as they refer to an Android branch, not
mainline.

The intermediate goal is to have a patch on top of the mainline that
boots vim4, no matter how ugly. With that in hand, I can start
re-structuring and getting ready for upstream.

Now my question for the community:
Is there a better way to port a board to the mainline when you only
have an old kernel that boots?

Thanks
Lucas Tanure

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

                 reply	other threads:[~2023-06-13 10:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAJX_Q+0Ei+6gueLBxnRsaqS8HeFPJC2UU1+k7rxd68Tdq1NyJg@mail.gmail.com \
    --to=tanure@linux.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-amlogic@lists.infradead.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).