Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
problems in building evbearm7hf (Re: big-endian kernel fails to boot on Cubietruck)
Finally, I've found the real cause of the problem; my sd card is broken!
With a new sd card, both little- and big-endian kernels with -mtune flag
work properly. I'm so sorry for confusing you.
No problem at all, glad you found the issue!
Thank you so much! I'm very happy to have a nice big-endian environment!
I prepared patches to address these problems. Could I post them to this
mailing list? Or would it be better to send PRs?
Whatever is easier for you. For larger patches, PRs would be preferable,
but small things can just go via the list (as long as you keep an eye
on them and make sure they do not get lost/forgotten).
OK. Actually, these are small patches. I attached them below:
(1) build fails with STRIPFLAG=-s
With STRIPFLAG=-s in /etc/mk.conf, all userland binaries are installed
with -s flag. Since there is a trick that /usr/mdec/*.bin are built as
userland programs, installation fails with this flag. To avoid this,
ignore STRIPFLAG for /usr/mdec guys.
====
--- sys/arch/evbarm/stand/gzboot/Makefile.gzboot.orig 2015-07-14
12:49:29.000000000 +0900
+++ sys/arch/evbarm/stand/gzboot/Makefile.gzboot 2015-07-13
16:10:47.000000000 +0900
@@ -26,6 +26,7 @@
LIBC=
LIBCRTBEGIN=
LIBCRTEND=
+STRIPFLAG=
.PATH: ${EVBARM_STAND}/gzboot
.PATH: ${EVBARM_STAND}/board
====
(2) byte order of sshramdisk.fs is fixed to little endian
MACHINE_ARCH should be checked as it is for ramdisk.fs.
====
--- distrib/evbarm/instkernel/sshramdisk/Makefile.orig 2015-07-13
16:39:15.000000000 +0900
+++ distrib/evbarm/instkernel/sshramdisk/Makefile 2015-07-13
16:40:17.000000000 +0900
@@ -13,7 +13,11 @@
CRUNCHBIN= ramdiskbin
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${.CURDIR}/mtree.conf
+.if empty(MACHINE_ARCH:M*eb)
IMAGEENDIAN= le
+.else
+IMAGEENDIAN= be
+.endif
MAKEDEVTARGETS= ramdisk
IMAGEDEPENDS= ${CRUNCHBIN} \
dot.profile master.passwd sshd_config ssh_host_dsa_key \
====
(3) byte order of ffs partition in armv7.img can be wrong
As -B flag for makefs is missing, the byte order of ffs partition in
armv7.img become the same as host. For e.g., if you build evbearm7-eb
on amd64 box, the ffs partition become little endian. Since FFS_EI
option is disabled for Cubieboard/Cubietruck, a big-endian kernel
cannot mount the root partition. I've added -B option to the mkimage
script, and specified it explicitly for armv7.img.
====
--- distrib/utils/embedded/mkimage.orig 2015-07-13 17:54:01.000000000 +0900
+++ distrib/utils/embedded/mkimage 2015-07-13 18:01:02.000000000 +0900
@@ -84,7 +84,7 @@
usage() {
cat << EOF 1>&2
-Usage: $PROG -h <host-arch> [-bdmx] [-K <kerneldir>] [-S <srcdir>] [-D
<destdir>] [-c <custom-files-dir>] [-s <Mb size>] [<image>]
+Usage: $PROG -h <host-arch> [-bdmx] [-B <byte-order>] [-K <kerneldir>]
[-S <srcdir>] [-D <destdir>] [-c <custom-files-dir>] [-s <Mb size>]
[<image>]
-b Boot only, no sets loaded
-r root device kind (sd, wd, ld)
@@ -96,7 +96,7 @@
}
# First pass for options to get the host and src directories
-OPTS="K:D:S:bc:dh:mr:s:x"
+OPTS="B:D:K:S:bc:dh:mr:s:x"
while getopts "$OPTS" f
do
case $f in
@@ -127,11 +127,13 @@
xsets_p=false
minwrites=false
rootdev=ld
+endian=
OPTIND=1
while getopts "$OPTS" f
do
case $f in
+ B) endian="-B $OPTARG";;
D) release="$OPTARG";;
K) kernel="$OPTARG";;
S) ;;
@@ -193,7 +195,7 @@
if [ -z "${bootonly}" ]; then
echo ${bar} Populating ffs filesystem ${bar}
- ${MAKEFS} -r -N ${release}/etc -t ffs -rx \
+ ${MAKEFS} -rx ${endian} -N ${release}/etc -t ffs \
-O ${ffsoffset} \
-o d=4096,f=2048,b=16384 -b $((${extra}))m \
-F "$tmp/selected_sets" ${image} "${release}" "${mnt}"
--- etc/etc.evbarm/Makefile.inc.orig 2015-07-13 17:18:27.000000000 +0900
+++ etc/etc.evbarm/Makefile.inc 2015-07-13 17:53:35.000000000 +0900
@@ -13,6 +13,7 @@
.endfor
.if !empty(MACHINE_ARCH:M*eb)
+IMAGEENDIAN= be
# big endian boards
KERNEL_SETS.armv4+= IXM1200
EVBARM_BOARDS.xscale+= ADI_BRH
@@ -32,6 +33,7 @@
EVBARM_BOARDS.armv7+= HUMMINGBIRD_A31
EVBARM_BOARDS.armv7hf+= HUMMINGBIRD_A31
.else
+IMAGEENDIAN= le
# little endian boards
#EVBARM_BOARDS.armv4+= ARMADILLO210
#EVBARM_BOARDS.armv4+= ARMADILLO9
@@ -136,7 +138,7 @@
TOOL_MTREE=${TOOL_MTREE} \
HOST_SH=${HOST_SH} \
${HOST_SH} ${MKIMAGE} -x -h ${.TARGET:S/smp_//} -D ${DESTDIR} \
- -S ${NETBSDSRCDIR} ${MKI_OPTS.${.TARGET}} \
+ -S ${NETBSDSRCDIR} -B ${IMAGEENDIAN} ${MKI_OPTS.${.TARGET}} \
${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz
ARCHES.arm= armv4 xscale armv5t armv6 armv7
====
(4) $kernel environment variable in uEnv.txt is expanded by /bin/sh
It is not an environment variable for /bin/sh but for u-boot.
Escape it to avoid expansion in the building process.
====
--- distrib/utils/embedded/conf/armv7.conf.orig 2015-07-13
17:51:04.000000000 +0900
+++ distrib/utils/embedded/conf/armv7.conf 2015-07-13 17:51:21.000000000
+0900
@@ -45,7 +45,7 @@
populate_awin() {
cat >> "${mnt}/boot/uEnv.txt" << EOF
bootargs=root=ld0a console=${console}
-uenvcmd=mmc dev 0; mmc rescan; if test \$fdtfile =
sun7i-a20-cubieboard2.dtb; then setenv kernel netbsd-CUBIEBOARD2.ub;
elif test \$fdtfile = sun7i-a20-cubietruck.dtb; then setenv kernel
netbsd-CUBIETRUCK.ub; elif test \$fdtfile = sun6i-a31-hummingbird.dtb;
then setenv kernel netbsd-HUMMINGBIRD_A31.ub; elif test \$fdtfile =
sun7i-a20-bananapi.dtb; then setenv kernel netbsd-BPI.ub; fi; fatload
mmc 0:1 82000000 ${kernel}; bootm 82000000
+uenvcmd=mmc dev 0; mmc rescan; if test \$fdtfile =
sun7i-a20-cubieboard2.dtb; then setenv kernel netbsd-CUBIEBOARD2.ub;
elif test \$fdtfile = sun7i-a20-cubietruck.dtb; then setenv kernel
netbsd-CUBIETRUCK.ub; elif test \$fdtfile = sun6i-a31-hummingbird.dtb;
then setenv kernel netbsd-HUMMINGBIRD_A31.ub; elif test \$fdtfile =
sun7i-a20-bananapi.dtb; then setenv kernel netbsd-BPI.ub; fi; fatload
mmc 0:1 82000000 \$kernel; bootm 82000000
EOF
}
====
Thanks,
Rin
Home |
Main Index |
Thread Index |
Old Index