grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] [ARM] Enable boot module for arm
Date: Sun, 28 Jul 2013 20:51:41 +0400	[thread overview]
Message-ID: <20130728205141.0621c44c@opensuse.site> (raw)
In-Reply-To: <51F3DCD7.7090407@gmail.com>

В Sat, 27 Jul 2013 16:44:39 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:

> > It would be the first step, but my problem is, I cannot make it work
> > even using concatenation. u-boot does show me correct image info for
> > embedded grub, but I cannot launch it. Using default load address
> > 0x08000000 qemu errors out because address is not in RAM (and it will
> > not let me change amount of RAM for versatilepb); I tried to change
> > load address to something else, like 0x04000000 and it just immediately
> > resets in this case after "bootm 0x04000000".
> >
> You probably have to change GRUB link address. And not that the address 
> is where to find the source image not where to load to.
> 

I did try to change link address (arm_uboot_ldflags and
GRUB_KERNEL_ARM_UBOOT_LINK_ADDR). As I understand, bootm is expected to
relocate image to load address and jump to start address.

What I have now is

1. U-Boot is configured for versatileqemu. It works in the sense I can
start example standalone hello_world using bootm.

2. Grub us build for arm-uboot

bor@opensuse:~/build/grub> ./configure --with-platform=uboot TARGET_CC=arm-linux-gnueabi-gcc --target=arm TARGET_LD=arm-linux-gnueabi-ld 

(I also tried with TARGET_CFLAGS="-marm -mno-thumb-interwork
-mabi=aapcs-linux -march=armv5te" to match U-Boot flags)

3. core.img is generated using 

bor@opensuse:~/build/grub> ./grub-mkimage --verbose -d grub-core -O arm-uboot -o core.img
./grub-mkimage: info: the total module size is 0x20.
./grub-mkimage: info: getting the size of grub-core/kernel.img.
./grub-mkimage: info: reading grub-core/kernel.img.
./grub-mkimage: info: getting the size of grub-core/kernel.img.
./grub-mkimage: info: locating the section .text at 0x0.
./grub-mkimage: info: locating the section .rodata at 0x14750.
./grub-mkimage: info: locating the section .data at 0x165a0.
./grub-mkimage: info: locating the section .module_license at 0x16fa8.
./grub-mkimage: info: locating the section .bss at 0x16fc8.
./grub-mkimage: info: kernel_img=0x144dda0, kernel_size=0x16fc8.
./grub-mkimage: info: the core size is 0x16fe8.
./grub-mkimage: info: writing 0x17028 bytes.
bor@opensuse:~/build/grub> file core.img
core.img: u-boot legacy uImage, , Linux/ARM, OS Kernel Image (Not compressed), 94184 bytes, Sun Jul 28 20:46:54 2013, Load Address: 0x08000000, Entry Point: 0x08000000, Header CRC: 0x5F6F0B3E, Data CRC: 0x474F38F8

4. "flash" is built using

bor@opensuse:~/src/u-boot-2013.04> cat u-boot.bin ~/build/grub/core.img > test.bin

Offset of core.img is

bor@opensuse:~/src/u-boot-2013.04> printf "0x%X\n" $(expr $(stat -c%s u-boot.bin) + 65536)
0x2B558

5. I now can start it

bor@opensuse:~/src/u-boot-2013.04> qemu-system-arm -M versatilepb -m 256M -serial stdio -kernel test.bin
Warning: default mac address being used, creating potential for address conflict
audio: Unknown audio driver `pa'
audio: Run with -audio-help to list available drivers


U-Boot 2013.04 (Jul 28 2013 - 20:16:17)

DRAM:  128 MiB
WARNING: Caches not enabled
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   SMC91111-0
Warning: SMC91111-0 using MAC address from net device

VersatilePB # 

And it shows correct image info

VersatilePB # iminfo 0x2B558

## Checking Image at 0002b558 ...
   Legacy image found
   Image Name:   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    94184 Bytes = 92 KiB
   Load Address: 08000000
   Entry Point:  08000000
   Verifying Checksum ... OK
VersatilePB # 

But it simply resets at the attempt to launch it

VersatilePB # bootm 0x2B558
## Booting kernel from Legacy Image at 0002b558 ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    94184 Bytes = 92 KiB
   Load Address: 08000000
   Entry Point:  08000000
   Loading Kernel Image ... OK
OK

Starting kernel ...

resetting ...





  reply	other threads:[~2013-07-28 16:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21 13:20 [PATCH] [ARM] Enable boot module for arm Francesco Lavra
2013-07-25 14:36 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-07-25 14:45   ` Francesco Lavra
2013-07-25 15:04     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-07-27  3:46       ` Andrey Borzenkov
2013-07-27  4:21         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-07-27  5:19           ` Andrey Borzenkov
2013-07-27 14:44             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-07-28 16:51               ` Andrey Borzenkov [this message]
2013-07-28 18:01                 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-07-28 18:18                   ` Andrey Borzenkov
2013-07-28 19:01                     ` Andrey Borzenkov
2013-11-15 19:13           ` Andrey Borzenkov
2013-11-16  0:45             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-16 12:39               ` Leif Lindholm
2013-11-16 12:49                 ` [PATCH] arm: fix u-boot port syscall interface va_arg handling (was Re: [PATCH] [ARM] Enable boot module for arm) Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-16 13:00                   ` Leif Lindholm
2013-11-16 13:17                     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-16 13:27                       ` Andrey Borzenkov
2013-11-16 13:53                       ` Leif Lindholm
2013-11-16 14:03                         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-16 14:28                           ` Leif Lindholm
2013-11-16 14:45                             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-16 14:45                             ` Leif Lindholm
2013-11-16 15:19                               ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-16 15:23                                 ` Leif Lindholm
2013-11-16 15:31                                   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-16 12:54               ` [PATCH] [ARM] Enable boot module for arm Andrey Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130728205141.0621c44c@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).