Openmoko Bug #2325: adventures in building Qi on Debian armel

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Openmoko Bug #2325: adventures in building Qi on Debian armel

Openmoko Public Trac
#2325: adventures in building Qi on Debian armel
-----------------------------+----------------------------------------------
 Reporter:  pabs             |          Owner:  openmoko-kernel
     Type:  defect           |         Status:  new            
 Priority:  normal           |      Milestone:                
Component:  System Software  |        Version:                
 Severity:  normal           |       Keywords:  qi            
 Haspatch:  1                |      Blockedby:                
Estimated:                   |    Patchreview:                
 Blocking:                   |   Reproducible:                
-----------------------------+----------------------------------------------
 First try with a fresh checkout of master:

 {{{
 root@booph:~/devel/misc/qi (master)# make CPU=s3c6410 CROSS_PATH=
 CROSS_COMPILE= COMPILER_LIB_PATH_PRE= COMPILER_LIB_PATH=
 In file included from src/phase2.c:29:
 include/image.h:173: error: expected specifier-qualifier-list before
 'ulong'
 include/image.h:225: error: expected '=', ',', ';', 'asm' or
 '__attribute__' before 'genimg_get_image'
 include/image.h:228: error: expected declaration specifiers or '...'
 before 'ulong'
 include/image.h:228: error: expected declaration specifiers or '...'
 before 'ulong'
 include/image.h:292: error: expected '=', ',', ';', 'asm' or
 '__attribute__' before 'image_get_data'
 include/image.h:301: error: expected '=', ',', ';', 'asm' or
 '__attribute__' before 'image_get_image_end'
 include/image.h:337: error: expected declaration specifiers or '...'
 before 'ulong'
 include/image.h:340: error: expected '=', ',', ';', 'asm' or
 '__attribute__' before 'getenv_bootm_low'
 include/image.h:341: error: expected '=', ',', ';', 'asm' or
 '__attribute__' before 'getenv_bootm_size'
 include/image.h:342: error: expected declaration specifiers or '...'
 before 'ulong'
 include/image.h:362: error: expected '=', ',', ';', 'asm' or
 '__attribute__' before 'image_multi_count'
 include/image.h:363: error: expected declaration specifiers or '...'
 before 'ulong'
 include/image.h:364: error: expected declaration specifiers or '...'
 before 'ulong'
 include/image.h:364: error: expected declaration specifiers or '...'
 before 'ulong'
 src/phase2.c:34: error: expected declaration specifiers or '...' before
 'uint'
 src/phase2.c: In function 'try_this_kernel':
 src/phase2.c:457: error: too many arguments to function 'the_kernel'
 make: *** [src/phase2.o] Error 1
 }}}

 Ok, lets add ulong/uint/ushort manually to qi.h and rebuild...

 {{{
 root@booph:~/devel/misc/qi (master)# make CPU=s3c6410 CROSS_PATH=
 CROSS_COMPILE= COMPILER_LIB_PATH_PRE= COMPILER_LIB_PATH=
 cc1: warnings being treated as errors
 src/drivers/glamo-mmc.c: In function 'mmc_cmd':
 src/drivers/glamo-mmc.c:188: error: suggest parentheses around operand of
 '!' or change '&' to '&&' or '!' to '~'
 make: *** [src/drivers/glamo-mmc.o] Error 1
 }}}

 Ok, lets remove -Werror from the Makefile, that is never a good idea due
 to compilers getting stricter over time.

 {{{
 root@booph:~/devel/misc/qi (master)# make CPU=s3c6410 CROSS_PATH=
 CROSS_COMPILE= COMPILER_LIB_PATH_PRE= COMPILER_LIB_PATH=
 src/drivers/glamo-mmc.c: In function 'mmc_cmd':
 src/drivers/glamo-mmc.c:188: warning: suggest parentheses around operand
 of '!' or change '&' to '&&' or '!' to '~'
 make -C tools
 make[1]: Entering directory `/home/root/devel/misc/qi/tools'
 gcc -Wall    mkudfu.c   -o mkudfu
 make[1]: Leaving directory `/home/root/devel/misc/qi/tools'
 mkdir -p image
 src/fs/ext2.o: In function `ext2fs_read_inode':
 /home/root/devel/misc/qi/src/fs/ext2.c:235: undefined reference to
 `__aeabi_uidiv'
 /home/root/devel/misc/qi/src/fs/ext2.c:235: undefined reference to
 `__aeabi_uidivmod'
 src/fs/ext2.o: In function `ext2fs_read_file':
 /home/root/devel/misc/qi/src/fs/ext2.c:490: undefined reference to
 `__aeabi_uidiv'
 /home/root/devel/misc/qi/src/fs/ext2.c:490: undefined reference to
 `__aeabi_idiv'
 /home/root/devel/misc/qi/src/fs/ext2.c:490: undefined reference to
 `__aeabi_uidivmod'
 /home/root/devel/misc/qi/src/fs/ext2.c:490: undefined reference to
 `__aeabi_idivmod'
 make: *** [image/qi-s3c6410-master_36bb5c03756268ff.udfu] Error 1
 }}}

 Hmm, intarwebs say we need libgcc, which is installed:

 {{{
 root@booph:~/devel/misc/qi (master)# ls -l /usr/lib/gcc/*/*/libgcc.a
 -rw-r--r-- 1 root root 139K Nov  5 15:21 /usr/lib/gcc/arm-linux-
 gnueabi/4.3.4/libgcc.a
 -rw-r--r-- 1 root root 139K Nov  5 15:21 /usr/lib/gcc/arm-linux-
 gnueabi/4.3/libgcc.a
 -rw-r--r-- 1 root root 156K Dec 16 23:11 /usr/lib/gcc/arm-linux-
 gnueabi/4.4.2/libgcc.a
 -rw-r--r-- 1 root root 156K Dec 16 23:11 /usr/lib/gcc/arm-linux-
 gnueabi/4.4.3/libgcc.a
 -rw-r--r-- 1 root root 156K Dec 16 23:11 /usr/lib/gcc/arm-linux-
 gnueabi/4.4/libgcc.a
 root@booph:~/devel/misc/qi (master)# gcc --version
 gcc (Debian 4.4.2-5) 4.4.2
 Copyright (C) 2009 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.

 }}}

 Aha, we need the right dir in COMPILER_LIB_PATH...

 {{{
 # make CPU=s3c6410 CROSS_PATH= CROSS_COMPILE= COMPILER_LIB_PATH_PRE=
 COMPILER_LIB_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4/mkdir -p image
 ===> DFU Trailer information:
 Trailer Vers.:  1
 Trailer Length: 16
 VendorID:       0x1d50
 ProductID:      0x5119
 HW Revision:    0x0350
 }}}

 Now lets try the next CPU:

 {{{
 root@booph:~/devel/misc/qi (master)# make clean && make CPU=s3c2442
 CROSS_PATH= CROSS_COMPILE= COMPILER_LIB_PATH_PRE=
 COMPILER_LIB_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4/
 make[1]: Entering directory `/home/root/devel/misc/qi/tools'
 make[1]: Leaving directory `/home/root/devel/misc/qi/tools'
 src/drivers/glamo-mmc.c: In function 'mmc_cmd':
 src/drivers/glamo-mmc.c:188: warning: suggest parentheses around operand
 of '!' or change '&' to '&&' or '!' to '~'
 src/cpu/s3c2442/s3c24xx-mci.c:362: error: expected '=', ',', ';', 'asm' or
 '__attribute__' before 'rca'
 src/cpu/s3c2442/s3c24xx-mci.c: In function 's3c24xx_mmc_init':
 src/cpu/s3c2442/s3c24xx-mci.c:539: error: 'rca' undeclared (first use in
 this function)
 src/cpu/s3c2442/s3c24xx-mci.c:539: error: (Each undeclared identifier is
 reported only once
 src/cpu/s3c2442/s3c24xx-mci.c:539: error: for each function it appears
 in.)
 make: *** [src/cpu/s3c2442/s3c24xx-mci.o] Error 1
 }}}

 Hmm, time to define u_int*_t in qi.h...

 {{{
 root@booph:~/devel/misc/qi (master)# make clean && make CPU=s3c2442
 CROSS_PATH= CROSS_COMPILE= COMPILER_LIB_PATH_PRE=
 COMPILER_LIB_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4/
 make[1]: Entering directory `/home/root/devel/misc/qi/tools'
 make[1]: Leaving directory `/home/root/devel/misc/qi/tools'
 src/drivers/glamo-mmc.c: In function 'mmc_cmd':
 src/drivers/glamo-mmc.c:188: warning: suggest parentheses around operand
 of '!' or change '&' to '&&' or '!' to '~'
 make -C tools
 make[1]: Entering directory `/home/root/devel/misc/qi/tools'
 gcc -Wall    mkudfu.c   -o mkudfu
 make[1]: Leaving directory `/home/root/devel/misc/qi/tools'
 mkdir -p image
 ===> DFU Trailer information:
 Trailer Vers.:  1
 Trailer Length: 16
 VendorID:       0x1d50
 ProductID:      0x5119
 HW Revision:    0x0350
 }}}

 Now onto the last CPU...

 {{{
 root@booph:~/devel/misc/qi (master)# make clean && make CPU=s3c2410
 CROSS_PATH= CROSS_COMPILE= COMPILER_LIB_PATH_PRE=
 COMPILER_LIB_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4/
 make[1]: Entering directory `/home/root/devel/misc/qi/tools'
 make[1]: Leaving directory `/home/root/devel/misc/qi/tools'
 src/drivers/glamo-mmc.c: In function 'mmc_cmd':
 src/drivers/glamo-mmc.c:188: warning: suggest parentheses around operand
 of '!' or change '&' to '&&' or '!' to '~'
 make -C tools
 make[1]: Entering directory `/home/root/devel/misc/qi/tools'
 gcc -Wall    mkudfu.c   -o mkudfu
 make[1]: Leaving directory `/home/root/devel/misc/qi/tools'
 mkdir -p image
 ===> DFU Trailer information:
 Trailer Vers.:  1
 Trailer Length: 16
 VendorID:       0x1457
 ProductID:      0x5119
 HW Revision:    0x0240
 }}}

 Nice, it finally built. Patch attached for the minor changes to fix the
 above and another to add a short note about how to build without a cross-
 compiler. The later could probably do with how to

 It would be nice if the Qi build system could automatically detect the
 right -L when building on armel with the native GCC.

--
Ticket URL: <https://docs.openmoko.org/trac/ticket/2325>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac
Reply | Threaded
Open this post in threaded view
|

Re: Openmoko Bug #2325: adventures in building Qi on Debian armel

Openmoko Public Trac
#2325: adventures in building Qi on Debian armel
-----------------------------+----------------------------------------------
 Reporter:  pabs             |          Owner:  openmoko-kernel
     Type:  defect           |         Status:  new            
 Priority:  normal           |      Milestone:                
Component:  System Software  |        Version:                
 Severity:  normal           |       Keywords:  qi            
 Haspatch:  1                |      Blockedby:                
Estimated:                   |    Patchreview:                
 Blocking:                   |   Reproducible:                
-----------------------------+----------------------------------------------

Comment(by pabs):

 I was also able to boot both Debian and SHR fine after using
 flash_eraseall and nandwrite to write the GTA02 image to /dev/mtd1.

--
Ticket URL: <https://docs.openmoko.org/trac/ticket/2325#comment:1>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac
Reply | Threaded
Open this post in threaded view
|

Re: Openmoko Bug #2325: adventures in building Qi on Debian armel

Openmoko Public Trac
In reply to this post by Openmoko Public Trac
#2325: adventures in building Qi on Debian armel
--------------------------------+-------------------------------------------
    Reporter:  pabs             |        Owner:  openmoko-kernel
        Type:  defect           |       Status:  closed        
    Priority:  normal           |    Milestone:                
   Component:  System Software  |      Version:                
    Severity:  normal           |   Resolution:  fixed          
    Keywords:  qi               |     Haspatch:  1              
   Blockedby:                   |    Estimated:                
 Patchreview:                   |     Blocking:                
Reproducible:                   |  
--------------------------------+-------------------------------------------
Changes (by PaulFertser):

  * status:  new => closed
  * resolution:  => fixed


Comment:

 Thanks for reporting.

 Fixed in HEAD. I did it a little bit differently, hope you're ok with
 that :)

 (FYI: the warning wasn't bogus)

--
Ticket URL: <https://docs.openmoko.org/trac/ticket/2325#comment:2>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac
Reply | Threaded
Open this post in threaded view
|

Re: Openmoko Bug #2325: adventures in building Qi on Debian armel

Openmoko Public Trac
In reply to this post by Openmoko Public Trac
#2325: adventures in building Qi on Debian armel
--------------------------------+-------------------------------------------
    Reporter:  pabs             |        Owner:  openmoko-kernel
        Type:  defect           |       Status:  closed        
    Priority:  normal           |    Milestone:                
   Component:  System Software  |      Version:                
    Severity:  normal           |   Resolution:  fixed          
    Keywords:  qi               |     Haspatch:  1              
   Blockedby:                   |    Estimated:                
 Patchreview:                   |     Blocking:                
Reproducible:                   |  
--------------------------------+-------------------------------------------

Comment(by pabs):

 Your version looks better, thanks.

 Could you also remove the -Werror flag? It will probably cause FTBFS bugs
 if GCC is updated and gets more whiny as is usually the case for newer
 versions of GCC.

--
Ticket URL: <https://docs.openmoko.org/trac/ticket/2325#comment:3>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac
Reply | Threaded
Open this post in threaded view
|

Re: Openmoko Bug #2325: adventures in building Qi on Debian armel

Openmoko Public Trac
In reply to this post by Openmoko Public Trac
#2325: adventures in building Qi on Debian armel
--------------------------------+-------------------------------------------
    Reporter:  pabs             |        Owner:  openmoko-kernel
        Type:  defect           |       Status:  closed        
    Priority:  normal           |    Milestone:                
   Component:  System Software  |      Version:                
    Severity:  normal           |   Resolution:  fixed          
    Keywords:  qi               |     Haspatch:  1              
   Blockedby:                   |    Estimated:                
 Patchreview:                   |     Blocking:                
Reproducible:                   |  
--------------------------------+-------------------------------------------

Comment(by PaulFertser):

 Well, it's the warning that helped to catch the error in handling a
 flag. I'm not sure i want to remove -Werror though i understand your
 reasoning.

--
Ticket URL: <https://docs.openmoko.org/trac/ticket/2325#comment:4>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac
Reply | Threaded
Open this post in threaded view
|

Re: Openmoko Bug #2325: adventures in building Qi on Debian armel

Openmoko Public Trac
In reply to this post by Openmoko Public Trac
#2325: adventures in building Qi on Debian armel
--------------------------------+-------------------------------------------
    Reporter:  pabs             |        Owner:  openmoko-kernel
        Type:  defect           |       Status:  closed        
    Priority:  normal           |    Milestone:                
   Component:  System Software  |      Version:                
    Severity:  normal           |   Resolution:  fixed          
    Keywords:  qi               |     Haspatch:  1              
   Blockedby:                   |    Estimated:                
 Patchreview:                   |     Blocking:                
Reproducible:                   |  
--------------------------------+-------------------------------------------

Comment(by lindi):

 Did you nandwrite the udfu image or the one without udfu in the name?

 Not sure if it helps anybody but I build a cross-compiler with

 {{{
 # debian lenny
 # i386
 # normal user (with sudo access)

 mkdir armel-cross
 cd armel-cross/

 sudo aptitude install dpkg-cross apt-cross fakeroot dpatch gawk flex
 realpath automake1.7 debhelper cdbs
 apt-get source gcc-4.2 binutils glibc

 cd binutils-2.18.1~cvs20080103/
 TARGET=arm-linux-gnueabi fakeroot debian/rules binary-cross
 sudo dpkg -i ../binutils-arm-linux-gnueabi_2.18.1~cvs20080103-7_i386.deb
 cd ..

 apt-cross -a armel -v -i libdb1-compat
 apt-cross -a armel -v -i libc6
 apt-cross -a armel -v -i libc6-dev
 apt-cross -a armel -v -i linux-libc-dev

 cd gcc-4.2-4.2.4/
 export GCC_TARGET=armel
 debian/rules control
 dpkg-buildpackage -b -rfakeroot
 sudo dpkg -i ../libstdc++6-4.2-dev-armel-cross_4.2.4-6_all.deb  ../gcc-4.2
 -arm-linux-gnueabi_4.2.4-6_i386.deb ../gcc-4.2-arm-linux-gnueabi-
 base_4.2.4-6_i386.deb  ../g++-4.2-arm-linux-gnueabi_4.2.4-6_i386.deb
 ../cpp-4.2-arm-linux-gnueabi_4.2.4-6_i386.deb ../libstdc++6-armel-
 cross_4.2.4-6_all.deb
 cd ..

 cd ..
 }}}

 and then built Qi with

 {{{
 sudo aptitude install uboot-mkimage
 git clone git://git.openmoko.org/git/qi
 cd qi
 make CPU=s3c2442 CROSS_COMPILE=arm-linux-gnueabi-
 COMPILER_LIB_PATH_PRE=/usr/lib/gcc/arm-linux-gnueabi
 dfu-util -a u-boot -R -U backup.udfu
 dfu-util -a u-boot -R -D image/qi-s3c2442-master_36bb5c03756268ff.udfu
 }}}

--
Ticket URL: <https://docs.openmoko.org/trac/ticket/2325#comment:5>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac