oasislinux / oasis

a small statically-linked linux system
Other
2.75k stars 84 forks source link

Update the instructions for building the kernel #40

Closed iamthenoname closed 2 years ago

iamthenoname commented 2 years ago

Following the instructions in the wiki as-is, I got this error after pulling in the patches:

(chroot) # git pull --no-edit https://github.com/oasislinux/oasis
remote: Enumerating objects: 20966, done.
remote: Counting objects: 100% (4620/4620), done.
remote: Compressing objects: 100% (2407/2407), done.
remote: Total 20966 (delta 2242), reused 3926 (delta 1682), pack-reused 16346
Receiving objects: 100% (20966/20966), 4.59 MiB | 4.41 MiB/s, done.
Resolving deltas: 100% (11562/11562), done.
From https://github.com/oasislinux/oasis
 * branch                      HEAD       -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

Using pull.ff only and pull.rebase false did not work;

(chroot) # git config pull.ff only
(chroot) # git pull --no-edit https://github.com/oasislinux/oasis
...
fatal: Not possible to fast-forward, aborting.
(chroot) # git config pull.rebase false
(chroot) # git pull --no-edit https://github.com/oasislinux/oasis
fatal: refusing to merge unrelated histories

Using pull.rebase true seems to run properly, until it runs into this error:

(chroot) # git config pull.rebase true
(chroot) # git pull --no-edit https://github.com/oasislinux/oasis
Auto-merging include/scsi/scsi_device.h
CONFLICT (content): Merge conflict in include/scsi/scsi_device.h
error: could not apply 06f81ea8ca09... [PATCH] scsi: remove volatile from scsi data
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 06f81ea8ca09... [PATCH] scsi: remove volatile from scsi data

Skipping it just brings up more errors like the one above

michaelforney commented 2 years ago

I'm a bit confused about what you're trying to do. I'm assuming you are in a git checkout of the linux kernel? The command you are running will try to merge the oasis source repository into the linux kernel, which doesn't make sense. They are separate repositories with no relation (that's what the error message fatal: refusing to merge unrelated histories is trying to tell you).

The Kernel page in the wiki says to merge the oasis kernel branch:

git pull --no-edit https://github.com/oasislinux/linux

I think you must have just accidentally used the wrong URL. It's a good idea to try to understand what the commands do in the documentation rather than blindly running them. But if you do blindly run them, make sure you run the right commands.

iamthenoname commented 2 years ago

Ah, sorry about that. I'll try to keep this in mind in the future. Thank you for replying

apprehensions commented 1 year ago
# git pull --no-edit https://github.com/oasislinux/linux
From https://github.com/oasislinux/linux
 * branch                HEAD       -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
# git pull --no-edit https://github.com/oasislinux/linux --rebase
From https://github.com/oasislinux/linux
 * branch                  HEAD       -> FETCH_HEAD
(Merge is not a valid attribute name: .gitattributes:11
Auto-merging .clang-format
CONFLICT (add/add): Merge conflict in .clang-format
Auto-merging .gitattributes
CONFLICT (add/add): Merge conflict in .gitattributes
...(45480 lines)
Auto-merging virt/kvm/pfncache.c
CONFLICT (add/add): Merge conflict in virt/kvm/pfncache.c
Auto-merging virt/kvm/vfio.c
CONFLICT (add/add): Merge conflict in virt/kvm/vfio.c
error: could not apply 58390c8ce1... Merge tag 'iommu-updates-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 58390c8ce1... Merge tag 'iommu-updates-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
michaelforney commented 1 year ago

What tag are you trying to merge the oasis branch into? I'm surprised to see those conflicts, since the oasis branch doesn't modify those files.

You can either:

  1. Figure out what's going on with the conflicts and resolve them yourself
  2. Use a kernel version in the 6.1 series
  3. Wait for me to merge a newer version
michaelforney commented 1 year ago

Ah, I see you used --rebase. I suggest using --no-rebase. Rebasing commits from years ago onto the latest kernel commits is not going to be very pleasant.

apprehensions commented 1 year ago

--no-rebase causes a unrelated histories error, and with the allow of unrelated histories, the conflict occurs.

I will later today try building against 6.3.1, as I was on the latest commit. I would really appreciate if the oasislinux/linux had been updated though.

michaelforney commented 1 year ago

If there is unrelated histories error, something is wrong. Regardless of the commit you're merging into, the oasis branch will share a common parent commit with it. Maybe you used the wrong repository URL somewhere, or cloned with --depth 1 or something (so git didn't actually have the common commit, so couldn't find it)?

apprehensions commented 1 year ago

Yeah I cloned with --depth 1 because both cloning and fetching patches (half way through, canceled) took almost 10 minutes.

apprehensions commented 1 year ago

Why can't you convert the oasis 'patches' to simply patch files, and have the user get the tarball sources? i have a pretty fast internet; and even so it's extremely slow and unrealistic to clone an entire repository with it's history required for yet another operation that needs the entire kernel sources for simply patching, which is gigabytes big.

apprehensions commented 1 year ago

consider the following:

HEAD is now at a83b81b7392d Linux 6.3.1
bash-5.1# git pull --no-edit https://github.com/oasislinux/linux --no-rebase
From https://github.com/oasislinux/linux
 * branch                      HEAD       -> FETCH_HEAD
Auto-merging Makefile
Auto-merging arch/x86/Makefile
Auto-merging certs/Makefile
Auto-merging certs/extract-cert.c
CONFLICT (content): Merge conflict in certs/extract-cert.c
Auto-merging lib/Makefile
Auto-merging scripts/Makefile.host
Auto-merging scripts/kconfig/Makefile
Auto-merging scripts/kconfig/mconf-cfg.sh
CONFLICT (content): Merge conflict in scripts/kconfig/mconf-cfg.sh
Auto-merging tools/lib/api/Makefile
Auto-merging tools/lib/subcmd/Makefile
Auto-merging tools/objtool/Makefile
CONFLICT (content): Merge conflict in tools/objtool/Makefile
Auto-merging tools/objtool/elf.c
Auto-merging tools/perf/Makefile.perf
Automatic merge failed; fix conflicts and then commit the result.