View previous topic :: View next topic |
Author |
Message |
Zeault n00b

Joined: 03 Aug 2019 Posts: 23 Location: New England, United States
|
Posted: Sun Jul 30, 2023 6:28 pm Post subject: [Solved] My custom linux headers ebuild doesn't work with... |
|
|
Hello,
I am trying to use crossdev to create a build environment to hack my ASUS routers. It uses a special kernel, but I was able to get the special headers.
I put the headers into a tarball stored on my machine and then created this short ebuild:
Code: | # Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# Short one-line description of this package.
DESCRIPTION="Linux headers for the kernel in my ASUS router"
# Homepage, not used by Portage directly but handy for developer reference
HOMEPAGE="https://www.asus.com/supportonly/rt-ac1200g/helpdesk_download/?model2Name=RT-AC1200G"
# Point to any required sources; these will be automatically downloaded by
# Portage.
RESTRICT="fetch"
#SRC_URI="file:///home/me/linux-headers-2.6.36.tar"
# I copied this stuff from one of the other linux headers ebuilds
ETYPE="headers"
H_SUPPORTEDARCH="alpha amd64 arc arm arm64 avr32 bfin cris frv hexagon hppa ia64 m32r m68k metag microblaze mips mn10300 openrisc ppc ppc64 s390 score sh sparc tile x86 xtensa"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
LICENSE="GPL-2"
SLOT="0"
#BDEPEND="
# app-arch/xz-utils
# dev-lang/perl"
S="${WORKDIR}"
src_unpack() {
cp "/home/me/router-project/${P}.tar" "${WORKDIR}"
tar -xf "${WORKDIR}/${P}.tar"
}
src_prepare() {
rm "${WORKDIR}/${P}.tar"
eapply_user
}
src_compile() {
return
}
src_install() {
cp -r "${WORKDIR}/usr" "${D}"
}
|
I know I buck some ebuild conventions, but I am not super experienced with bash and it appears to work correctly. When I do test runs of it, the headers are correctly copied to the /var/tmp/portage/sys-kernel/linux-headers-2.6.36/image directory. The image directory layout looks the same as the one produced by the official Gentoo linux headers ebuilds.
The problem comes when I run crossdev --kernel 2.6.36 -t armv7l-unknown-linux-musleabi. It finds my custom ebuild which I placed into my custom ebuilds repository. It builds everything fine until it gets to my linux headers. Then it fails to merge the headers due to file collisions.
Code: | >>> '/var/tmp/portage/cross-armv7l-unknown-linux-musleabi/linux-headers-2.6.36/temp/build.log'
* Messages for package cross-armv7l-unknown-linux-musleabi/linux-headers-2.6.36:
* This package will overwrite one or more files that may belong to other
* packages (see list below). You can use a command such as `portageq
* owners / <filename>` to identify the installed package that owns a
* file. If portageq reports that only one package owns a file then do
* NOT file a bug report. A bug report is only useful if it identifies at
* least two or more packages that are known to install the same file(s).
* If a collision occurs and you can not explain where the file came from
* then you should simply ignore the collision since there is not enough
* information to determine if a real problem exists. Please do NOT file
* a bug report at https://bugs.gentoo.org/ unless you report exactly
* which two packages install the same file(s). See
* https://wiki.gentoo.org/wiki/Knowledge_Base:Blockers for tips on how
* to solve the problem. And once again, please do NOT file a bug report
* unless you have completely understood the above message.
*
* Detected file collision(s):
*
* /usr/include/asm-generic/auxvec.h
* /usr/include/asm-generic/bitsperlong.h
* /usr/include/asm-generic/errno-base.h
* /usr/include/asm-generic/errno.h
* /usr/include/asm-generic/fcntl.h
* /usr/include/asm-generic/int-l64.h
* /usr/include/asm-generic/int-ll64.h
* /usr/include/asm-generic/ioctl.h
* /usr/include/asm-generic/ioctls.h
I omitted a bunch of lines for brevity
* /usr/include/asm/byteorder.h
* /usr/include/asm/errno.h
* /usr/include/asm/fcntl.h
* /usr/include/asm/ioctl.h
* /usr/include/asm/ioctls.h
* /usr/include/asm/ipcbuf.h
* /usr/include/asm/mman.h
* /usr/include/asm/msgbuf.h
* /usr/include/asm/param.h
* /usr/include/asm/poll.h
* /usr/include/asm/posix_types.h
* /usr/include/asm/ptrace.h
* /usr/include/asm/resource.h
* /usr/include/asm/sembuf.h
* /usr/include/asm/setup.h
* /usr/include/asm/shmbuf.h
* /usr/include/asm/sigcontext.h
* /usr/include/asm/siginfo.h
* /usr/include/asm/signal.h
* /usr/include/asm/socket.h
* /usr/include/asm/sockios.h
* /usr/include/asm/stat.h
* /usr/include/asm/statfs.h
* /usr/include/asm/swab.h
* /usr/include/asm/termbits.h
* /usr/include/asm/termios.h
* /usr/include/asm/types.h
* /usr/include/asm/unistd.h
*
* Searching all installed packages for file collisions...
*
* Press Ctrl-C to Stop
*
* sys-kernel/linux-headers-6.1:0::gentoo
* /usr/include/asm-generic/auxvec.h
* /usr/include/asm-generic/bitsperlong.h
* /usr/include/asm-generic/errno-base.h
* /usr/include/asm-generic/errno.h
* /usr/include/asm-generic/fcntl.h
* /usr/include/asm-generic/int-l64.h
* /usr/include/asm-generic/int-ll64.h
* /usr/include/asm-generic/ioctl.h
* /usr/include/asm-generic/ioctls.h
* /usr/include/asm-generic/ipcbuf.h
* /usr/include/asm-generic/mman-common.h
* /usr/include/asm-generic/mman.h
* /usr/include/asm-generic/msgbuf.h
* /usr/include/asm-generic/param.h
* /usr/include/asm-generic/poll.h
* /usr/include/asm-generic/posix_types.h
* /usr/include/asm-generic/resource.h
* /usr/include/asm-generic/sembuf.h
* /usr/include/asm-generic/setup.h
* /usr/include/asm-generic/shmbuf.h
*
* Package 'cross-armv7l-unknown-linux-musleabi/linux-headers-2.6.36' NOT
* merged due to file collisions. If necessary, refer to your elog
* messages for the whole content of the above message. |
So it looks like crossdev is trying to merge my ASUS linux headers with the host system instead of the target prefix. It thankfully stopped itself because it noticed the file collisions. The linux headers ebuilds in the official repository do not cause this problem so clearly the issue must be with my custom ebuild. Is there something I have overlooked when writing the ebuild? Or maybe it is a setting in my custom repository?
Thank you
Last edited by Zeault on Sun Jul 30, 2023 9:51 pm; edited 1 time in total |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55011 Location: 56N 3W
|
Posted: Sun Jul 30, 2023 8:16 pm Post subject: |
|
|
Zeault,
crossdev installs things to the build host. Its the cross toolchain.
You already have a set of linux-headers there.
You probably want the headers installed into your target root.
That would be Code: | armv7l-unknown-linux-musleabi-emerge =sys-kernel/linux-headers-2.6.36 |
You may need Code: | emerge-wrapper init -t armv7l-unknown-linux-musleabi | before that works. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
Zeault n00b

Joined: 03 Aug 2019 Posts: 23 Location: New England, United States
|
Posted: Sun Jul 30, 2023 9:49 pm Post subject: |
|
|
Whoops.
I reread the cross building article and I think I get it now. But why then do the headers from the official repository seem to "merge" just fine when installed thru crossdev? Does the kernel-2 eclass do some checking or something?
Also yes you nailed it with what I probably wanted. Thank you for these commands and advice. |
|
Back to top |
|
 |
|