Page 1 of 1

uBoot-booting original samsung kernel+ramdisk root from usb

Posted: Mon Apr 25, 2011 9:28 pm
by cracket
With my B650 CI I wanted to take original Samsung kernel (not OpenEmbedded), add patched root filesystem into ramdisk - and boot such solution from USB.

Steps I took:

1) dumped whole tbml5 partition with kernel (4MB including trailing zeros)
2) created ext2 14MB partition image, copied files from mtd_root and mtd_boot, gzipped it as described here: http://www.denx.de/wiki/view/DULG/RootF ... OnARamdisk to less than 4MB image
3) packed both as u-boot multi image:
mkimage -A arm -O linux -T multi -a 0x60008000 -e 0x60008000 -C none -n "Original Samsung Kernel" -d bml5.img:ramdisk.gz urImage
http://www.denx.de/wiki/view/DULG/Combi ... AndRamdisk
4) wrote urImage to fat partition on usb, plugged into tv
5) now many times tried to load following kernel in a different way with root on ramdisk with no success :-(

No filesystem could mount root, tried: ext3 squashfs vfat ntfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

I expect to see:
RAMDISK: Compressed image found at block ...
(there is such string in my kernel, really ;-) )



Code: Select all

LEONID # usb start
(Re)start USB...
USB:   scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found
LEONID # setenv rd_size 16384
LEONID # setenv ram_ws 0x400000			
LEONID # setenv ramdisk_addr 0x400000
LEONID # setenv bootargs ramdisk_size=16384  root=/dev/ram rw rootdelay=3 console=ttyS1
LEONID # fatload usb 0 61000000 urImage
reading urImage
..............................................................................................................................................
.
.
.
.
.
..............................................................................................................................................
..............................................................................................................................................

8255191 bytes read
LEONID # bootm
## Booting image at 61000000 ...
   Image Name:   Original Samsung Kernel
   Image Type:   ARM Linux Multi-File Image (uncompressed)
   Data Size:    8255127 Bytes =  7.9 MB
   Load Address: 60008000
   Entry Point:  60008000
   Contents:
   Image 0:  4194304 Bytes =  4 MB
   Image 1:  4060811 Bytes =  3.9 MB
   Verifying Checksum ... OK
OK

Starting kernel ...
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv6TEJ), cr=00c5387f
Machine: Samsung-SDP83 Eval. Board(64bit 512MB)
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIPT write-back cache
CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
CPU0: D cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
Built 2 zonelists.  Total pages: 76032
Kernel command line:  ramdisk_size=16384  root=/dev/ram rw rootdelay=3 console=ttyS1
WARNING: experimental RCU implementation.
PID hash table entries: 2048 (order: 11, 8192 bytes)
Samsung DTV Linux System timer initialize
sdp83 clock control (c) 2008 Samsung Electronics
SDP83 Core Clock: 600.0Mhz
SDP83 DDR2 Clock: 399.937Mhz
SDP83 AHB Clock: 140.62Mhz
SDP83 APB Clock: 140.62Mhz
Samsung DTV Linux Calcurate Timer Clock 0.199 us per tick
        Reset Value 0x0000c365
Console: colour dummy device 80x30
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 196MB 101MB = 297MB total
Memory: 297728KB available (2368K code, 1013K data, 92K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
sdp83 clock control (c) 2008 Samsung Electronics
SDP83 Core Clock: 600.0Mhz
SDP83 DDR2 Clock: 399.937Mhz
SDP83 AHB Clock: 140.62Mhz
SDP83 APB Clock: 140.62Mhz
PCI: bus0: Fast back to back transfers enabled
SCSI subsystem initialized
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 16384 bind 8192)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
squashfs: version 3.1 (2006/08/19) Phillip Lougher
NTFS driver 2.1.29 [Flags: R/O].
Initializing Cryptographic API
io scheduler noop registered (default)
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
SDP I2C 0 port initialize base is 0xd3000100
SDP I2C 1 port initialize base is 0xd3000120
SDP I2C 2 port initialize base is 0xd3000140
SDP I2C 3 port initialize base is 0xd3000160
Samsung SDP I2c ver 0.7 access driver 
Serial: S5H2X driver $Revision : 1.01 $
enter serial_request_port
s5h2x-uart: ttyS0 at MMIO map 0x30090a00 mem 0xf8090a00 (irq = 19) is a S5H2X
enter serial_request_port
s5h2x-uart: ttySD0 at MMIO map 0x30090a00 mem 0xf8090a00 (irq = 19) is a S5H2X
enter serial_request_port
s5h2x-uart: ttyS1 at MMIO map 0x30090a40 mem 0xf8090a40 (irq = 20) is a S5H2X
enter serial_request_port
s5h2x-uart: ttySD1 at MMIO map 0x30090a40 mem 0xf8090a40 (irq = 20) is a S5H2X
enter serial_request_port
s5h2x-uart: ttyS2 at MMIO map 0x30090a80 mem 0xf8090a80 (irq = 21) is a S5H2X
enter serial_request_port
s5h2x-uart: ttySD2 at MMIO map 0x30090a80 mem 0xf8090a80 (irq = 21) is a S5H2X
RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
[BIF:IN ] ++FSR_BML_Init(nFlag: 0x0)
FSR: Registered TinyFSR Driver.
mice: PS/2 mouse device common for all mice
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 15
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
Waiting 6sec before mounting root device...
No filesystem could mount root, tried:  ext3 squashfs vfat ntfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[<c0024618>] (dump_stack+0x0/0x14) from [<c003bc24>] (panic+0x5c/0x148)
[<c003bbc8>] (panic+0x0/0x148) from [<c0008d34>] (mount_block_root+0x234/0x288)
 r3 = C057FF18  r2 = 00000020  r1 = C057FF18  r0 = C02336D8
[<c0008b00>] (mount_block_root+0x0/0x288) from [<c0008ddc>] (mount_root+0x54/0x6c)
[<c0008d88>] (mount_root+0x0/0x6c) from [<c0008edc>] (prepare_namespace+0xe8/0x140)
 r5 = C001CB64  r4 = C02F5DFC 
[<c0008df4>] (prepare_namespace+0x0/0x140) from [<c001f194>] (init+0x168/0x2c4)
 r5 = C001C5FC  r4 = C02F5DEC 
[<c001f02c>] (init+0x0/0x2c4) from [<c003f208>] (do_exit+0x0/0x9bc)

Questions:

1) Why u-Boot shows 2 addresses that kernel is loaded to:
Booting image at 61000000 ...
Load Address: 60008000
Entry Point: 60008000
as I understand after 4MB of kernel image - follows compressed ramdisk image.
So to which address ramdisk (Image2) is loaded? 0x61000000+0x400000 or 0x60008000+0x400000?

2) what commands should I use to u-Boot or kernel bootargs to force kernel mount root on RAMDISK?
Did anyone tried something like that? What am I doing wrong?

3) why kernel stacktrace shows error address starting with 0xC00 when it points to not available memory? My B650 has 297 MB ram - cat /proc/iomem:
6000 0000-6c3f ffff : System RAM 196MB
6001f000-6026f207 : Kernel text
60270000-6036d417 : Kernel data
70000000-764f ffff : System RAM 101MB


This solution would allow to boot up TV with bricked all partitions except bootloader and u-Boot.

Re: uBoot-booting original samsung kernel+ramdisk root from usb

Posted: Wed Apr 27, 2011 8:17 pm
by juusso
check wiki for external boot. You can boot rootfs and kernel over network, bu you can`t boot native kernel (from bml3) with external rootfs, just only with built-in filesystem because of cmd line hardcoded to kernel. I do not know why native kernel does not read uboot_env and does not mount external filesystem...

Re: uBoot-booting original samsung kernel+ramdisk root from usb

Posted: Thu Apr 28, 2011 1:55 pm
by marcelru
Hi cracket,

Like juuso said, the root file system is hard-coded in the kernel in a uImage. To boot form a different root fs you will need to rebuild the kernel from source. I did that for my TV, and then boot the TV with the method described in the wiki. The only thing that needs to be changed is USB support and the path of the root fs.
The built-in kernel of our sammy's has modular usb support (usbcore.ko and the likes). To successfully boot from a USB drive you will need a kernel with built-in USB support, otherwise the kernel is not able to mount the root filesystem or load it from a stick, leading to a kernel panic.
What you need to do is rebuild the kernel with usb built-in and it should work (well, it works for me).

HTH,

marcelr