Programing Atmega8 with Arduino Nano

Hello
I would like to program Atmega8 with Arduino Nano (Iam fallowing this guide link) And I want to use 4MHz external oscillator, but Iam not sure what should i change when programing Atmega8?

Why the external crystal of 4MHz ? The ATmega8 with 16MHz external crystal is supported by the Arduino. Select "Arduino NG or older" for the ATmega8 with 16MHz.

Do you have a ATmega8, or an ATmega8L or ATmega8A or something like that ?

I suggest to use an external crystal of 16MHz and try writing code or bootloader and try a sketch.
Use the Arduino IDE 1.5.8. Perhaps you can try the Nano as ISP without the changes in the page you mention.
There are a few versions of the Nano board, and also some clones (even clones with faults in the circuit). I don't know which Nano board is used in that page.

Once your standalone ATmega8 can blink a led, you can do more with it.
It is possible to use a optiboot bootloader that fits in 512 byte.
You can use 4MHz crystal, but you need to make your own board definition in 'boards.txt'.

I have ATmega8A. Why would i want to have 4MHz? Because I have this kind of crystal atm and as far as I know 4MHz mode is less power then 16MHz mode. I want to use it in a specific application which don't need fast clock and I'am too lazy to make ATmega configuration in a traditional way:P. About boards.txt

atmegasa16.name=ATmega328P Stand Alone (Arduino as ISP)
atmegasa16.upload.protocol=stk500
atmegasa16.upload.maximum_size=32768
atmegasa16.upload.speed=115200
atmegasa16.upload.using=arduino:arduinoisp
atmegasa16.bootloader.low_fuses=0xff
atmegasa16.bootloader.high_fuses=0xdf
atmegasa16.bootloader.extended_fuses=0x05
atmegasa16.bootloader.path=optiboot
atmegasa16.bootloader.file=optiboot_atmega328.hex
atmegasa16.bootloader.unlock_bits=0x3F
atmegasa16.bootloader.lock_bits=0x0F
atmegasa16.build.mcu=atmega328p
atmegasa16.build.f_cpu=16000000L
atmegasa16.build.core=arduino
atmegasa16.build.variant=arduino:standard

I should change line: atmegasa16.build.f_cpu=16000000L on 4000000L ? ? ? And also fuses config: atmegasa16.bootloader.low_fuses=0xff
atmegasa16.bootloader.high_fuses=0xdf ? ? ?

An Arduino configuration for the ATmega8 (Arduino NG compatible) is :
ATmega8 + 100nF decoupling + crystal + two 22pF + 10k resistor for reset + reset button.
Plus you need a programmer and also a usb-serial converter if you want to use a bootloader to upload the sketch.

For a new definition of boards.txt, start with the ATmega8.
This one: atmega8.name=Arduino NG or older w/ ATmega8
Copy that into something like this: atmega8a4.name=ATmega8a 4MHz
And change the frequency into 4MHz.
You can check the fuses here : AVR® Fuse Calculator – The Engbedded Blog
Do you want to use a bootloader, if you do, you have to build a new bootloader for 4MHz.

Thanks for helping. Now everything is clear :]

There one thing you have to know: The Arduino NG ATmega8 doesn't have the DTR to reset signal. You have to press the reset button to start the bootloader to upload a sketch. As a result, the bootloader waits a few seconds.
For example the Arduino has the DTR signal via 100nF to reset. The bootloader waits a short time.

Could somone look at edited bootloader

##############################################################

atmega8_4mhz.name=Atmega8 stand alone 4MHz

atmega8_4mhz.upload.protocol=arduino
atmega8_4mhz.upload.maximum_size=7168
atmega8_4mhz.upload.speed=19200

atmega8_4mhz.bootloader.low_fuses=0xE7
atmega8_4mhz.bootloader.high_fuses=0xD9
atmega8_4mhz.bootloader.path=atmega8
atmega8_4mhz.bootloader.file=ATmegaBOOT-prod-firmware-2009-11-07.hex
atmega8_4mhz.bootloader.unlock_bits=0x3F
atmega8_4mhz.bootloader.lock_bits=0x0F

atmega8_4mhz.build.mcu=atmega8
atmega8_4mhz.build.f_cpu=4000000L
atmega8_4mhz.build.core=arduino
atmega8_4mhz.build.variant=standard

##############################################################

It should be good i guess... But it isnt iam getting error:
after first burn: avrdude: stk500_getsync(): not in sync: resp=0x15
after second and more burn: Yikes! Invalid device signature.