0
lnsider

Compiling new kernel on HB

Recommended Posts

Hi Igor,

I want to compile a new kernel on HB.

 

I do following steps:

export ARCH=arm
export CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
make imx_v7_cbi_hb_defconfig
make

If make is in process, I become an error:

/bin/sh: 1: /usr/bin/arm-linux-gnueabihf-ld: not found
make[1]: *** [init/mounts.o] Error 127
make: *** [init] Error 2

how can I fix that?

Share this post


Link to post
Share on other sites

humm.

 

my guess your Armbian tool environment is not setup properly

 

a recent install gives

root@d1dfc6648c59:/# file /usr/bin/arm-linux-gnueabihf-ld
/usr/bin/arm-linux-gnueabihf-ld: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=481a5f6210c1256f352b9751f669265f81f90885, stripped

so /usr/bin/arm-linux-gnueabihf-ld file exists.

 

try to start a fresh install

http://www.armbian.com/using-armbian-tools/

Share this post


Link to post
Share on other sites

Huh, you want to compile natively, on Hummingboard?

 

Than you leave CROSS_COMPILE out and only type:

 

make ARCH=arm 

 

But that's just a start.

Share this post


Link to post
Share on other sites

Huh, you want to compile natively, on Hummingboard?

 

Than you leave CROSS_COMPILE out and only type:

 

make ARCH=arm 

 

But that's just a start.

What are you meaning with "just a start"?

Share this post


Link to post
Share on other sites

That means this is as start of the process. Usually you need to issue also: make modules and make modules_install make dtbs

 

When done - if compilation succeeded - you need to copy zImage, modules and DTBS to proper location.

Share this post


Link to post
Share on other sites

Hi Igor,

 

I made everything as you told, but further "Uncompressing Linux... done, booting the kernel" hummingboard will not load.

U-Boot SPL 2013.10-rc4-sun7i (Oct 11 2015 - 20:45:45)
Boot Device: SD1
spl: error reading image u-boot.img, err - -1
Load image from RAW...


U-Boot 2013.10-rc4-sun7i (Oct 11 2015 - 20:45:45)

CPU:   Freescale i.MX6SOLO rev1.1 at 792 MHz
Reset cause: POR
Board: MX6-HummingBoard
DRAM:  512 MiB
MMC:   FSL_SDHC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   FEC [PRIME]
Hit any key to stop autoboot:  0 
mmc0 is current device
** File not found /boot.scr **
** File not found /uEnv.txt **
** File not found /zImage **
** File not found /uImage **
437 bytes read in 136 ms (2.9 KiB/s)
Running bootscript from mmc ...
## Executing script at 10800000
33295 bytes read in 332 ms (97.7 KiB/s)
6310896 bytes read in 469 ms (12.8 MiB/s)
Kernel image @ 0x12000000 [ 0x000000 - 0x604bf0 ]
## Flattened Device Tree blob at 18000000
   Booting using the fdt blob at 0x18000000
   Using Device Tree in place at 18000000, end 1800b20e

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Share this post


Link to post
Share on other sites

I don't see any problems ... there is no output to serial console, unless specified ... first boot takes little longer, so you need to wait 1-2min to get login prompt. One reboot is in the middle ... not any more in newer Jessie and Trusty builds.

 

Next edit and change console=ttymxc0,115200 and change loglevel to 7 in boot.cmd, convert to boot.scr ... 

 

Than you should see much more.

If you did not compile on X86 Ubuntu I can't say what went wrong :(

Share this post


Link to post
Share on other sites

Hi Igor,

 

new message:

U-Boot 2013.10-rc4-sun7i (Oct 11 2015 - 20:45:45)

CPU:   Freescale i.MX6SOLO rev1.1 at 792 MHz
Reset cause: POR
Board: MX6-HummingBoard
DRAM:  512 MiB
MMC:   FSL_SDHC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   FEC [PRIME]
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found
Hit any key to stop autoboot:  0 
mmc0 is current device
64 bytes read in 111 ms (0 Bytes/s)
Running bootscript from mmc ...
## Executing script at 10800000
Wrong image format for "source" command
466 bytes read in 139 ms (2.9 KiB/s)
Running bootscript from mmc ...
## Executing script at 10800000
setenv - set environment variables

Usage:
setenv [-f] name value ...
    - [forcibly] set environment variable 'name' to 'value ...'
setenv [-f] name
    - [forcibly] delete environment variable 'name'
** File not found /boot/dtb/ **
6310896 bytes read in 469 ms (12.8 MiB/s)
Kernel image @ 0x12000000 [ 0x000000 - 0x604bf0 ]
## Flattened Device Tree blob at 18000000
   Booting using the fdt blob at 0x18000000
   reserving fdt memory region: addr=18000000 size=9000
   Using Device Tree in place at 18000000, end 1800bfff

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

I think the problem is 

** File not found /boot/dtb/ **

but why, I´ve copied all dtb´s to SD card

Compiled on Ubuntu x64

Share this post


Link to post
Share on other sites

If this parameter is not defined than it's usually not on the lowest number ... try to boot without or just add it after console parameter ...

console=ttymxc0,115200 loglevel=7 

Share this post


Link to post
Share on other sites

 

If this parameter is not defined than it's usually not on the lowest number ... try to boot without or just add it after console parameter ...

console=ttymxc0,115200 loglevel=7 

setenv bootargs root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=console=ttymxc0,115200 loglevel=7 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 rd.dm=0 rd.luks=0 rd.lvm=0 raid=noautodetect pci=nomsi ahci_imx.hotplug=1 con$
ext2load mmc 0 0x18000000 /boot/dtb//boot/dtb/${fdt_file}
ext2load mmc 0 0x12000000 /boot/zImage
bootz 0x12000000 - 0x18000000

defined, but the message is the same

Share this post


Link to post
Share on other sites
CPU:   Freescale i.MX6SOLO rev1.1 at 792 MHz

If you have a single core Hummingboard than this could be a problem. Those builds are designed and tested for dual and quad ... Ask Solidrun what to do in such case. The kernel which we use is more or less stock. I never study differences between single and dual/quad.

Share this post


Link to post
Share on other sites
setenv - set environment variables

Usage:
setenv [-f] name value ...
    - [forcibly] set environment variable 'name' to 'value ...'
setenv [-f] name
    - [forcibly] delete environment variable 'name'

This in u-boot output is actually an error message, most likely due to missing quotes around setenv second argument - kernel argument list is too long to leave it unquoted. You should quote kernel argument list in your boot script.

Also you shoud change double slash to single and fix path in dtb file path (there is a warning or error message about it too).

Also setenv line in your post doesn't look right with 'con$' argument at the end, please check if this is intended or copy-paste error.

Also serial console argument was wrong (console=console=...)

setenv bootargs "root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=ttymxc0,115200 loglevel=7 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 rd.dm=0 rd.luks=0 rd.lvm=0 raid=noautodetect pci=nomsi ahci_imx.hotplug=1"
ext2load mmc 0 0x18000000 /boot/dtb/${fdt_file}
ext2load mmc 0 0x12000000 /boot/zImage
bootz 0x12000000 - 0x18000000

Edit: Fixed path and serial console arguments.

 

@Igor

Serial console device name should be case-sensitive, are you sure that "ttymxc0" is all lowercase (just to be sure)?

Share this post


Link to post
Share on other sites
setenv - set environment variables

Usage:
setenv [-f] name value ...
    - [forcibly] set environment variable 'name' to 'value ...'
setenv [-f] name
    - [forcibly] delete environment variable 'name'

This in u-boot output is actually an error message, most likely due to missing quotes around setenv second argument - kernel argument list is too long to leave it unquoted. You should quote kernel argument list in your boot script.

Also you shoud change double slash to single and fix path in dtb file path (there is a warning or error message about it too).

Also setenv line in your post doesn't look right with 'con$' argument at the end, please check if this is intended or copy-paste error.

Also serial console argument was wrong (console=console=...)

setenv bootargs "root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=ttymxc0,115200 loglevel=7 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 rd.dm=0 rd.luks=0 rd.lvm=0 raid=noautodetect pci=nomsi ahci_imx.hotplug=1"
ext2load mmc 0 0x18000000 /boot/dtb/${fdt_file}
ext2load mmc 0 0x12000000 /boot/zImage
bootz 0x12000000 - 0x18000000

Edit: Fixed path and serial console arguments.

 

@Igor

Serial console device name should be case-sensitive, are you sure that "ttymxc0" is all lowercase (just to be sure)?

 

 

Copy-pasted your code and now hummingboard show me this:

File imx6dl-hummingboard.dtb is included.

U-Boot SPL 2013.10-rc4-sun7i (Oct 11 2015 - 20:45:45)
Boot Device: SD1
spl: error reading image u-boot.img, err - -1
Load image from RAW...


U-Boot 2013.10-rc4-sun7i (Oct 11 2015 - 20:45:45)

CPU:   Freescale i.MX6SOLO rev1.1 at 792 MHz
Reset cause: POR
Board: MX6-HummingBoard
DRAM:  512 MiB
MMC:   FSL_SDHC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   FEC [PRIME]
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found
Hit any key to stop autoboot:  0 
mmc0 is current device
** File not found /boot.scr **
** File not found /uEnv.txt **
** File not found /zImage **
** File not found /uImage **
412 bytes read in 141 ms (2 KiB/s)
Running bootscript from mmc ...
## Executing script at 10800000
invalid extent block
ext4fs_devread read outside partition 4294967120
** File not found /boot/dtb/imx6dl-hummingboard.dtb **
6310896 bytes read in 470 ms (12.8 MiB/s)
Kernel image @ 0x12000000 [ 0x000000 - 0x604bf0 ]
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
Booting from net ...
FEC Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY FEC
FEC Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY FEC
Booting uImage
## Booting kernel from Legacy Image at 10800000 ...
   Image Name:   
   Image Type:   ARM Linux Script (uncompressed)
   Data Size:    348 Bytes = 348 Bytes
   Load Address: 00000000
   Entry Point:  00000000
   Contents:
      Image 0: 340 Bytes = 340 Bytes
   Verifying Checksum ... OK
Wrong Image Type for bootm command
ERROR: can't get kernel image!
HummingBoard U-Boot > 

Share this post


Link to post
Share on other sites
invalid extent block
ext4fs_devread read outside partition 4294967120

Filesystem or partition table error?

** File not found /boot/dtb/imx6dl-hummingboard.dtb **
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
Booting from net ...

Is file "/boot/dtb/imx6dl-hummingboard.dtb" present?

Share this post


Link to post
Share on other sites

 

File imx6dl-hummingboard.dtb is included.

 

** File not found /boot/dtb/imx6dl-hummingboard.dtb **
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
Booting from net ...

Is file "/boot/dtb/imx6dl-hummingboard.dtb" present?

 

Yes

boot/dtb$ ls *hummingboard*
imx6dl-hummingboard2.dts  imx6dl-hummingboard.dtb  imx6dl-hummingboard.dts  imx6qdl-hummingboard2.dtsi  imx6qdl-hummingboard.dtsi  imx6q-hummingboard2.dts  imx6q-hummingboard.dtb  imx6q-hummingboard.dts

 

Filesystem or partition table error?

Good question....

Share this post


Link to post
Share on other sites

As far as quick google search results indicate, ext4 related code in some older u-boot versions is not 100% reliable in some circumstances.

 

@Igor

Is this the latest u-boot version for this device? If so, it maybe better to use fat boot partition with this u-boot version. Here even separate ext4 /boot partition will help avoiding this kind of issues.

 

@Insider

>Filesystem or partition table error?

Good question....

This was rhetorical question that usually summons @tkaiser in any thread related to possible sdcard errors :) . While it doesn't hurt to check your sdcard with f3 or some other tool, it's possible just a coincidence related to u-boot version and compiling kernel on the device itself.

Share this post


Link to post
Share on other sites

@zador

I would say the file system is corrupted due too many hard resets. There are zero reports that this particular u-boot had troubles reading ext FS.

 

@Insider

Second problem here is, that you are not using the same kernel source, not same configuration, not same after patches. I know it should be possible to boot but this raises new questions.

Share this post


Link to post
Share on other sites

@zador

I'm using the original u-boot, what is included also in Igor´s debian system

 

@Igor

Is this too difficult? Is there a simple solution like, using the right configuration, using right kernel source and else?

Share this post


Link to post
Share on other sites

I would say that filesystem is in unusual state for u-boot due to a large number of extents. Another link. While this patch is for older u-boot, @Insider's error message says "Invalid extent block".

Compiling kernel on a device creates enormous amount of small files, which can lead to filesystem fragmentation and creating more extents for files than usual.

Since it cannot be observed in any other "normal" use case scenario, there were no reports of this issue before.

 

@Igor

Problem here is with u-boot, not with kernel.

 

@Insider

If this is related to fs fragmentation, you may be even able to boot after you:

  • Delete kernel sources directory from your rootfs
  • Back up contents of /boot directory and delete all files from it on sdcard
  • Run ext4defrag on your rootfs to get rid of any fragmentation issues
  • Restore backed up files to /boot

Share this post


Link to post
Share on other sites

@zador

I compiling kernel on my native PC on Ubuntu x64, so "creates enormous amount of small files" should not be the problem.

 

Maybe I should just update the u-boot?

Share this post


Link to post
Share on other sites

@Igor

:huh:

U-boot doesn't start this kernel due to "missing" dtb file, recompiling kernel doesn't matter here.

My guess is that DTB file is "missing" from u-boot perspective due to ext4 extents, and this is very random and will be hard to reproduce, especially on new images where chances to get fs tragmentation are almost zero.

 

@Insider

Do you have another (unused) sdcard? If you do, try creating single ext4 partition on it, rsyncing existing filesystem from old card to new and writing u-boot to it.

BTW, what's the reason you want to compile kernel yourself?

Share this post


Link to post
Share on other sites

@Igor

I don't know if it actually matters... but why ext2load is used when this u-boot has ext4load? Extents is primarily an ext4 feature. ext4load is not an alias to ext2load, it's completely different code.

 

@Insider

Can you try replacing ext2load with ext4load and see if u-boot messages change?

Share this post


Link to post
Share on other sites

@zador 

Sorry but at the moment, I have no unused sdcards.

I will try to do it. 

 

@Igor

Do you compiled the linux-fslc kernel from solid run?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
0