Tuesday, September 22, 2020

Fix Linux kernel booting error ( invalid magic number)

 This morning, I compiled Linux kernel and copied the kernel to /boot/vmlinz, then reboot. But I got the following error:

error: invalid magic number.
error: you need to lead the kernel first

What could go wrong? I searched online and find this article https://bbs.archlinux.org/viewtopic.php?id=178314.
It is very helpful. I run the cmd : file /boot/vmlinz and noticed that it does recognize it as a kernel.
Then I checked file size and realized that I copied the wrong file. I copied the big vmlinx instead of arch/x86/boot/bzImage file.

Then I copied the correct file and I can boot to my new kernel again. :)

Btw, I manually copied the kernel file because it is much faster.  I just need to run "make bzImage" and then copy the new kernel. Save me lots of time for compiling and building. 

Friday, September 2, 2016

READ_ONCE, memory model. atomic and volitie

atomic implementation
http://lxr.free-electrons.com/source/include/asm-generic/atomic.h#L140

http://stackoverflow.com/questions/34988277/write-once-in-linux-kernel-lists

https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4444.html

http://lwn.net/Articles/508991/

https://www.kernel.org/doc/Documentation/memory-barriers.txt

Friday, April 29, 2016

lock free programming

http://preshing.com/20120612/an-introduction-to-lock-free-programming/


Thursday, January 7, 2016

Stop using unicode double quote in Google doc


Google doc has an option to automatically convert neutral double quote (") to unicode left double quote and right double quote. This is nice when typing some article. But it becomes annoying when typing some code ( and you want to just copy that code to a python script later).

To disable that, go to tools->preferences-> use smart qutoes, and just uncheck that box.