NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Failing to build a bootable custom kernel



Whoops! I messed up formatting, here's the same message but formatted
(and some small grammar fixes)

Hey, I'm trying to build a custom kernel so that I can debug it over
real and virtualized systems (i.e., use kdb on real hardware and gdb
in qemu).

My custom kernel has the following configuration

```
 $ tail -n 9 path/to/netbsd/src/sys/arch/amd64/conf/DEBUG_KERNEL
# Debug Options options DDB
Hey,

I'm trying to build a custom kernel so that I am able to debug it over real
and virtualized systems (i.e., use kdb on real hardware and gdb in qemu).

My custom kernel has the following configuration

```
$ tail -n 9 path/to/netbsd/src/sys/arch/amd64/conf/DEBUG_KERNEL

# Debug Options
options     DDB            # in-kernel debugger
options     DDB_HISTORY_SIZE=1000    # enable history editing
options     KGDB        # remote debugger
options     KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
makeoptions    DEBUG="-g3"    # compile full symbol table

# Pull in optional local configuration - always at end
cinclude    "arch/amd64/conf/GENERIC.local"
```

The layout of my directory looks like where `src` is the checked out
repository

```
netbsd/
├── obj/
│   ├── destdir/
│   └── releasedir/
├── Run.sh
└── src/
    ├── bin/
    └── ...
```

To compile, I have been using `Run.sh` file contains:

```
#!/usr/bin/

export DESTDIR=/home/jared/Projects/netbsd/obj/destdir
export RELEASEDIR=/home/jared/Projects/netbsd/obj/releasedir

cd src/
./build.sh -u -O ../obj -U -m amd64 -N3 -j24 release kernel=DEBUG_KERNEL
./build.sh -u -O ../obj -U -m amd64 -N3 -j24
install=/home/jared/Projects/netbsd/obj/destdir
```

which yields the following error


```
nbmake[1]: stopped in /home/jared/Projects/netbsd/src/etc

nbmake: stopped in /home/jared/Projects/netbsd/src

ERROR: Failed to make release

*** BUILD ABORTED ***

ERROR: -E must be set for install as an unprivileged user
```

which I remedied by updating `Run.sh` to:

```
#!/usr/bin/

export DESTDIR=/home/jared/Projects/netbsd/obj/destdir
export RELEASEDIR=/home/jared/Projects/netbsd/obj/releasedir

cd src/
./build.sh -u -O ../obj -U -m amd64 -N3 -j24 release kernel=DEBUG_KERNEL
./build.sh -u -O ../obj -U - -E m amd64 -N3 -j24
install=/home/jared/Projects/netbsd/obj/destdir
```

which then yields the following error

```
[ same error repeated ]
pax: Unable to copy
/home/jared/Projects/netbsd/obj/destdir/./usr/share/tmac/mm/se_ms.cov,
file would overwrite itself
pax: Unable to copy
/home/jared/Projects/netbsd/obj/destdir/./var/db/obsolete/text, file
would overwrite itself

*** Failed target:  installsets
*** Failed command: cd /home/jared/Projects/netbsd/src/distrib/sets &&
DESTDIR=/home/jared/Projects/netbsd/obj/destdir MACHINE=amd64
MACHINE_ARCH=x86_64
AWK=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbawk
CKSUM=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbcksum
DB=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbdb
EGREP=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbgrep\
-E HOST_SH=/usr/bin/sh
MAKE=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmake
MKTEMP=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmktemp
MTREE=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmtree
PAX=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbpax
COMPRESS_PROGRAM=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbxz
GZIP=-n XZ_OPT=-9 TAR_SUFF=tar.xz
PKG_CREATE=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbpkg_create
SED=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbsed
TSORT=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbtsort\
-q /usr/bin/sh ./maketars -d /home/jared/Projects/netbsd/obj/destdir
-M /home/jared/Projects/netbsd/obj/destdir/METALOG.sanitised -N
/home/jared/Projects/netbsd/src/etc -L base -i
/home/jared/Projects/netbsd/obj/destdir
*** Error code 10

Stop.
nbmake[1]: stopped in /home/jared/Projects/netbsd/src/distrib/sets

*** Failed target:  installworld
*** Failed command: _makedirtarget() { dir="$1"; shift; target="$1";
shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .)
this=""; real="/home/jared/Projects/netbsd/src" ;; *) this="${dir}/";
real="/home/jared/Projects/netbsd/src/${dir}" ;; esac;
show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: $@)}"; cd
"${real}" && /home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmake
_THISDIR_="${this}" "$@" ${target}; }; _makedirtarget distrib/sets
installsets INSTALLDIR=/home/jared/Projects/netbsd/obj/destdir
INSTALLSETS=
*** Error code 1

Stop.
nbmake: stopped in /home/jared/Projects/netbsd/src

ERROR: Failed to make installworld to /home/jared/Projects/netbsd/obj/destdir

*** BUILD ABORTED ***
```

Any advice is welcome

On Sun, Apr 7, 2024 at 5:52 PM Jared Barnak <jared.j.barnak%gmail.com@localhost> wrote:
>
> Hey, I'm trying to build a custom kernel so that I am to debug it over real and virtualized systems (i.e., use kdb on real hardware and gdb in qemu). My custom kernel has the following configuration ``` $ tail -n 9 path/to/netbsd/src/sys/arch/amd64/conf/DEBUG_KERNEL # Debug Options options DDB # in-kernel debugger options DDB_HISTORY_SIZE=1000 # enable history editing options KGDB # remote debugger options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600 makeoptions DEBUG="-g3" # compile full symbol table # Pull in optional local configuration - always at end cinclude "arch/amd64/conf/GENERIC.local" ``` The layout of my directory looks like where `src` is the checked out repository ``` netbsd/ ├── obj/ │ ├── destdir/ │ └── releasedir/ ├── Run.sh └── src/ ├── bin/ └── ... ``` To compile, I have been using `Run.sh` file contains: ``` #!/usr/bin/ export DESTDIR=/home/jared/Projects/netbsd/obj/destdir export RELEASEDIR=/home/jared/Projects/netbsd/obj/releasedir cd src/ ./build.sh -u -O ../obj -U -m amd64 -N3 -j24 release kernel=DEBUG_KERNEL ./build.sh -u -O ../obj -U -m amd64 -N3 -j24 install=/home/jared/Projects/netbsd/obj/destdir ``` which yields the following error ``` nbmake[1]: stopped in /home/jared/Projects/netbsd/src/etc nbmake: stopped in /home/jared/Projects/netbsd/src ERROR: Failed to make release *** BUILD ABORTED *** ERROR: -E must be set for install as an unprivileged user ``` which I remedied by updating `Run.sh` to: ``` #!/usr/bin/ export DESTDIR=/home/jared/Projects/netbsd/obj/destdir export RELEASEDIR=/home/jared/Projects/netbsd/obj/releasedir cd src/ ./build.sh -u -O ../obj -U -m amd64 -N3 -j24 release kernel=DEBUG_KERNEL ./build.sh -u -O ../obj -U - -E m amd64 -N3 -j24 install=/home/jared/Projects/netbsd/obj/destdir ``` which then yields the following error ``` [ same error repeated ] pax: Unable to copy /home/jared/Projects/netbsd/obj/destdir/./usr/share/tmac/mm/se_ms.cov, file would overwrite itself pax: Unable to copy /home/jared/Projects/netbsd/obj/destdir/./var/db/obsolete/text, file would overwrite itself *** Failed target: installsets *** Failed command: cd /home/jared/Projects/netbsd/src/distrib/sets && DESTDIR=/home/jared/Projects/netbsd/obj/destdir MACHINE=amd64 MACHINE_ARCH=x86_64 AWK=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbawk CKSUM=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbcksum DB=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbdb EGREP=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbgrep\ -E HOST_SH=/usr/bin/sh MAKE=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmake MKTEMP=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmktemp MTREE=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmtree PAX=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbpax COMPRESS_PROGRAM=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbxz GZIP=-n XZ_OPT=-9 TAR_SUFF=tar.xz PKG_CREATE=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbpkg_create SED=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbsed TSORT=/home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbtsort\ -q /usr/bin/sh ./maketars -d /home/jared/Projects/netbsd/obj/destdir -M /home/jared/Projects/netbsd/obj/destdir/METALOG.sanitised -N /home/jared/Projects/netbsd/src/etc -L base -i /home/jared/Projects/netbsd/obj/destdir *** Error code 10 Stop. nbmake[1]: stopped in /home/jared/Projects/netbsd/src/distrib/sets *** Failed target: installworld *** Failed command: _makedirtarget() { dir="$1"; shift; target="$1"; shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .) this=""; real="/home/jared/Projects/netbsd/src" ;; *) this="${dir}/"; real="/home/jared/Projects/netbsd/src/${dir}" ;; esac; show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: $@)}"; cd "${real}" && /home/jared/Projects/netbsd/src/../obj/tooldir.Linux-6.1.0-1036-oem-x86_64/bin/nbmake _THISDIR_="${this}" "$@" ${target}; }; _makedirtarget distrib/sets installsets INSTALLDIR=/home/jared/Projects/netbsd/obj/destdir INSTALLSETS= *** Error code 1 Stop. nbmake: stopped in /home/jared/Projects/netbsd/src ERROR: Failed to make installworld to /home/jared/Projects/netbsd/obj/destdir *** BUILD ABORTED *** ``` Any advice is welcome


Home | Main Index | Thread Index | Old Index