Subject: netbsd4_beta2 custom kernel fails to build
To: None <netbsd-users@netbsd.org>
From: Jan Danielsson <jan.m.danielsson@gmail.com>
List: netbsd-users
Date: 08/01/2007 06:53:31
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Hello all,
I'm trying to follow instructions by Lubomir Sedlacik to build a
custom CGD enabled kernel for booting off a USB memory key. (I've made
very minor adjustments to better suite my system).
$ cd src/distrib/amd64/ramdisks
$ mkdir ramdisk-cgd
Now create src/distrib/amd64/ramdisks/ramdisk-cgd/Makefile:
- ---------------------------------------
BOOTMODEL= big
IMAGE= ramdisk-cgd.fs
IMAGESIZE= 3000k
MAKEDEVTARGETS= init
CRUNCHENV+= INIT_CHROOT=1
.include "${.CURDIR}/../common/Makefile.ramdisk"
MTREECONF+= ${.CURDIR}/mtree.local
MAKEFS_FLAGS+= -f 20
- ---------------------------------------
Create src/distrib/amd64/ramdisks/ramdisk-cgd/list:
- ---------------------------------------
PROG bin/dd
PROG bin/df
PROG bin/ps
PROG bin/pwd
PROG bin/rcmd
PROG bin/sync
PROG sbin/cgdconfig
PROG sbin/fdisk
PROG sbin/mbrlabel
PROG sbin/mount_ffs
PROG sbin/restore sbin/rrestore
PROG sbin/shutdown
PROG sbin/sysctl
PROG usr/bin/fstat
PROG usr/bin/less usr/bin/more
PROG usr/bin/tip
PROG usr/bin/vi
PROG usr/sbin/installboot
SPECIAL vi srcdir usr.bin/vi/build
LIBS libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lcrypt -lm -lz
- -lcrypto -lkvm
COPY ${CURDIR}/etc/fstab etc/fstab
COPY ${CURDIR}/etc/rc etc/rc
COPY ${CURDIR}/etc/rc.conf etc/rc.conf
COPY ${CURDIR}/etc/cgd/cgd.conf etc/cgd/cgd.conf
COPY ${CURDIR}/etc/cgd/fs etc/cgd/fs
- ---------------------------------------
Now, run:
$ mkdir -p etc/cgd
Create src/distrib/amd64/ramdisks/ramdisk-cgd/etc/fstab:
- ---------------------------------------
/dev/md0a / ffs rw,noatime,nodevmtime 0 0
/dev/cgd0a /encrypted ffs rw,noatime,nodevmtime,softdep 1 1
- ---------------------------------------
Create src/distrib/amd64/ramdisks/ramdisk-cgd/etc/rc:
- ---------------------------------------
#! /bin/sh
#
PATH=/sbin:/bin
. /etc/rc.conf
if [ -f /etc/cgd/cgd.conf ]; then
echo "Configuring CGD devices."
cgdconfig -C
fi
echo "Starting file system checks:"
fsck -p
echo "Mounting all filesystems..."
mount -a
echo "Setting sysctl variables:"
sysctl -w init.root=${chroot_mount}
exit 0
- ---------------------------------------
Create src/distrib/amd64/ramdisks/ramdisk-cgd/etc/rc.conf:
- ---------------------------------------
chroot_mount=/encrypted
- ---------------------------------------
Create src/distrib/amd64/ramdisks/ramdisk-cgd/etc/cgd/cgd.conf:
- ---------------------------------------
cgd0 /dev/wd0a /etc/cgd/fs
- ---------------------------------------
For now ...
$ touch etc/cgd/fs
Create src/distrib/amd64/ramdisks/ramdisk-cgd/mtree.local:
- ---------------------------------------
./cgd
./etc/cgd
./var/tmp mode=01777
- ---------------------------------------
Copy src/sys/arch/amd64/conf/GENERIC to
src/sys/arch/amd64/conf/GENERIC_GD, and update it with the following:
- ---------------------------------------
# Enable the hooks used for initializing the root memory-disk.
options MEMORY_DISK_HOOKS
options MEMORY_DISK_IS_ROOT # force root on memory disk
options MEMORY_DISK_SERVER=0 # no userspace memory disk support
options MEMORY_DISK_ROOT_SIZE=6000 # size of memory disk, in blocks
options MEMORY_RBFLAGS=0 # do not force single-user mode
pseudo-device md 1 # memory disk device
(ramdisk)
pseudo-device cgd 4 # cryptographic disk devices
- ---------------------------------------
Now update src/sbin/init/Makefile:
- ---------------------------------------
- -.ifdef SMALLPROG
+.if defined(SMALLPROG) && !defined(INIT_CHROOT)
- ---------------------------------------
And update src/distrib/amd64/instkernel/Makefile:
- ---------------------------------------
(before the for-loop)
.if defined(RAMDISK_SRC)
RAMDISKS+= RAMDISK_CUSTOM ${RAMDISK_SRC}
.endif
(after the for-loop)
.if defined(RAMDISK_KERNEL)
MDSETTARGETS+= ${RAMDISK_KERNEL} ${RAMDISK_CUSTOM} -
.endif
- ---------------------------------------
Finally run:
$ ./build.sh -U -V RAMDISK_KERNEL=GENERIC_CGD -V RAMDISK_SRC=ramdisk-cgd
release
This will work hard for a long while, and finally fail with something
along the line of:
- ---------------------------------------
[---]
mapped netbsd-INSTALL.tmp
copying image
/home/jan/usr/src/distrib/amd64/ramdisks/ramdisk/obj/ramdisk.fs into
netbsd-INSTALL.tmp
done copying image
exiting
nbmake: don't know how to make
/home/jan/usr/src/sys/arch/amd64/compile/obj/GENERIC_CGD/netbsd. Stop
- ---------------------------------------
What am I doing wrong?
- --
Kind regards,
Jan Danielsson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)
iD8DBQFGsBHLuPlHKFfKXTYRCl0CAJ9XdvrullSwsFc34vPNATKN7GWQdQCdFe/X
Ku27MMzNjajLDOTuTVxZsYY=
=gbJT
-----END PGP SIGNATURE-----