Difference between revisions of "Research Pre Boot Process"

From WebOS Internals
Jump to navigation Jump to search
(Describe how to recognise if your new kernel is full of fail)
(More details on how to recognise if booting works)
Line 20: Line 20:
 
</source>
 
</source>
  
novacom loads the kernel into ram and then boots it. The kernel is loaded with the same cmdline as mentioned above. Note that this does not write the kernel to the Pre's storage, and the next time the device is rebooted the original kernel is loaded. If the Palm logo displays but does not start glowing, your kernel has probably locked up during boot.
+
novacom loads the kernel into ram and then boots it. The kernel is loaded with the same cmdline as mentioned above. Note that this does not write the kernel to the Pre's storage, and the next time the device is rebooted the original kernel is loaded. If the Palm logo displays but does not start glowing, your kernel has probably locked up during boot. You can also run tail -f /var/log/messages to see if the devices is re-recognised during bootup; as soon as novacom goes online you should be able to novaterm in.
  
  

Revision as of 15:25, 7 April 2010

Bootloader & kernel startup

When the pre is starting it loads the boot.bin image into ram. This is the booloader bootie which loads the linux kernel. The Linux kernel is loaded with the following cmdline (which is build out of the env vars from bootie): <source lang=bash> root=/dev/mmcblk0p2 rootwait ro fb=0x8f600000 fbcon=disable console=tty1 nduid=ea413b0b980b26d75c6658199d532472049644ae klog=0x8ff00000 klog_len=0x100000 boardtype=castle-dvt3 dsp_base=0x8f900000 dsp_len=0x600000 </source>

When using the nova-installer-image-castle.uImage image bootie hands over the following cmdline to the kernel:

<source lang=bash> root=/dev/ram0 ramdisk=32768 ro fb=0x8f600000 fbcon=disable console=tty1 nduid=ea413b0b980b26d75c6658199d532472049644ae klog=0x8ff00000 klog_len=0x100000 boardtype=castle-dvt3 dsp_base=0x8f900000 dsp_len=0x600000 lastboot=recover </source>

The nova-installer-image-castle.uImage image uses a initrd an not an initramfs. Somehow bootie detects if the kernel which is loaded has an initrd build in. If yes, then bootie changes the cmdline for the kernel to the env var bootargs-ramdisk.

You can even boot a kernel from your local host with novacom. First, log in with novaterm and run tellbootie recover. Wait for the USB logo to appear, then boot the kernel as follows:

<source lang=bash> novacom boot mem:// < uImage-kexecboot-2.6.24-r50-palmpre.bin </source>

novacom loads the kernel into ram and then boots it. The kernel is loaded with the same cmdline as mentioned above. Note that this does not write the kernel to the Pre's storage, and the next time the device is rebooted the original kernel is loaded. If the Palm logo displays but does not start glowing, your kernel has probably locked up during boot. You can also run tail -f /var/log/messages to see if the devices is re-recognised during bootup; as soon as novacom goes online you should be able to novaterm in.


General

On startup /dev/root is mounted as rootfs. Then /sbin/init is called which mounts /dev/mapper/store-root as the new rootfs. Finally the init script on /dev/root calls the init script in /sbin /dev/mapper/store-root.

The init script on /dev/mapper/store-root starts upstart or the miniboot.sh script in /etc.

Networking

When upstart is starting it executes a script called usbctrl whichs load the right usb driver and configuration for novacom or usbnetworking. Depending which machine is used the g_composite driver is loaded with a different product id.

<source lang=bash> if "$machineType" == "armv7l" ;then

               if -e /var/gadget/usbnet_enabled && -e /var/gadget/novacom_enabled ; then
                       /sbin/modprobe -q g_composite product=0x101 || true
               elif [ -e /var/gadget/usbnet_enabled ]; then
                       /sbin/modprobe -q g_composite product=0x101 || true
               elif [ -e /var/gadget/novacom_enabled ]; then
                       /sbin/modprobe -q g_composite product=0x8002 || true
               else
                       /sbin/modprobe -q g_composite product=0x8004 || true
               fi
       elif "$machineType" == "armv6l" ;then
               if -e /var/gadget/usbnet_enabled && -e /var/gadget/novacom_enabled ; then
                       /sbin/modprobe -q g_composite product=0x103 || true
               elif [ -e /var/gadget/usbnet_enabled ]; then
                       /sbin/modprobe -q g_composite product=0x103 || true
               elif [ -e /var/gadget/novacom_enabled ]; then
                       /sbin/modprobe -q g_composite product=0x8012 || true
               else
                       /sbin/modprobe -q g_composite product=0x8012 || true
               fi
           else
               /sbin/modprobe -q g_composite || true
   fi

</source>

Is the g_composite driver is build in the kernel the script changes the configuration of the gadget driver through a sysfs entry. <source lang=bash> if -e /var/gadget/usbnet_enabled && -e /var/gadget/novacom_enabled ; then

 echo 5 > /sys/class/usb_gadget/config_num

elif [ -e /var/gadget/usbnet_enabled ]; then

 echo 5 > /sys/class/usb_gadget/config_num

elif [ -e /var/gadget/novacom_enabled ]; then

 echo 2 > /sys/class/usb_gadget/config_num

else

 echo 1 > /sys/class/usb_gadget/config_num

fi </source>