Unless your goal is to try to learn how a DC/DC convert works I wouldn't build one from scratch. This problem has been solved many times and various vendors have dedicated DC/DC IC available.
Check the Linear Tech, Nation Semi, or TI website.
If you want to go ahead and build it yourself one option is to do a current mode amplifier. You ramp the current in an inductor up until you hit a certain threshold and then switch it to the output.
Going the PWM route can be done with a triangle generator / comparator or it's digital equivalent. Many processors have pwm units already build in.