MIPS platform Android transplant process record 2_kernel upgrade (2.6.29.4-3.0.72)

Source: Internet
Author: User
Tags file copy tainted

This part of the record is kernel upgrade, before on the FPGA ran 2.6.29 kernel to verify the function of some IP.
The source code for Android from Google's website is not part of the kernel, and kernel needs to be downloaded separately.
A version of 3.0.72 was found after downloading from Google.
So the record here is the process of kernel upgrading from 2.6.29.4 to 3.0.72.


The first idea is to find a 3.0 on the MIPS architecture of the config file, and then compare the 2.6.29 on the difference between the config file, the difference can be compensated.

Find the next configs file, chose the bcm63xx defconfig.
Here are the specific steps. Overall process is relatively smooth, around 3 days to fix.

configuration of 1.config files
A.arch/mips/company directory Copy to 3.0, Kconfig/makefile modification also copy the past
B. Make bcm63xx_defconfig on 3.0, then makes Menuconfig, error.
Prompt for many errors
...
scripts/kconfig/lxdialog/menubox.o:in function ' Do_scroll ':
MENUBOX.C: (. text+0x55): Undefined reference to ' Wrefresh '
scripts/kconfig/lxdialog/menubox.o:in function ' print_arrows ':
MENUBOX.C: (. text+0x1a4): Undefined reference to ' Wrefresh '
scripts/kconfig/lxdialog/menubox.o:in function ' Do_print_item ':
MENUBOX.C: (. text+0x3a9): Undefined reference to ' Wrefresh '
scripts/kconfig/lxdialog/menubox.o:in function ' print_buttons ':
MENUBOX.C: (. text+0x4b1): Undefined reference to ' Wrefresh '
Collect2:ld returned 1 exit status
MAKE[1]: * * * [scripts/kconfig/mconf] Error 1
Make: * * * [menuconfig] Error 2

Solution See http://blog.csdn.net/bdc995/article/details/8235429
sudo apt-get install libncurses5 libncurses5-dev
After resolving, because Bcm63xx is big endian, delete the-el compile option, can compile pass.

C. Compare the 2.6.29. config file and the 3.0 default bcm63xx. config file.
of which 2.6 of the config_dma_need_pci_map_state, corresponding to 3.0 in the Config_need_dma_map_state
D. The company chip is little endian, bcm63xx is the big endian.
Config_generic_find_next_bit is open on 2.6.29, but 3.0 on the interface is not the same, close.
E.2.6.29 on the config_swap_io_space did not open, and the BCM turned on, so close
F.config_generic_gpio is not open on the 2.6.29, so 3.0 is also off.
The G.CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is opened on the 2.6.29, but the interface on the 3.0 has changed and remains closed.
H.config_generic_time Ibid.
I.cpu selected 2.6.29 's MIPS32R2
J.
Config_cpu_has_llsc=y
Config_cpu_mipsr2_irq_vi=y These 2 keep the 2.6.29
#CONFIG_SELECT_MEMORY_MODEL =y
#CONFIG_FLATMEM_MANUAL =y These 2 2.6.29 on No, off
CONFIG_UNEVICTABLE_LRU is open on 2.6.29, but 3.0 of the relevant code does not need to be precompiled, 3.0 is not required.
Config_high_res_timers opened on the 2.6.29, 3.0 also opened
Config_hz maintenance of the 2.6.29 1000
Config_preempt_voluntary Maintain 2.6.29 Default
Config_have_irq_work is useless on 3.0, shut down.
Config_sysvipc=y
Config_sysvipc_sysctl=y These 2 are also open on 3.0, maintaining 2.6.29 configuration
Config_generic_irq_show=y Maintain open status on 3.0
Config_ikconfig=y Maintenance of 2.6.29 configuration
Config_relay=y
Config_namespaces=y the configuration of these 2 maintenance 2.6.29
Config_uts_ns=y
Config_ipc_ns=y the configuration of these 2 maintenance 2.6.29
Config_blk_dev_initrd=y
Config_cc_optimize_for_size=y
Config_classic_rcu=y the configuration of these 3 maintenance 2.6.29
Config_embedded=y maintains 2.6.29, replacing the Config_expert on 3.0
# Config_base_full is not set maintains 2.6.29 shutdown
Config_futex=y
Config_epoll=y
Config_signalfd=y
Config_timerfd=y
Config_eventfd=y The open configuration of these 5 maintenance 2.6.29
Config_slub maintained 3.0, 2.6.29 with Config_slab.
# CONFIG_COMPAT_BRK is not set maintains 2.6.29 shutdown
Config_tracepoints=y to keep 2.6.29 open.
Config_markers 3.0 does not need to be opened
Config_rt_mutexes=y Maintain open
Config_base_small=1 Maintenance 2.6.29, 3.0 on the default is 0
Config_modules=y
Config_module_force_load=y
Config_module_unload=y the opening of these 3 maintenance 2.6.29
Config_blk_dev_io_trace=y
Config_blk_dev_integrity=y the opening of these 2 maintenance 2.6.29
IO Scheduler Maintenance 2.6.29 default configuration of CFQ
# Config_pccard is not set maintains 2.6.29 configuration, shutdown on 3.0
PCI-related configuration, also off on 3.0
Config_standalone=y
Config_prevent_firmware_build=y these 2 maintenance 2.6.29 configurations
Config_mtd_concat=m
Config_mtd_partitions=y
Config_mtd_cmdline_parts=y these 3 maintain 3.0 on, close configuration
Config_mtd_char=y
Config_mtd_blkdevs=y
Config_mtd_block=y The open configuration on the 3 maintenance 2.6.29
Config_mtd_physmap=y maintains a 3.0 configuration

The problem of the inconsistency of each member in 2.irq_desc, the definition of copy_thread/arch_ptrace function.

3. Root file system, using 2.6.29 already compiled Mdev.cpio, porting end, run Vmlinux.bin will find in loading and file system, the crash in Populate_rootfs inside.

[4.554000] Unhandled kernel unaligned access[#1]:
[4.554000] Cpu 0
[4.554000] $0:00000000 00000000 00010000 81f69f16
[4.554000] $4:00000001 81C18ACC 00000002 81F69F2A
[4.554000] $8:00010000 8051991c 00000001 0000000a
[4.554000] $12:000000cd 00000005 00000000 20b91340
[4.554000] $16:80540000 80400000 00002850 000007d0
[4.554000] $20:80540000 80540000 80540000 00000007
[4.554000] $24:00000000 00000000
[4.554000] $28:81c16000 81c17e20 00000030 8019d984
[4.554000] Hi:0000bf68
[4.554000] lo:00000005
[4.554000] EPC:801A00DC Fget+0x70/0xd8
[4.554000] Not tainted
[4.554000] ra:8019d984 sys_fchown+0x24/0x84
[4.554000] status:11005003 KERNEL EXL IE
[4.554000] cause:00800010
[4.554000] Badva:81f69f2a
[4.554000] prid:00019655 (MIPS 24Kc)
[4.554000] Modules linked in:
[4.554000] Process swapper (pid:1, threadinfo=81c16000, task=81c14888, tls=00000000)
[4.554000] stack:00000030 8010b76c 30303030 80540000 80400000 80540000 80400000 80540000
[4.554000] 804a0000 8051dfec 53e3561b 81caf696 803fe0e8 0000013c 00000000 00000000
[4.554000] 0000000a 8051d6f8 81cae8f0 000009d8 81caf628 00008000 80540000 8051d46c
[4.554000] 80546000 81ca8000 8051d2c4 8052b4d4 00008000 81c89580 00000000 00000000
[4.554000] 80546000 81ca8000 8051d2c4 8052b4d4 00008000 8052b788 00000000 8042f860
[4.554000] ...
[4.554000] Call Trace:
[4.554000] [<801a00dc>] Fget+0x70/0xd8
[4.554000] [<8019d984>] sys_fchown+0x24/0x84
[4.554000] [<8051dfec>] do_name+0x148/0x31c
[4.554000] [<8051d46c>] flush_buffer+0xcc/0x124
[4.554000] [<8052b788>] gunzip+0x2ac/0x390
[4.554000] [<8051da30>] unpack_to_rootfs+0x1d8/0x364
[4.554000] [<8051e598>] Populate_rootfs+0x20/0xb8
[4.554000] [<8010e31c>] Do_one_initcall+0xfc/0x1d8
[4.554000] [<8051c314>] kernel_init+0xa8/0x140
[4.554000] [<80114d8c>] kernel_thread_helper+0x10/0x18
[4.554000]
[4.554000]
[4.554000] code:00481024 1040000a 00000000 <c0e50000> 14a40005 00000000 00c00821 e0e10000 1020fffa
[4.554000] Disabling lock debugging due to kernel taint
[4.754000] Unhandled kernel unaligned access[#2]:
[4.754000] Cpu 0
[4.754000] $0:00000000 00000000 00000001 81C18AF4
[4.754000] $4:81f69f2a 81C18AC4 00000000 00000000
[4.754000] $8:0000000a 00000001 00000001 0000000a
[4.754000] $12:000000cd 00000005 00000000 21055e80
[4.754000] $16:00000000 81f69f16 81C18AC4 00000000
[4.754000] $20:81C18ACC 00010000 8051991c 00000007
[4.754000] $24:00000000 00000000
[4.754000] $28:81c16000 81c17c58 00000030 8019cdb0
[4.754000] Hi:0000d2f0
[4.754000] lo:00000005
[4.754000] Epc:801a07e4 fput+0x40/0x29c
[4.754000] Tainted:g D
[4.754000] Ra:8019cdb0 filp_close+0x7c/0x98
[4.754000] status:11005003 KERNEL EXL IE
[4.754000] cause:00800010
[4.754000] Badva:81f69f2a
[4.754000] prid:00019655 (MIPS 24Kc)
[4.754000] Modules linked in:
[4.754000] Process swapper (pid:1, threadinfo=81c16000, task=81c14888, tls=00000000)
[4.754000] stack:00000000 00000000 3b9aca00 8013400c 81c16000 81c17c90 00000000 81f69f16
[4.754000] 81c18ac4 00000000 81C18ACC 00010000 8051991c 8019cdb0 00000000 00000000
[4.754000] 00000001 00000080 81c18ac4 00000001 00000000 801356c8 0000000a 00000001
[4.754000] 0000000b 81c17d70 0000000b 81c17d70 81c14888 00000000 80540000 80540000
[4.754000] 00000001 80137340 80540000 80540000 80540000 00000007 00000000 00000000
[4.754000] ...
[4.754000] Call Trace:
[4.754000] [<801a07e4>] fput+0x40/0x29c
[4.754000] [<8019cdb0>] filp_close+0x7c/0x98
[4.754000] [<801356c8>] Put_files_struct+0x134/0x1c4
[4.754000] [<80137340>] do_exit+0x23c/0x62c
[4.754000] [<80119210>] Nmi_exception_handler+0x0/0x34
[4.754000]
[4.754000]
[4.754000] code:7c420400 10400008 00000000 <c0830000> 2462ffff e0820000 1040FFFC 2462ffff 0806820a
[4.928000] fixing recursive fault but reboot is needed!

Specifically, Populate_rootfs.
Unpack_to_rootfs
Write_buffer
Do_name
Sys_fchown
Fget inside. (Very strange, do_name operation of 31 files will not work)
This is a strange question, and then look at Initramfs's related script, in kernel's usr directory, trying to use the compressed format option, but still not.
Then will produce Rootfs Cpio file of the source files repackaged, delete some unnecessary files, found that there will be some changes, such as do_name operation of the number of files less than 31, it is true to enter the system login interface.
And the root account can also log in, but there will be a puzzling problem.

Rethinking the problem should not be the case. Then compare the porting process and carefully examine the changes to the files on the 3.0 kernel (see below).
====================================================================================
Arch\mips\boot\compressed\dbg.c
Arch\mips\boot\compressed\decompress.c
Arch\mips\include\asm\abi.h There are other files in the same directory
Arch\mips\kernel under the C file, replaced with 2.6.29 (because it involves a lot of the definition of the structure of the difference, the beginning of the diagram, it seems that this action does not need)
Arch\mips\company Directory, new
Arch\mips\mm\cache.c
Arch\mips\kernel\c-r4k.c
Arch\mips\kernel\mmap.c
DRIVERS\TTY\SERIAL\CONCERTO_UART.C (new addition)
DRIVERS\USB\HOST\EHCI-HCD.C also added USB driver
FS\YAFFS2\YAFFS_VFS.C Modifying the differences of some structures
FS\BINFMT_ELF.C a variable
FS\EXEC.C some parameter type differences
Include\generated\asm-offsets.h This file is generated, but differs greatly from the standard 3.0.72,
IPC\SYSCALL.C canceled, could not have been compiled
Kernel\irq\chip.c added the Set_irq_chip_and_handler function, copied from the 2.6.29
Definition of KERNEL\IRQ\IRQDESC.C structure
====================================================================================

decide to recheck the work before modifying it.
************************************************************************************
Arch\mips\company directory, new, must-have
Arch\mips\include\asm\mach-xxxx new (xxxx corresponding to the specific chip model), also want to
Arch\mips\include\asm\cacheflush.h added extern void (*flush_data_cache_range) (unsigned long addr, unsigned long size); This maintains the 2.6.29 configuration
Arch\mips\mm\cache.c ditto, also want the
ARCH\MIPS\MM\C-R4K.C New R4k_flush_data_cache_range function is also maintained and 2.6.29 on the same.
Arch\mips\kconfig Copy the configuration on the 2.6.29.
Arch\mips\makefile Ibid.
DRIVERS\TTY\SERIAL\XXXX_UART.C chip serial drive, will be 2.6.29 on the file directly copied over, the same kconfig and makefile, the name with XXXX instead. is also necessary.
USB host driver-related file copy past, but USB driver did not compile (change makefile)
YAFFS2 compile error, direct make menuconfig turn off this option.
Elimination of __deprecated compilation problems in Include\linux\dma-mapping.h
INCLUDE\LINUX\SERIAL_CORE.H new macro definition for port
Kernel\irq\chip.c Add Set_irq_chip_and_handler function, this is also reference 2.6.29
Finally, the toolchain and compilation options for the makefile of the entire kernel are modified.
Cross_compile? =/usr/local/xxx/mips-4.3/bin/mips-linux-gnu-
CC = $ (cross_compile) Gcc-el

Here,. config uses the first porting. config, in addition to the differences between USB and YAFFS2.
Initramfs or the Mdev.cpio in the 2.6.29?

After such a modification, the compiled Vmlinux.bin and uimage all run normally.
Follow-up will be USB and yaffs related to the compilation problem after the solution, also run very smoothly.

Hereby record.

Finally, to remind you, in the 3.0.72 kernel, there is a android-recommended.cfg in the Android\configs directory, you can check the last generated. config and its differences. See if there is a log of important CFG missing.

MIPS platform Android transplant process record 2_kernel upgrade (2.6.29.4-3.0.72)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.