Question

I have just installed QEMU and compiled linux kernel with ARM support but when I run below command

qemu-system-arm -M versatilepb -m 128M -kernel /home/arit/QEMU/linux-3.8.4/arch/arm/boot/uImage -append "console=tty1"

I could only see Black screen ,I also tried what is being suggested in below thread

Qemu shows a black screen

But still it didn't work.

Following is the output of make command which I run to compile kernel Source

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage -s

 Image Name:   Linux-3.8.4
 Created:      Tue Dec 24 12:49:07 2013
 Image Type:   ARM Linux Kernel Image (uncompressed)
 Data Size:    4406472 Bytes = 4303.20 kB = 4.20 MB
 Load Address: fffffff2
 Entry Point:  fffffff2

Are Load and Entry points OK here?

Was it helpful?

Solution

No your Load and Entry points ARE NOT CORRECT. typically below is load and entry address

Image Name:   Linux-3.9.0
Created:      Thu Dec 26 09:50:57 2013
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    1908056 Bytes = 1863.34 kB = 1.82 MB
Load Address: 00008000
Entry Point:  00008000

Moreover if you try with your command, kernel will be panic in the absence of rootfs. initrd parameters are missing. Also you might be missing some configuration while building kernel.

Try these steps:

1)make ARCH=arm distclean

2)make ARCH=arm versatile_defconfig

3)make ARCH=arm menuconfig

here you need to enable below feature.

Kernel Features ---> [*] Use the ARM EABI to compile the kernel. (enable this).

4)make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage

5)qemu-system-arm -M versatilepb -m 128M -kernel arch/arm/boot/uImage -append "console=tty1"

Here you will get console saying that kernel panic. to avoid this pass your rootfs parameter.

I guess you built rootfs from busybox if so try below command to boot system completely

6)qemu-system-arm -M versatilepb -m 128M -kernel arch/arm/boot/uImage -initrd rootfs.img -append "root=/dev/ram mem=128M rdinit=/sbin/init" -serial stdio.

OTHER TIPS

As you asking Is this config file is responsible for setting up entry and load address of uImage

Yes make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage

this command is responsible for loading entry point. How ? --->In kernel source code open vi scripts/mkuboot.sh

here check MKIMAGE=$(type -path "${CROSS_COMPILE}mkimage")

the script will take care to call scripts/Makefile.lib.

here in code

MKIMAGE := $(srctree)/scripts/mkuboot.sh

  UIMAGE_ARCH ?= $(SRCARCH)
  UIMAGE_COMPRESSION ?= $(if $(2),$(2),none)
  UIMAGE_OPTS-y ?=
  UIMAGE_TYPE ?= kernel
  UIMAGE_LOADADDR ?= arch_must_set_this
  UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR)
  UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)'
  UIMAGE_IN ?= $<
  UIMAGE_OUT ?= $@

-->

if the user doesnt mention LOADADDR in command line the address is took from below
UIMAGE_LOADADDR ?= arch_must_set_this

ifneq ($(LOADADDR),)
UIMAGE_LOADADDR=$(LOADADDR)
else
   ifeq ($(CONFIG_ZBOOT_ROM),y)
   UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
  else
UIMAGE_LOADADDR=$(ZRELADDR)
endif
endif

UIMAGE_LOADADDR=$(ZRELADDR) --> this variable responsible for loading entry address

the valve $(ZRELADDR) is took from board specific for in our case versatile so

arch/arm/mach-versatile/Makefile.boot

here

   zreladdr-y   += 0x00008000
params_phys-y   := 0x00000100
initrd_phys-y   := 0x00800000

This is how in kernel scripts are automated when make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage

executed.

For SINGH's question

what make ARCH=arm versatile_defconfig will do?

1) when you compiling kernel the 1st question is for which architecture are you building?

suppose if you are building for x86 architecture you no need to give ARCH=x86 ,by default it takes x86 and for x86 you dont need any cross-compiler , native compiler takes care compiling . You can verify it in Top-level Makefile.

if u give command ` make menuconfig' then by default it takes /boot/config-x.x.x this is for x86.

So present configuration of system is written to .config from /boot/config-x.x.x

But what for arm architecture which you are building on x86 architecture having native compiler?

here you should need cross-compiler tool cahin to compile kernel for ARM.

so from this background its clear y u need to provide ARCH and CROSS_COMPILE variables.?

when make ARCH=arm versatile_defconfig

Top-level makefile read this command that architecture is arm copies versatile_defconfig which is present in arch/arm/configs/versatile_defconfig

and writes to .config.

Here you ll get minimum configuration ,Next using menuconfig you enable your required things.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top