Need help with bootloader for m328p

I'm trying to upload a boot loader to a blank atmega328p.
But this process is sooo confusing to me.

Im using a usbtiny programmer with an atmel target board,
on a Linux system.
I'm gonna be using an external crystal for the clock, 16mHz.
As far as i now this process is like this:
Unlock fuse bits, set new fuse bits, upload the boot loader, lock fuse bits.
But how to do this with avrdude is where I get confused.
Getting the high and low fuse bits form the m328 is pretty easy

avrdude -c usbtiny -p m328p -v

hfuse is D9 and the lfuse is 62 and the extended is FF.
But what value to i use to lock and unlock the fuses?

Also I tried using this fuse calculator to get my new fuse values
http://www.engbedded.com/fusecalc/
But it's so confusing, I think I'm suppose to use 0xDA for hfuse and
0xFF for lfuse, some one suggested that to me. I never got
those values from the calculator.

Not sure but I think the code would be something like:

avrdude -c usbtiny -p m328p -U lock:w:0xFF:m -U lfuse:w;0xFF:m -U hfuse:w:0xDA:m

Not sure about the "-U lock" value.
Then the bootloader would be:

avrdude -c usbtiny -p m328p -U flash:w:path/to/bootloader

Then re-lock the fuse bit:

avrdude -c usbtiny -p m329p -U lock 0xFF

Again not sure about the lock fuse bit value.
So how did I do? Was I close?
Is the lock fuse bit the same as the extended fuse bit??

Forgive me if this a completely stupid question, I want to get this right and not end up with a bricked chip.

I just wish there was an easier way to calculate the fuses,
that calculator I linked to is a bit daunting to us new guys.
Any insight and constructive criticism would be helpful.

You can program a 328 bootloader using a USBtiny programmer directly from inside the Arduino IDE in the tools menu. That should handle finding the correct HEX code and the fuse requirements of the processor type you select in the board menu also in the tools menu.

Lefty

Thanks Retro.
But I also want to learn how to do it with avrdude.
I figure it would be idea to learn it.

Honestly, I have never used the lock/unlock fuses, and never had it complain.

To get the values of those fuses, look in boards.txt.

Thanks leppie that was a huge help.
Your right about the lock, unlock fuse bit thing, it works
with out using them.
Which is funny cause I got a read error when I tried them.
"Invalid byte value" or something similar.

Anyway i got my chip programmed with the boot loader.