First of all you have to find out if you really want to do a PhD. Secondly, during your master's course you will meet academic staff, someone of whom will be close to your research interests.Contact him/her,discuss your ideas,find the suitable funding and begin!