Hi, I also like figuring out what's happening in the OS underlying. So I have some ideas about reducing optimization. Although you couldn't turn off optimization completely, you can use both -O2 and other options to reducing optimization as far as possible. You can use -O2 -Q -v to find out which options are enabled when using -O2. Then you can try -O2 -fno-defer-pop -fno-thread-jumps etc. to disable some options. I once used this approach to debug kernel-2.4 in bochs simulator. Unfortunately, this approach could not counteract the effects of -O2 completely, but it's worth a try.
No, please don't do that. If you do, you will end up with a completly unsuported and unknown system and no one will be able to help you out with any sort of problem solving.
Just use the default build options, and all should be fine. We know they work. Anything else is a total unknown, and not something that anyone trying to learn about the kernel should be messing with.
Thank you!!! I didn't know this before. Thanks for your correction! Thanks, Hao Lee