Notes
main
main
  • Introduction
  • linuxKernel
    • tips
    • make_help
    • old linux
      • compile_linux0.11
      • TestEnvironment
      • load_setup
      • get_hard_data
    • list
    • plist
    • fifo
    • idr
    • xarray
    • rbtree
    • maple_tree
    • syscall
    • bitmap
    • page
    • page_flags
    • page_size
    • page mapcount
    • page refcount
    • folio
    • slub
      • proc_slabinfo
      • slub_theory
      • kmalloc_kfree
      • kmem_cache
      • slab_alloc
      • slab_free
      • proc_meminfo_SReclaimable_SReclaimable
    • vmalloc
    • brk
    • mmap
    • mremap
    • mprotect
    • madvise
    • read
    • write
    • shmem
    • huge_page
    • page_fault
    • rmap
    • lru
    • multi-gen-LRU
    • page_reclaim
    • page_cache
    • page_table
    • rcu
    • kvm
    • aarch64_boot
    • tracing_system
    • cache_coherence_and_memory_consistency
    • cpu_speculates
    • mmap_lock
    • per-vma_lock
    • cgroup
    • symbol
    • campact
    • page_ext
    • mempool
    • kernelstack
    • filesystem
    • io_stack
    • workingset
    • ioremap
    • sched_period
  • linuxDebug
    • openocd_openjtag
    • i2c_tools
    • objdump
    • addr2line
    • gdb_useage
    • debug_linux_kernel_via_gdb
    • debug_linux_module_via_gdb
    • early_boot
    • sequentially_execute
    • dynamic_debug
    • research_linuxKernel_by_patch
    • tracefs
    • ebpf
    • bpftrace
    • perf
    • flame_graph
    • crash
    • ASAN_HWASAN_MTE_check_mem_bug
    • page_owner
    • vmtouch
    • fio
    • benchmark
  • linuxSystem
    • common
      • system_version
      • procfs
      • proc_sys_vm
      • cmd_ps
      • makefile
      • file_descriptor
      • psi
      • ulimit
      • top
      • delay_accounting
    • ubuntu
      • custom_kernel
      • get_cmd_src
      • record_ssh_info
      • log
      • run_custom_script
      • repo
      • cockpit
      • nfs
      • tftp
      • misc
    • fedora
      • system_upgrade
      • custom_kernel
      • lvextend
      • yt-dlp
      • jellyfin
  • linuxDriver
    • i2c_peripherals_driver
    • spi_peripherals_driver
    • gpio_subsystem
    • IRQ_driver
    • blockIO_unblockIO_async
    • linux_own_driver
    • misc_device
    • input_device
    • timer
    • atomic_spinlock_semaphore_mutex
    • lcd
    • touch_screen
    • debugfs
    • v4l2
    • mmap
  • hardware
    • paging_mmu_pt
    • iommu
  • process_thread_scheduler
    • scheduler01
    • scheduler02
    • scheduler03
    • scheduler04
    • scheduler05
    • scheduler06
  • memory_management
    • mm1
    • mm2
    • mm3
    • mm4
    • mm5
  • input_output_filesystem
    • io_fs_01
    • io_fs_02
    • io_fs_03
    • io_fs_04
  • lock_and_lockup_detector
    • general_lock
    • hung_task
    • softLockup_hardLockup
    • crash_experiment
  • MIT_6.S081
    • 6.S081_Operating_System_Engineering
    • Schedule.md
    • Class
      • Overview
      • Administrivia
    • Labs
      • Tools
      • Guidance
      • startup
      • syscall
      • page_table
      • Calling_Convention
      • traps
    • xv6
      • xv6
    • References.md
  • qemu
    • qemu_buildroot
    • qemu_busybox.md
    • Serial.md
    • demo_mini2440
      • 0_compilation_error_summary
      • 1_compilation_steps
      • 2_operation_mode
      • 3_transplant_tools_libraries
      • 4_tools_use
      • reference_website
  • tools
    • getKernelSourceCodeList
    • nat
    • shell
    • translating
    • YouCompleteMe
    • cscope
    • global
    • vscode
    • vim
    • binary
    • markdown
    • draw
    • git
    • tig
    • tmux
    • mail_client
    • download_patchset_from_LKML
    • minicom
    • clash
  • other
    • interview
    • interview_c_base
    • know_dontknow
    • Stop-Ask-Questions-The-Stupid-Ways
    • How-To-Ask-Questions-The-Smart-Way
    • docker
    • buildroot
    • rv32_to_rv64
Powered by GitBook
On this page
  • 编译环境
  • 编译qemu mini2440
  • 通过buildroot生成u-boot、kernel、rootfs镜像
  • 下载编译u-boot(可选)
  • 下载编译kernel(可选)
  • 生成nand镜像

Was this helpful?

  1. qemu
  2. demo_mini2440

1_compilation_steps

编译环境

  • ubuntu 18.04

  • gcc 4.8.5

编译qemu mini2440

$ git clone git://repo.or.cz/qemu/mini2440.git
$ ./configure --target-list=arm-softmmu
$ make -j4

通过buildroot生成u-boot、kernel、rootfs镜像

$ wget http://buildroot.org/downloads/buildroot-2012.05.tar.gz
$ tar zxvf buildroot-2012.05.tar.gz
$ cd buildroot-2012.05
$ make mini2440_defconfig
$ make menuconfig

其中以下需要修改,其他自己选择:

  • Kernel :内核版本改选为 3.3.7版本

  • Package Selection for the target : Busybox已经包含在里面了,我们也可以选择更多的项目,比如 Qt, EFL, directfb之类的图形库。在 Graphic libraries and application子目录里选择。

  • Filesystem images :在 Flash Type这项,改为 NAND flash with 512B Page and 16 KB erasesize 。

  • Toolchain:选上了GDB和GDBServer方便调试

$ make

make 结束后,在 buildroot-2012.05目录的 output/images/ 子目录下可以找到生成的四个文件:

  • u-boot.bin: bootloader的镜像

  • uImage: u-boot格式的Linux内核镜像(用mkimage命令生成的)

  • rootfs.jffs2: jffs2格式的根文件系统镜像

  • rootfs.tar: 根文件系统源码打包

下载编译u-boot(可选)

打开Makefile文件,CROSS_COMPILE变量赋值,即自己所使用的交叉编译工具链,比如arm-none-linux-gnueabi-,保存退出,shell命令行输入:

$ git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
$ make mini2440_config
$ make -j4

注意:如果想在之后使用u-boot 的nfs下载文件功能,需要修改代码中的一部分,将net/nfs.c文件中的NFS_TIMEOUT = 2UL 修改为 NFS_TIMEOUT = 20000UL,否则会造成nfs文件下载失败,如果不使用nfs下载功能,不改也可。

下载编译kernel(可选)

$ git clone git://repo.or.cz/linux-2.6/mini2440.git
$ export PATH=$PATH:~/workplace/qemu-mini2440/opt/FriendlyARM/toolschain/4.4.3/bin

# 保证gcc为4.8.5版本
$ make ARCH=arm mini2440_defconfig
$ make ARCH=arm menuconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage -j4

生成nand镜像

  • 下载flashimg工具,可以很方便地生成NAND或NOR镜像文件

$ git clone https://github.com/cailiwei/flashimg.git
  • 编译安装flashimg工具

$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
  • 生成NAND或NOR镜像文件

将u-boot.bin、uImage和rootfs.jffs2 拷贝到flashimg文件夹下

$ flashimg -s 64M -t nand -f nand.bin -p uboot.part -w boot,u-boot.bin -w kernel,uImage -w root,rootfs.jffs2 -z 512
或
$ flashimg -s 2M -t nor -f nor.bin -p uboot.part -w boot,u-boot.bin -w kernel,uImage -w root,rootfs.jffs2
  • 验证系统是否正常启动(无网络支持)

$ ./qemu-system-arm -M mini2440 -serial stdio -mtdblock nand.bin
Previous0_compilation_error_summaryNext2_operation_mode

Last updated 4 years ago

Was this helpful?