[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] microblaze: Fix compiled-in rootfs



Michal,

The patch doesn't work. I couldn't get it to apply so I modified the code 
by hand. With the patch in place, the cramfs isn't detected anymore:

    Found romfs @ 0x20248000 (0x00000000)
    #### klimit 2025d000 ####

If I change __bss_start to __init_end the patch works as far as it goes; 
without the change to init.c, the cramfs still gets corrupted.

    Found romfs @ 0x20247204 (0x0023e000)
    #### klimit 2025d000 ####
    Moved 0x0023e000 bytes from 0x20247204 to 0x2025c914
    New klimit: 0x2049b000

Steve

-----Original Message-----
From: Michal Simek <monstr@xxxxxxxxx>
To: microblaze-uclinux@xxxxxxxxxxxxxx
Cc: steve@xxxxxxxxxxxxxxx, john.williams@xxxxxxxxxxxxx
Date: Tue, 19 May 2009 14:55:02 +0200
Subject: [microblaze-uclinux] microblaze: Fix compiled-in rootfs

> Hi All,
> 
> I looked at Steve's patches again and I did some tests with it.
> I am not sure (please correct me if I am wrong) but rootfs should
> be placed to BSS and then is this section zeroed.
> 
> In Steve's patches (or in latest version) was for this case used 
> __init_end symbol but we should use bss section start (__bss_start
> symbol).
> For my case these two symbols don't match. This is caused by 
> aligned bss section.
> 
> [monstr@monstr linux-monstr.eu-commit]$ cat System.map | grep
> "__init_end$"
> 90271004 A __init_end
> [monstr@monstr linux-monstr.eu-commit]$ cat System.map | grep bss_start
> 90272000 B __bss_start
> 
> Here is part of my script for generation compiled-in rootfs 
> inside vmlinux and then create U-BOOT file format. (romfs.img is from
> petalinux and is romfs)
> 
> echo $CROSS_COMPILE
> BSS=`${CROSS_COMPILE}objdump --headers vmlinux | grep "\.bss"`;
> ADDR=`set -- ${BSS} ; echo 0x${5}`;
> echo ${ADDR}
> 
> [ ! -f romfs.img ] && exit -1
> ${CROSS_COMPILE}objcopy --add-section=.romfs=romfs.img \
> 		--adjust-section-vma=.romfs=${ADDR} --no-adjust-warnings \
> 		--set-section-flags=.romfs=alloc,load,data   \
> 		vmlinux linux.elf
> ${CROSS_COMPILE}objcopy -O binary linux.elf linux.bin
> mkimage  -A microblaze -O linux -T kernel -C none -a $addr -e $addr -n
> "kernel s rootfs" -d linux.bin /tftpboot/image2.ub
> 
> Steve: Could you please tested it? If is OK, I'll add your sign-off-by
> line.
> 
> 
> Below is my bootlog for fixes-for-linus branch + this patch.
> 
> And on this site you can find my log of initramfs case.
> http://monstr.eu/wiki/doku.php?id=fdt:fdt:logs:2.6.30-rc5-nommu-initram
> fs
> 
> I'll add my logs to that site too.
> 
> 
> Thanks,
> Michal
> 
> 
> SDRAM :
>                 Icache:OK
>                 Dcache:OK
>         U-Boot Start:0x9ffc0000
> FLASH: 32 MB
> MAC:00:E0:0C:00:00:FD
> eth0: Xilinx XPS LocalLink Tri-Mode Ether MAC #0 at 0x81C00000.
> Unsupported mode
> U-Boot-mONStR> run b
> TFTP from server 192.168.0.102; our IP address is 192.168.0.3
> Filename 'image2.ub'.
> Load address: 0x90800000
> Loading: 100BASE-T/FD
> #################################################################
>         
> #################################################################
>         
> #################################################################
>         
> #################################################################
>          #####################################
> done
> Bytes transferred = 4352064 (426840 hex)
> TFTP from server 192.168.0.102; our IP address is 192.168.0.3
> Filename 'system.dtb'.
> Load address: 0x90780000
> Loading: 100BASE-T/FD
> #
> done
> Bytes transferred = 9121 (23a1 hex)
> ## Booting kernel from Legacy Image at 90800000 ...
>    Image Name:   kernel s rootfs
>    Image Type:   MicroBlaze Linux Kernel Image (uncompressed)
>    Data Size:    4352000 Bytes =  4.2 MB
>    Load Address: 90000000
>    Entry Point:  90000000
>    Verifying Checksum ... OK
>    Loading Kernel Image ... OK
> OK
> ## Flattened Device Tree blob at 90780000
>    Booting using the fdt blob at 0x90780000
> ## Transferring control to Linux (at address 90000000), 0x00000000
> ramdisk 0x00000000, FDT 0x90780000...
> early_printk_console is enabled at 0x84000000
> Ramdisk addr 0x00000000, FDT 0x90780000
> Found romfs @ 0x90272000 (0x001b5000)
> #### klimit 902c2000 ####
> Moved 0x001b5000 bytes from 0x90272000 to 0x902c1b28
> New klimit: 0x90477000
> Found FDT at 0x90780000
> Linux version 2.6.30-rc6-00348-g7b7210d-dirty (monstr@xxxxxxxxx) (gcc
> version 4.1.2) #15 Tue May 19 14:30:36 CEST 2009
> setup_cpuinfo: initialising
> setup_cpuinfo: Using full CPU PVR support
> setup_memory: Main mem: 0x90000000-0xa0000000, size 0x10000000
> setup_memory: kernel addr=0x90000000-0x90477000 size=0x00477000
> setup_memory: max_mapnr: 0x10000
> setup_memory: min_low_pfn: 0x90000
> setup_memory: max_low_pfn: 0xa0000
> On node 0 totalpages: 65536
> free_area_init_node: node 0, pgdat 90255d64, node_mem_map 90477000
>   Normal zone: 512 pages used for memmap
>   Normal zone: 0 pages reserved
>   Normal zone: 65024 pages, LIFO batch:0
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages:
> 65024
> Kernel command line: console=ttyUL0,115200 highres=on
> root=/dev/mtdblock0
> NR_IRQS:32
> xlnx,xps-intc-1.00.a #0 at 0x81800000, num_irq=9, edge=0x100
> PID hash table entries: 1024 (order: 10, 4096 bytes)
> xlnx,xps-timer-1.00.a #0 at 0x83c00000, irq=3
> Heartbeat GPIO at 0x81400000
> microblaze_timer_set_mode: shutdown
> microblaze_timer_set_mode: periodic
> Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
> Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
> Memory: 255324k/262144k available
> ODEBUG: 3 of 3 active objects replaced
> ODEBUG: selftest passed
> Calibrating delay loop... 61.03 BogoMIPS (lpj=305152)
> Mount-cache hash table entries: 512
> net_namespace: 544 bytes
> NET: Registered protocol family 16
> bio: create slab <bio-0> at 0
> microblaze_timer_set_mode: oneshot
> Switched to high resolution mode on CPU 0
> NET: Registered protocol family 2
> IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
> TCP established hash table entries: 8192 (order: 4, 65536 bytes)
> TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
> TCP: Hash tables configured (established 8192 bind 8192)
> TCP reno registered
> NET: Registered protocol family 1
> ROMFS MTD (C) 2007 Red Hat, Inc.
> msgmni has been set to 498
> io scheduler noop registered
> io scheduler anticipatory registered
> io scheduler deadline registered
> io scheduler cfq registered (default)
> 84000000.serial: ttyUL0 at MMIO 0x84000003 (irq = 8) is a uartlite
> console [ttyUL0] enabled
> brd: module loaded
> nbd: registered device at major 43
> uclinux[mtd]: RAM probe address=0x902c1b28 size=0x1b5000
> Creating 1 MTD partitions on "RAM":
> 0x000000000000-0x0000001b5000 : "ROMfs"
> TCP cubic registered
> NET: Registered protocol family 17
> RPC: Registered udp transport module.
> RPC: Registered tcp transport module.
> VFS: Mounted root (romfs filesystem) readonly on device 31:0.
> Freeing unused kernel memory: 92k freed
> Mounting proc: 
> Mounting var: 
> Populating /var: 
> Running local start scripts.
> Mounting /etc/config: 
> Populating /etc/config: 
> flatfsd: Nonexistent or bad flatfs (-48), creating new one...
> flatfsd: Failed to write flatfs (-48): No such device
> flatfsd: Created 5 configuration files (185 bytes)
> Mounting sysfs:
> Setting hostname: 
> Setting up interface lo: 
> Setting up interface eth0: 
> SIOCSIFADDR: No such device
> Starting portmap:
> Starting thttpd: 
> 
> uclinux login: 
> 
> 
> or you can separate kernel and rootfs and it works on similar base
> 
> 
> SDRAM :
>                 Icache:OK
>                 Dcache:OK
>         U-Boot Start:0x9ffc0000
> FLASH: 32 MB
> MAC:00:E0:0C:00:00:FD
> eth0: Xilinx XPS LocalLink Tri-Mode Ether MAC #0 at 0x81C00000.
> Unsupported mode
> U-Boot-mONStR> run ml505
> TFTP from server 192.168.0.102; our IP address is 192.168.0.3
> Filename 'image.ub'.
> Load address: 0x90800000
> Loading: 100BASE-T/FD
> #################################################################
>         
> #################################################################
>          #############################################
> done
> Bytes transferred = 2560068 (271044 hex)
> TFTP from server 192.168.0.102; our IP address is 192.168.0.3
> Filename 'system.dtb'.
> Load address: 0x90780000
> Loading: 100BASE-T/FD
> #
> done
> Bytes transferred = 9121 (23a1 hex)
> TFTP from server 192.168.0.102; our IP address is 192.168.0.3
> Filename 'romfs.ub'.
> Load address: 0x90c80000
> Loading: 100BASE-T/FD
> #################################################################
>          #########################################################
> done
> Bytes transferred = 1787968 (1b4840 hex)
> ## Booting kernel from Legacy Image at 90800000 ...
>    Image Name:   kernel bez FS
>    Image Type:   MicroBlaze Linux Kernel Image (uncompressed)
>    Data Size:    2560004 Bytes =  2.4 MB
>    Load Address: 90000000
>    Entry Point:  90000000
>    Verifying Checksum ... OK
> ## Loading init Ramdisk from Legacy Image at 90c80000 ...
>    Image Name:   fs v no network
>    Image Type:   MicroBlaze Linux RAMDisk Image (uncompressed)
>    Data Size:    1787904 Bytes =  1.7 MB
>    Load Address: 00000000
>    Entry Point:  00000000
>    Verifying Checksum ... OK
>    Loading Kernel Image ... OK
> OK
> ## Flattened Device Tree blob at 90780000
>    Booting using the fdt blob at 0x90780000
> ## Loading init Ramdisk from Legacy Image at 90c80000 ...
>    Image Name:   fs v no network
>    Image Type:   MicroBlaze Linux RAMDisk Image (uncompressed)
>    Data Size:    1787904 Bytes =  1.7 MB
>    Load Address: 00000000
>    Entry Point:  00000000
>    Verifying Checksum ... OK
> ## Transferring control to Linux (at address 90000000), 0x00000000
> ramdisk 0x90c80040, FDT 0x90780000...
> early_printk_console is enabled at 0x84000000
> Ramdisk addr 0x90c80040, FDT 0x90780000
> Found romfs @ 0x90c80040 (0x001b5000)
> #### klimit 902c2000 ####
> Moved 0x001b5000 bytes from 0x90c80040 to 0x902c1b28
> New klimit: 0x90477000
> Found FDT at 0x90780000
> Linux version 2.6.30-rc6-00348-g7b7210d-dirty (monstr@xxxxxxxxx) (gcc
> version 4.1.2) #15 Tue May 19 14:30:36 CEST 2009
> setup_cpuinfo: initialising
> setup_cpuinfo: Using full CPU PVR support
> setup_memory: Main mem: 0x90000000-0xa0000000, size 0x10000000
> setup_memory: kernel addr=0x90000000-0x90477000 size=0x00477000
> setup_memory: max_mapnr: 0x10000
> setup_memory: min_low_pfn: 0x90000
> setup_memory: max_low_pfn: 0xa0000
> On node 0 totalpages: 65536
> free_area_init_node: node 0, pgdat 90255d64, node_mem_map 90477000
>   Normal zone: 512 pages used for memmap
>   Normal zone: 0 pages reserved
>   Normal zone: 65024 pages, LIFO batch:0
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages:
> 65024
> Kernel command line: console=ttyUL0,115200 highres=on
> root=/dev/mtdblock0
> NR_IRQS:32
> xlnx,xps-intc-1.00.a #0 at 0x81800000, num_irq=9, edge=0x100
> PID hash table entries: 1024 (order: 10, 4096 bytes)
> xlnx,xps-timer-1.00.a #0 at 0x83c00000, irq=3
> Heartbeat GPIO at 0x81400000
> microblaze_timer_set_mode: shutdown
> microblaze_timer_set_mode: periodic
> Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
> Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
> Memory: 255324k/262144k available
> ODEBUG: 3 of 3 active objects replaced
> ODEBUG: selftest passed
> Calibrating delay loop... 61.03 BogoMIPS (lpj=305152)
> Mount-cache hash table entries: 512
> net_namespace: 544 bytes
> NET: Registered protocol family 16
> bio: create slab <bio-0> at 0
> microblaze_timer_set_mode: oneshot
> Switched to high resolution mode on CPU 0
> NET: Registered protocol family 2
> IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
> TCP established hash table entries: 8192 (order: 4, 65536 bytes)
> TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
> TCP: Hash tables configured (established 8192 bind 8192)
> TCP reno registered
> NET: Registered protocol family 1
> ROMFS MTD (C) 2007 Red Hat, Inc.
> msgmni has been set to 498
> io scheduler noop registered
> io scheduler anticipatory registered
> io scheduler deadline registered
> io scheduler cfq registered (default)
> 84000000.serial: ttyUL0 at MMIO 0x84000003 (irq = 8) is a uartlite
> console [ttyUL0] enabled
> brd: module loaded
> nbd: registered device at major 43
> uclinux[mtd]: RAM probe address=0x902c1b28 size=0x1b5000
> Creating 1 MTD partitions on "RAM":
> 0x000000000000-0x0000001b5000 : "ROMfs"
> TCP cubic registered
> NET: Registered protocol family 17
> RPC: Registered udp transport module.
> RPC: Registered tcp transport module.
> VFS: Mounted root (romfs filesystem) readonly on device 31:0.
> Freeing unused kernel memory: 92k freed
> Mounting proc: 
> Mounting var: 
> Populating /var: 
> Running local start scripts.
> Mounting /etc/config: 
> Populating /etc/config: 
> flatfsd: Nonexistent or bad flatfs (-48), creating new one...
> flatfsd: Failed to write flatfs (-48): No such device
> flatfsd: Created 5 configuration files (185 bytes)
> Mounting sysfs:
> Setting hostname: 
> Setting up interface lo: 
> Setting up interface eth0: 
> SIOCSIFADDR: No such device
> Starting portmap:
> Starting thttpd: 
> 
> uclinux login: 
> 
> 
> 
> 
> 
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@xxxxxxxxxxxxxx
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive :
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
> 


___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/