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

Re: flash-kernel and dtb



On 15/06/2014 08:36, Rainer Dorsch wrote:
> Hi Ian,
> 
> thanks for your useful response again.
> 
> On Saturday 14 June 2014 14:48:08 Vagrant Cascadian wrote:
>> On Sat, Jun 14, 2014 at 10:36:43PM +0200, Rainer Dorsch wrote:
>>> root@bokocube:~# cat /root/boot.cmd
>>> 5# boot script for CuBox-i
>>>
>>> setenv device mmc
>>> setenv partition ${mmcdev}:${mmcpart}
>>> setenv bootargs 'quiet'
>>>
>>> image_locations='/boot/ /'
>>> kvers='3.15-rc8-armmp'
>>>
>>> for pathprefix in ${image_locations}
>>> do
>>>
>>>   load ${device} ${partition} ${loadaddr} ${pathprefix}vmlinuz-${kvers} \
>>>   && load ${device} ${partition} ${fdt_addr} ${pathprefix}dtb-${kvers} \
>>>   && load ${device} ${partition} ${ramdiskaddr}
>>>
>>> ${pathprefix}initrd.img-${kvers} \
>>>
>>>   && echo "Booting Debian ${kvers} from ${device} ${partition}..." \
>>>   && bootz ${loadaddr} ${ramdiskaddr}:${filesize} ${fdt_addr}
>>>
>>> done
>>> root@bokocube:~#
>>
>> You might want to remove "quiet" and add the console= and root= bootprompt
>> options in /etc/default/flash-kernel (or run dpkg-reconfigure flash-kernel):
>>
>>   LINUX_KERNEL_CMDLINE="root=/dev/mmcblk0p1 console=ttymxc0,115200"
> 
> Thank you for that hint, I did not know how to configure that, but was 
> wondering about the quiet.
>  
>> Then run flash-kernel and use the bootscript it generates... or manually
>> edit the bootargs in your boot script.
>>
>>> CuBox-i U-Boot >  setenv mmcdev 0
>>> CuBox-i U-Boot > setenv mmcpart 2
>>> CuBox-i U-Boot > setenv ramdiskaddr 0x11800000
>>> CuBox-i U-Boot > setenv fdt_addr 0x18000000
>>> CuBox-i U-Boot > setenv scr_addr 0x19900000
>>> CuBox-i U-Boot > ext4load mmc 0:2 0x19900000 /boot/boot.scr
>>> 637 bytes read in 94 ms (5.9 KiB/s)
>>> CuBox-i U-Boot > source 0x19900000
>>
>> The default in the u-boot in Debian is to use ${loadaddr} for the script
>> address. Is your initrd large enough that you might be overwriting part of
>> it with ${scr_addr}?
> 
> I thought about that and calculated the sizes of the zImage, ramdisk, and dtb, 
> but they should fit in easily. For the size I used the output of load
> 
> 2857680 bytes read in 247 ms (11 MiB/s)
> 28603 bytes read in 126 ms (221.7 KiB/s)
> 10934444 bytes read in 621 ms (16.8 MiB/s)
> 
> e.g. the last one (ramdisk) is 0xA6D8AC
> 
> 
>>
>> This is what my working setup looks like (should be all default u-boot env
>> values):
>>
>> CuBox-i U-Boot > printenv loadaddr fdt_addr ramdiskaddr
>> loadaddr=0x10800000
>> fdt_addr=0x18000000
>> ramdiskaddr=0x11800000
>> CuBox-i U-Boot > boot
>> mmc0 is current device
>> ** File not found /boot.scr **
>> ** File not found uEnv.txt **
>> ** File not found /zImage **
>> ** File not found /uImage **
>> 674 bytes read in 110 ms (5.9 KiB/s)
>> Running bootscript from mmc ...
>> ## Executing script at 10800000
>> 2857312 bytes read in 308 ms (8.8 MiB/s)
>> 29104 bytes read in 107 ms (265.6 KiB/s)
>> 10930060 bytes read in 801 ms (13 MiB/s)
>> Booting Debian 3.15-rc8-armmp from mmc 0:1...
>> Kernel image @ 0x10800000 [ 0x000000 - 0x2b9960 ]
>> ## Flattened Device Tree blob at 18000000
>>    Booting using the fdt blob at 0x18000000
>>    Using Device Tree in place at 18000000, end 1800a1af
>>
>> Starting kernel ...
>>
>> [    0.000000] Booting Linux on physical CPU 0x0
>> ...
>>
>> I don't see it loading the initrd, though it's definitely using it...
>>
> 
> I use your original boot.scr with an adapted bootargs:
> 
> root@bokocube:~# cat /root/boot.cmd                                                                                                                          
> v# boot script for CuBox-i                                                                                                                                   
>                                                                                                                                                              
> setenv device mmc                                                                                                                                            
> setenv partition ${mmcdev}:${mmcpart}                                                                                                                        
> setenv bootargs 'root=/dev/mmcblk0p2 rootfstype=ext4 ro rootwait 
> console=ttymxc0,115200'                                                                     
>                                                                                                                                                              
> image_locations='/boot/ /'                                                                                                                                   
> kvers='3.15-rc8-armmp'                                                                                                                                       
>                                                                                                                                                              
> for pathprefix in ${image_locations}                                                                                                                         
> do                                                                                                                                                           
>   load ${device} ${partition} ${loadaddr} ${pathprefix}vmlinuz-${kvers} \                                                                                    
>   && load ${device} ${partition} ${fdt_addr} ${pathprefix}dtb-${kvers} \                                                                                     
>   && load ${device} ${partition} ${ramdiskaddr} 
> ${pathprefix}initrd.img-${kvers} \                                                                           
>   && echo "Booting Debian ${kvers} from ${device} ${partition}..." \                                                                                         
>   && bootz ${loadaddr} ${ramdiskaddr}:${filesize} ${fdt_addr}                                                                                                
> done                                                                                                                                                         
> root@bokocube:~#
> 
> Variables set as you did, but the kernel is still not booting
> 
> CuBox-i U-Boot > printenv loadaddr fdt_addr ramdiskaddr
> loadaddr=0x10800000
> fdt_addr=0x18000000
> ramdiskaddr=0x11800000
> CuBox-i U-Boot > save
> Saving Environment to MMC...
> Writing to MMC(0)... done
> CuBox-i U-Boot > load mmc 0:2 0x19000000 /boot/boot.scr
> 702 bytes read in 95 ms (6.8 KiB/s)
> CuBox-i U-Boot > source 0x19000000
> ## Executing script at 19000000
> 2857680 bytes read in 247 ms (11 MiB/s)
> 28603 bytes read in 127 ms (219.7 KiB/s)
> 11419166 bytes read in 642 ms (17 MiB/s)
> Booting Debian 3.15-rc8-armmp from mmc 0:2...
> Kernel image @ 0x10800000 [ 0x000000 - 0x2b9ad0 ]
> ## Flattened Device Tree blob at 18000000
>    Booting using the fdt blob at 0x18000000
>    Loading Ramdisk to 8ec7a000, end 8f75de1e ... OK
>    Using Device Tree in place at 18000000, end 18009fba
> 
> Starting kernel ...
> 
> Just for reference my entire environment
> 
> CuBox-i U-Boot > printenv
> baudrate=115200
> board=mx6-cubox-i
> bootargs=video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 cma=64 console=tty1 
> ahci_imx.hotplug=1 root=/dev/mmcblk0p2 rootfstype=ext4 ro rootwait 
> console=ttymxc00
> bootcmd=run loadkernel ; run loadramdisk ; bootm ${loadaddr} ${ramdiskaddr}
> bootdelay=3
> bootload=load $bootdev $bootunit:$bootpart 0x$loadaddr $bootroot$loadfile; if 
> test $fdt_load = yes; then load $fdt_dev $fdt_unit:$fdt_part 0x$fdt_addr 
> $fdt_i
> bootset=setenv bootenv 'run set$rootdev; setenv bootargs $root $video $console 
> $bootextra'; if load $bootdev $bootunit:$bootpart 0x$loadaddr $envfile; then b
> bootstart=echo $bootfile $bootargs; echo $bootrun $loadfile; $bootrun
> boottest=run testloader ; run testrun
> console=console=ttymxc0,115200
> cpu=6Q
> ethact=FEC
> ethaddr=d0:63:b4:00:32:5c
> fdt_addr=0x18000000
> fdt_high=ffffffff
> filesize=ae3e5e
> kernel=/uImage
> loadaddr=0x10800000
> loadkernel=ext4load mmc 0:2 0x10800000 /uImage
> loadramdisk=ext4load mmc 0:2 0x11800000 /ramdisk
> mmc=run reset; mmc rescan
> mmcdev=0
> mmcpart=2
> new_kern=env del bootfile bootkern load_fdt
> old_kern=setenv bootfile uImage; setenv bootkern bootm; setenv load_fdt no
> preboot=usb start
> preset=bootdev=mmc; bootunit=0; bootpart=1; bootroot=/boot/; 
> envfile=${bootroot}uEnv.txt; bootfile=zImage; rootfs=ext4; 
> rootextra="rootfstype=$rootfs ro roo0
> ramdisk=/ramdisk
> ramdiskaddr=0x11800000
> reset=env del bootdev bootunit bootpart bootroot envfile bootfile bootkern 
> rootdev rootunit rootpart rootfs rootextra; env del fdt_load fdt_dev fdt_unit 
> fdtn
> serialcon=setenv console console=ttymxc0,$baudrate; setenv stdout serial; 
> setenv stderr serial; setenv stdin serial,usbkbd
> setlabel=root="root=$rootlabel $rootextra"
> setmmc=root="root=/dev/mmcblk${rootunit}p$rootpart $rootextra"
> setusb=root="root=/dev/sda$rootpart $rootextra"
> splashpos=m,m
> stderr=serial,vga
> stdin=serial,usbkbd
> stdout=serial,vga
> testloader=ext4load mmc 0:2 0x19000000 /boothelper.scr
> testrun=source 0x19000000
> usb=run reset; setenv bootdev usb; usb reset
> videocon=setenv console; setenv stdout vga; setenv stderr vga; setenv stdin 
> serial,usbkbd
> 
> Environment size: 2718/8188 bytes
> CuBox-i U-Boot > 
> 
> 
> "run bootcmd" does boot the system successfully, but it does not use a zImage. 
> it is using bootm.
> 
> Does anybody have a good idea on what to look next?

Rainer,

Have you compile your boot.script with mkimage to make a correct boot.scr ?

> Tweaking the bootscript do not need to parse it with mkimage also ?
> A bootscript is not a standard text file but a mkimage -T script

With;

$ mkimage -A arm -O linux -T script -d /boot/boot.script /boot/boot.scr

Attachment: 0xF56ADD32.asc
Description: application/pgp-keys


Reply to: