From owner-freebsd-ppc@FreeBSD.ORG Sun Jan 27 14:34:33 2013 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6F9F61ED for ; Sun, 27 Jan 2013 14:34:33 +0000 (UTC) (envelope-from adutkowski@gmail.com) Received: from mail-ob0-f179.google.com (mail-ob0-f179.google.com [209.85.214.179]) by mx1.freebsd.org (Postfix) with ESMTP id 40C9F288 for ; Sun, 27 Jan 2013 14:34:32 +0000 (UTC) Received: by mail-ob0-f179.google.com with SMTP id un3so1992555obb.10 for ; Sun, 27 Jan 2013 06:34:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=GLDjWTyFJ9FQAM4QirPUTiXEiMWj80u7HWMJsle93Ps=; b=ASRleTBGrBjWMzY71hh9uae1wgFJjacVDqPhbuCZwCqV5Pp4GGfZkOcwMlNKcJ9i7f H3BRPjB5v2GgAJsn7wbVTKLp4HMkx3oNxBo6CW5v9FqHm84Kkmt3HQVrIufdMeUjJoZv PSxCQ32ZkSl9ghdA7QrhvEE//7yuKgB9T1Oc7/yh0ojAcVnZiEg+x9tN2QLjQ1iwL5qH 5TJxj7BC2PY8ZE/AQ0ttwf57sr/8dOEdwYUKtcyUSxEyhog749tBIA3gjpvcg6aY/3xO QhSzUFlj2tzwng7CiKKv5CFFp0ZMsRyVe9pM+D4+65xUIho9oo/4EioGCzZ7m24HBDhV FAcQ== MIME-Version: 1.0 X-Received: by 10.60.30.42 with SMTP id p10mr8974550oeh.59.1359297272443; Sun, 27 Jan 2013 06:34:32 -0800 (PST) Sender: adutkowski@gmail.com Received: by 10.76.135.103 with HTTP; Sun, 27 Jan 2013 06:34:32 -0800 (PST) In-Reply-To: References: <51027F6C.7090403@semihalf.com> Date: Sun, 27 Jan 2013 15:34:32 +0100 X-Google-Sender-Auth: y4yD64amsjgNX-k3_3SMGoVa464 Message-ID: Subject: Re: OpenFirmware issue on P1010 From: Aleksander Dutkowski To: freebsd-ppc@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2013 14:34:33 -0000 On Fri, Jan 25, 2013 at 1:49 PM, Zbyszek Bodek wrote: > Hello Aleksander, > > Please check my answer inline. > > > On 25.01.2013 13:10, Aleksander Dutkowski wrote: >> >> hi! >> >> I am porting FreeBSD on P1010RDB platform. I modified existing MPC85XX >> config (i.e. removed SMP), created p1010rdb.dts from p1020rdb.dts etc, >> and ran the kernel via u-boot: >> tftp 0x1000000 fbsd.elf >> go 0x10000e0 > > > Apart from other hints that you gave, are you trying to boot an elf file via > tftp command or this is in fact a .bin file (objcopied) but with the .elf > postfix ? Yes I am booting elf file. I am using readelf to find the offset of __start function. (in this case, offset is 0xe0). I was able to do the ame trick on BeagleBoard-xM and it worked perfectly, but I'll check the solution with raw binary. > > It is impossible to boot an elf file via tftpboot/go commands. If this is > what you are doing then try to create a bin file using objcopy (for powerpc) > and then boot. > > For example: > /obj/path/to/powerpc/objcopy -S -O binary /obj/path/to/powerpc/kernel > fbsd.bin > > Of course you should also extract the "kernel start address" to ensure that > you are executing (go) the bin file in a right way: > > /obj/path/to/powerpc/objdump -f /obj/path/to/powerpc/kernel > > And an additional thought - make sure that you are using statically embedded > dtb when booting directly from u-boot: > > options FDT_DTB_STATIC Yes, I am using statically embedded dtb :) > > >> >> Nothing happened, so I used CodeWarrior IDE with CW USB Tap, and it >> turned out, that OF_install() call in sys/powerpc/booke/machedp.c >> returns false. I inspected this function and moreover, I inspected the >> structure, which is pointer from set_ofw_set linker set: >> >> $ powerpc-rtems-objdump -s kernel | grep set_ofw_set >> Contents of section set_ofw_set: >> c03694f0 c037ab54 .7.T >> >> (gdb) p (ofw_def_t)*0xc037ab54 >> $1 = {name = 0xc03339a4 "ofw_fdt", methods = 0xc0319350, size = 0, >> baseclasses = 0x0, refs = 0, ops = 0x0} >> >> As we can se, name field is correct. But this function seems to fail >> in strcmp(). >> I have found the issue [1] on bugtracker, so Im quite sure, that the >> problem is ith linker sets on powerpc (but this issue is quite old now >> ;) ), but the fix is not working for me - it crashes while compiling: >> >> cc -c -O -pipe -std=c99 -Wa,-me500 -g -Wall -Wredundant-decls >> -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes >> -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign >> -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option >> -nostdinc -I. -I/usr/home/aleek/src/p1010-github/sys >> -I/usr/home/aleek/src/p1010-github/sys/contrib/altq >> -I/usr/home/aleek/src/p1010-github/sys/contrib/libfdt -D_KERNEL >> -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common >> -finline-limit=15000 --param inline-unit-growth=100 --param >> large-function-growth=1000 -msoft-float -Wa,-many >> -fno-omit-frame-pointer -msoft-float -mno-altivec -ffreestanding >> -fstack-protector -Werror >> /usr/home/aleek/src/p1010-github/sys/dev/ofw/openfirm.c >> cc1: warnings being treated as errors >> /usr/home/aleek/src/p1010-github/sys/dev/ofw/openfirm.c: In function >> 'OF_install': >> /usr/home/aleek/src/p1010-github/sys/dev/ofw/openfirm.c:126: warning: >> assignment from incompatible pointer type >> /usr/home/aleek/src/p1010-github/sys/dev/ofw/openfirm.c:126: warning: >> comparison of distinct pointer types lacks a cast >> >> Do you have any idea, how to fix this? >> >> >> >> [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=140241 >> > > Sorry to ignore the rest of your observations at the moment but I wanted to > make sure that everything is OK with the running process. > > Best regards and good luck > Zbyszek Bodek -- regards aleek