How to decide the boot media inside initrd?

view story

http://ubuntuforums.org – Hi all, I'm customizing ubuntu 12.04.2 ISO. If I burn the ISO to CD and boot from CDROM, I get /dev/sr0 as the boot media, while I get /dev/sdb4 if I burn the ISO to USB stick. So, I'd like to know how to decide the current boot media inside the RAMDISK, i.e., initrd.lz? My customized program needs to know it. (Hardware)