Openwrt x86 compilation Diary

Source: Internet
Author: User

Background

Some time ago, I saw the c1037u multi-network port version. I liked it very much. I replaced the 4530r and found that there were fewer people playing openwrt x86. I wrote a diary for later use. Please point out any errors.

0. Configure the compiling environment

Linux

1. Get source code

svn co svn://svn.openwrt.org/openwrt/trunk/#svn co svn://svn.openwrt.org/openwrt/branches/barrier_breaker -r42625svn update#cp feeds.conf.default feeds.conf./scripts/feeds update -a./scripts/feeds install -a

2. Some Problems

About config
Openwrt config file:. config
Kernel config: build_dir/Target-xxxxxxx/linux-x86_generic/. config

About changing the kernel version:

Supported kernel version list: Include/kernel-version.mk
Change the kernel version: Target/Linux/XXX/makefile.

3. Make menuconfig

A basic configuration is provided here, But busybox configuration can be used normally by default, without the need for customize busybox options. In order to add some overlayfs functions to initramfs in the future, I added the configuration myself, in addition, the configuration is basically required for x86.

Target System (x86) # target platform selection target images ---> [*] ext4 # generation. ext4.img file base system ---> <*> block-mount <*> busybox ---> # used for initramfs support in the future, you can compile all lib to busybox [*] customize busybox options busybox settings ---> general configuration ---> [*] support -- install [-S] to install applet links at runtime [*] don't use/usr LINUX module utilities ---> [*] modinfo [*] simplified modutils [*] accept module options on modprobe command line [*] Skip loading of already loaded modules (/lib/modules) default directory containing modules Linux system utilities ---> [*] mdev [*] Support/etc/mdev. conf [*] Support subdirs/symlinks [*] support regular expressions substitutions when renaming [*] Support Command Execution At device addition/removal [*] Support loading of firmwares [*] findfs [*] blkid [*] print filesystem type [*] losetup [*] lspci [*] lsusb [*] Mount [*] Support specifying devices by label or UUID filesystem/volume identification ---> [*] ext filesystem [*] Fat filesystem networking utilities ---> [*] ftpd [*] Enable upload commands [*] Enable workaround for RFC-violating clients [*] inetd [*] telnetd [*] support standalone telnetd (not inetd only) [*] tcpsvd [*] udpsvdkernel modules ---> Block devices ---> <*> kmod-Ata-core <*> kmod-Ata-ahci <*> kmod-loop -*- kmod-SCSI-core <*> kmod-SCSI-generic filesystems ---> <*> kmod-fs-ext4 <*> kmod-FS-NTFS <*> kmod-FS-vfat input modules ---> # keyboard-*-kmod-hid <*> kmod-hid-generic-*-kmod-input-core-*-kmod-input-evdev native language support ---> <*> kmod-nls-cp437 # vfat need this <*> kmod-nls-iso8859-1 <*> kmod-nls-utf8 network devices ---> # NIC Driver <*> kmod-macvlan USB support --->-*-kmod-USB-core <*> kmod-USB-hid # USB keyboard <*> kmod-USB-OHCI <*> kmod-USB-storage <*> kmod-usb2 <*> kmod-usb3 wireless drivers ---> # WiFi Card Driver network ---> <*> hostapd # WiFi AP mode <*> hostapd-common <*> hostapd-utils <*> WPA-supplicantutilities ---> # fdisk of your choice

4. Make kernel_menuconfig

The objective is to add multiple x86 cores and support for large memory.

Processor type and features ---> [*] hierarchical Ric multi-processing support Processor family (Core 2/newer Xeon) ---> # self-selection of the processor Platform [*] supported processor vendors ---> # self-selection of the processor platform (2) Maximum number of CPUs # self-Editing [*] SMT (hyperthreading) scheduler support # hyper-threading support [*] multi-core scheduler support high memory support (4 GB) --->

5. Make

Compile

Suggestion: Make-J 100 download first. It is best

Make clean make-J 5 V = 99 # compile a package make packages/XXX/cleanmake packages/XXX/compilemake packages/XXX/install

6. Install

Openwrt-x86-generic-combined-ext4.img.gz: Contains vmlinuz, rootfs (ext4), boot Information and Related partition information IMG, generally two partitions, it can be seen as a hard disk image, directly dd to a disk

Openwrt-x86-generic-combined-squashfs.img: Same as above, only use squashfs + overlayfs File System Architecture

Openwrt-x86-generic-rootfs-ext4.img.gz: rootfs partition image that can be directly dd to a partition, or mount-O to a directory

Openwrt-x86-generic-rootfs-squashfs.img: Same as above

Openwrt-x86-generic-vmlinuz: Kernel

Openwrt-x86-generic-Generic-rootfs.tar.gz: rootfs files packaged with GZ

As you can see, to enable the system, you need a boot loader (x86 uses grub, like uboot in the route, and of course uboot has more content), kernel, and rootfs.

0) If your disk (USB flash drive) is only used in the openwrt system, you can use combined:

Ls bin/x86/gunzip bin/x86/openwrt-x86-generic-combined-ext4.img.gzdd if = bin/x86/openwrt-x86-generic-combined-ext4.img of =/dev/SDB # select disk as needed

The advantage is that it is simple. The disadvantage is that if your SDB (DISK/U disk) is large, you can have multiple partitions. Although you can store data in rootfs, however, the next upgrade will cause unnecessary trouble.

1) self-deployment

Major steps: 0. partition/mkfs; 1. use dd to add rootfs. ext4.img write to partition; 3. copy vmlinuz to the partition. 4. installation Guide. If it is bios, I am used to grub4dos. If it is EFI, grub2 is used and the EFI file system is required. Remember to add it when partitioning. 5. Edit menu. LST; 6. start

7. About initramfs & overlayfs:

Overlayfs: Because openwrt x86 is generally installed on USB flash drives, TF cards, hard disks, and other media, the default file system is Ext, and overlayfs is not used. To use overlayfs, squashfs is used. I personally liked overlayfs because of the excessive routing. I started to add overlayfs support to the ext4 X86 server. Later, I will write a separate article about overlayfs under x86.

Initramfs: In openwrt compilation, if ramdisk (here ramdisk is initramfs) is always hooked on the target images, the actually generated vmlinuz is a rootfs with initramfs (this initramfs is the entire rootfs to be written into the disk, if you select more packages, the larger the rootfs). Of course, you can also select the cpio directory in source cpio. If you use gurb to load it, then the entire system will run on ramfs, and all configurations will not be retained after the restart. Generally, you need to start it to another kernel (kexec) or switch_root to another root (real disk) Environment, ramdisk (initramfs ). Therefore, the ramdisk option in the compilation option is not checked, so you can do the initramfs by yourself and add some hooks (for example, adding overlayfs support, switch_root to other rootfs, and directly kexec to other kernel ), you can load it with gurb to start the system.

Openwrt x86 compilation Diary

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.