How to set up the Machine Type (arch_id) for Linux Kernel Arm Cross-Compile - linux-kernel

I would like to know how to set the correct MACH_TYPE or arch_id for the kernel. I searched and found at least 2 references where the kernel would hang at "Starting Kernel ... ". These came with the same answer. Correctly set your Machine Type. But then neither mentions how to do so. Anyone know how to do this?
Pretty good explanation for the hang. and Another good description.
Both of these are close to what I am experiencing when I try to boot my kernel. It gets stuck on "Starting Kernel..." and won't continue. I have built the kernel several times from .configs that were supposed to be exactly for my model.
Timesys (LinuxLink) provides a .config that is supposed to match the kernel that they provide with their free build service. But that doesn't work either. If I use their pre-built kernel it boots up no problem. So I know it is not my u-boot or how I have configured my SD-card. The problem must come from the kernel build.
I run my make like: make ARCH=arm CROSS_COMPILE=${PATH_TO_TOOLCHAIN}/bin/armv7l-timesys-linux-gnueabi- uImage and make my image as follows: sudo mkimage -A arm -O linux -T kernel -C none -a 0x70800000 -e 0x70800000 -n "Linux-2.6.35-ts-armv7l" -d arch/arm/boot/uImage ../../uImage
I am working with a Freescale i.MX53 Eval Board. When I try to run the kernel:
U-Boot 2009.08-dirty (Aug 02 2013 - 19:57:03)
CPU: Freescale i.MX53 family 2.1V at 800 MHz
mx53 pll1: 800MHz
mx53 pll2: 400MHz
mx53 pll3: 432MHz
mx53 pll4: 455MHz
ipg clock : 66666666Hz
ipg per clock : 33333333Hz
uart clock : 66666666Hz
cspi clock : 108000000Hz
ahb clock : 133333333Hz
axi_a clock : 400000000Hz
axi_b clock : 200000000Hz
emi_slow clock: 133333333Hz
ddr clock : 400000000Hz
esdhc1 clock : 80000000Hz
esdhc2 clock : 80000000Hz
esdhc3 clock : 80000000Hz
esdhc4 clock : 80000000Hz
nfc clock : 26666666Hz
Board: MX53-LOCO 1.0 Rev. B
Boot Reason: [POR]
Boot Device: SD
I2C: ready
DRAM: 1 GB
MMC: FSL_ESDHC: 0,FSL_ESDHC: 1
In: serial
Out: serial
Err: serial
Serial reinitilized!
Net: got MAC address from IIM: 00:04:9f:01:f7:ce
FEC0 [PRIME]
Hit any key to stop autoboot: 0
mmc0 is current device
MMC read: dev # 0, block # 2048, count 8192 ... 8192 blocks read: OK
## Booting kernel from Legacy Image at 70800000 ...
Image Name: Linux-2.6.35-ts-armv7l
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2999932 Bytes = 2.9 MB
Load Address: 70800000
Entry Point: 70800000
Verifying Checksum ... OK
XIP Kernel Image ... OK
OK
Starting kernel ...
u-boot env:
bootdelay=3
baudrate=115200
netdev=eth0
ethprime=FEC0
uboot=u-boot.bin
kernel=uImage
nfsroot=/opt/eldk/arm
bootargs_base=setenv bootargs console=ttymxc0,115200
bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
bootcmd_net=run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; bootm
bootcmd=run bootcmd_mmc
ethact=FEC0
lcd=video=mxcdi0fb:RGB24,SEIKO-WVGA di0_primary
bootargs_mmc=setenv bootargs ${bootargs} gpu_nommu ${lcd} ip=dhcp root=/dev/mmcblk0p1 rootwait rw
bootargs=console=ttymxc0,115200 gpu_nommu video=mxcdi0fb:RGB24,SEIKO-WVGA di0_primary ip=dhcp root=/dev/mmcblk0p1 rootwait rw
bootcmd_mmc=run bootargs_base bootargs_mmc; mmc dev 0; mmc read ${loadaddr} 0x800 0x2000; bootm
loadaddr=0x70800000
stdin=serial
stdout=serial
stderr=serial

The issue is that a double u-boot header has been applied to the image. As per unixsmurf.

Related

ROM doesn't load U-Boot on imx6solo

I'm trying to upgrade my u-boot from 2009 to 2020 using buildroot, but when I build the new one it doesn't boot (and I don't have JTAG).
When I load it with imx_usb_loader it works but when I flash it on the Nand, it doesn't boot on it.
As u-boot files, I use mx6sabreauto.c, mx6solo.cfg and mx6sabreauto.h
I don't use SPL or DTS, I only generate u-boot.imx
Boot logs with imx_usb_loader :
U-Boot 2020.04 (Feb 11 2023 - 15:41:38 +0100)
CPU: i.MX6SOLO rev1.3 at 792MHz
CPU: Industrial temperature grade (-40C to 105C) at 50C
Reset cause: POR
Model: i.MX6 DualLite/Solo SABRE Automotive Board
Board: MX6Q-Sabreauto rev#
DRAM: 2 GiB
NAND: nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xd3
nand_base: Micron NAND 1GiB 3,3V 8-bit
nand_base: Micron NAND 1GiB 3,3V 8-bit
nand_base: 1024 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 128
use legacy bch geometry
1024 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 2
Loading Environment from MMC... MMC: no card present
mmc_init: -123, time 2
Warning - No block device, using default environment
Loading Environment from NAND... Scanning device for bad blocks
Warning - bad CRC, using default environment
No panel detected: default to Hannstar-XGA
Display: Hannstar-XGA (1024x768)
In: serial
Out: serial
Err: serial
Net: FEC [PRIME]
Warning: FEC (eth0) using random MAC address - ea:37:e5:51:c1:86
Boot from USB for mfgtools
Warning - Use default environment for
using default environment
Hit any key to stop autoboot: 0
Flash logs :
=> nand erase 0x0 0x40000000
NAND erase: device 0 whole chip
Erasing at 0x3ffc0000 -- 100% complete.
OK
=> tftp 0x10800000 u-boot.imx
Using FEC device
TFTP from server 192.168.30.30; our IP address is 192.168.30.10
Filename 'u-boot.imx'.
Load address: 0x10800000
Loading: #####################################################
3.9 MiB/s
done
Bytes transferred = 777216 (bdc00 hex)
=> nand read 0x10800000 0x00000000 777216
NAND read: device 0 offset 0x0, size 0x777216
7827990 bytes read: OK
=> reset
resetting ...
It worked when I flashed from the Linux rootfs using these commands :
$ flash_erase /dev/mtd0 0 0
$ kobs-ng init -x u-boot.imx --search_exponent=1 -v
It seems that the "search-exponent" option did the trick.

What does fatload mmc and bootm means in the uboot?

I am unable to understand these commands like
fatload mmc 0 0x3000000 uImage
fatload mmc 0 0x2A00000 devicetree.dtb
bootm 0x3000000 - 0x2A00000
#fatload mmc 0 0x3000000 uImage.
What is it doing? Is it loading uImage as a fat partition and loading at the RAM address 0x3000000?
bootm 0x3000000 - 0x2A00000 - ?
Does it mean boot from the RAM address 0x3000000 to 0x2A00000?
U-Boot runs code placed in (processor's) RAM, although it can also read data from other media. The boot process normally takes place in two steps:
Reading the OS image from media (Ethernet, flash, USB, MMC) into RAM
Jumping to the first instruction of the image in RAM
uImage is the (most probably Linux) kernel.
xxx.dtb is your device tree in compiled form. It contains the hardware information, so that the information can be kept separately from the kernel.
Now, to read an image from an MMC card formatted in FAT, the command is:
fatload mmc <dev>[:partition] <loadAddress> <bootfilename>
So the 2 fatload commands are loading the 2 files from MMC card into the processor's memory/RAM.
Now, regarding the bootm : This command starts a kernel image running. The syntax is :
bootm <address of kernel> <address of ramdisk> <address of dtb>
Addresses of ramdisk and/or dtb can be omitted if the kernel is configured in such a away that it doesn't need it/them.
In your case you are not using ramdisk hence the dash - in the middle.

Uboot hangs after "Starting kernel" message

I compiled a linux kernel for my Toshiba AC100 and want to boot it via uboot.
Problem: After displaying the message "Starting Kernel" nothing happens.
The flag CONFIG_DEBUG_LL was set but there is still no output after this message.
I have another precompiled kernel (but too old to use) which comes with its own dtb file and this one boots (same bootargs as the non-booting kernel).
Observation: If I change the dbt file for this kernel it shows the same behavior as the non-booting kernel, just displaying the "Starting kernel" line.
So I guess my problem is related to the dbt file I use for my kernel.
Are there any methods to check if the dbt file is right for my board?
What else could I do to get some information what the problem is?
The entry in the boot.scr:
setenv bootargs 'root=/dev/mmcblk0p7 rootfstype=ext4 earlyprintk=vga console=tty0 mem=448M#0'
setenv bootmenu_4 "Boot Arch Linux =ext2load mmc 0:7 0x1000000 /boot/zImage; ext2load mmc 0:7 0x2000000 /boot/tegra20-paz00.dtb; bootz 0x1000000 - 0x2000000"
And here's the output form u-boot:
2255488 bytes read in 116 ms (18.5 MiB/s)
14153 bytes read in 82 ms (168 KiB/s)
Kernel image # 0x1000000 [ 0x000000 - 0x226a80 ]
## Flattened Device Tree blob at 02000000
Booting using the fdt blob at 0x2000000
Loading Device Tree to 0fff9000, end 0ffff748 ... OK
Starting kernel ...
I tried also to extract the config from the working kernel and built a new kernel with this config, but this one does not work, too (does not matter which dtb file I use).
EDIT:
Finally I solved it by changing the kernel config from
CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA
to
CONFIG_TEGRA_DEBUG_UARTA
After this, the kernel boots fine.

Linux kernel for A20 cpu stuck at 'Starting kernel'

Linux kernel version: 4.1.8
board:cubietruck with A20 CPU.
compiled platform: os x 10.5.5
I do as follows:
First I use sunxi_defconfig as the default configuration, but 'byte_swap.h' not found error occurred. Then I use a sun7i_defconfig which offered by cubieboard, and then make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage,make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs.
Then I burn the Uboot and the spl to the SDCard and make to partitions: one for boot and one for root file system. I put the zImage, script.bin and the dtb file on the boot partition.
Then I create boot.cmd as below:
fatload mmc 0 0x46000000 zImage
fatload mmc 0 0x49000000 sun7i-a20-cubietruck.dtb
setenv bootargs console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
bootz 0x46000000 - 0x49000000
and then mkimage -C none -A arm -T script -d boot.cmd boot.scr.
so there's three files on the boot partition:
boot.scr
script.bin
sun7i-a20-cubietruck.dtb
zImage
the Uboot works fine.(At least I think), here is the output
U-Boot SPL 2014.04 (Sep 29 2015 - 21:36:09)
Board: Cubietruck
DRAM: 2048 MiB
CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
spl: not an uImage at 1600
U-Boot 2014.04 (Sep 29 2015 - 21:36:09) Allwinner Technology
CPU: Allwinner A20 (SUN7I)
Board: Cubietruck
I2C: ready
DRAM: 2 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: dwmac.1c50000
Hit any key to stop autoboot: 0
reading uEnv.txt
** Unable to read file uEnv.txt **
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
reading boot.scr
281 bytes read in 16 ms (16.6 KiB/s)
Jumping to boot.scr
## Executing script at 44000000
reading zImage
3446280 bytes read in 192 ms (17.1 MiB/s)
reading sun7i-a20-cubietruck.dtb
26288 bytes read in 30 ms (855.5 KiB/s)
Kernel image # 0x46000000 [ 0x000000 - 0x349608 ]
## Flattened Device Tree blob at 49000000
Booting using the fdt blob at 0x49000000
Loading Device Tree to 4fff6000, end 4ffff6af ... OK
Starting kernel ...
Any one could help?

AT91SAM9263ek booting Linux with Device Tree failed

I have problem booting Linux 3.16.1. I have compiled sources from http://www.kernel.org with at91sam9263_defconfig.
I have added Flattened Device Tree support in Boot options.
Followin tips suggested in this (https://www.slideshare.net/softpapa/device-tree-support-on-arm-linux-8930303) presentation to turn on Support device tree in /proc but i don't have that option in menuconfig.
I have U-Boot bootloader version 2014.10rc2 which supports device tree.
I have generated dtb from script shipped with kernel:
make at91sam9263ek.dtb
And now i'm getting this error:
Welcome to minicom 2.5
OPTIONS: I18n
Compiled on Feb 9 2011, 14:45:00.
Port /dev/ttyS0
Press CTRL-A Z for help on special keys
RomBOOT
>
U-Boot 2014.10-rc2-00200-g9170818-dirty (Sep 23 2014 - 15:16:39)
CPU: AT91SAM9263
Crystal frequency: 16.368 MHz
CPU clock : 199.919 MHz
Master clock : 99.960 MHz
DRAM: 64 MiB
WARNING: Caches not enabled
NAND: 256 MiB
MMC: mci: 0
In: serial
Out: serial
Err: serial
Net: macb0
Warning: Your board does not use generic board. Please read
doc/README.generic-board and take action. Boards not
upgraded by the late 2014 may break or be removed.
Hit any key to stop autoboot: 0
U-Boot> tftp uImage
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
Using macb0 device
TFTP from server 192.168.1.247; our IP address is 192.168.1.240
Filename 'uImage'.
Load address: 0x22000000
Loading: #################################################################
#################################################################
#################################################################
##############
1.2 MiB/s
done
Bytes transferred = 3068016 (2ed070 hex)
U-Boot> tftp 20000000 dt
macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
Using macb0 device
TFTP from server 192.168.1.247; our IP address is 192.168.1.240
Filename 'dt'.
Load address: 0x20000000
Loading: #
340.8 KiB/s
done
Bytes transferred = 13279 (33df hex)
U-Boot> bootm 22000000 - 20000000
## Booting kernel from Legacy Image at 22000000 ...
Image Name: Linux-3.16.1
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3067952 Bytes = 2.9 MiB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 20000000
Booting using the fdt blob at 0x20000000
Loading Kernel Image ... OK
Loading Device Tree to 23ea3000, end 23ea93de ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported device tree compatible list:
[ 'atmel,at91sam9263ek' 'atmel,at91sam9263' 'atmel,at91sam9' ]
Available machine support:
ID (hex) NAME
000004b2 Atmel AT91SAM9263-EK
Please check your kernel config and/or bootloader.
Solution:
Add this line to .config:
CONFIG_MACH_AT91SAM9_DT=y
The correct configuration for this board when using device tree is at91_dt_defconfig.
However, I am quite surprised to see someone trying to use such an old kernel. This board is fully supported upstream. Why don't you use v5.3? If this doesn't work, please report any bug, we will be happy to help correct them.

Resources