Use the banana pie to create the image of the openwrt system and route openwrt.

Source: Internet
Author: User
Tags spl

Use the banana pie to create the image of the openwrt system and route openwrt.

BPI-R1 the latest version of the full-featured openwrt system has not been released, wait for a hurry, or first to make a system that can run it. However, because the configuration file here is from the banana pie, some functional routes cannot run, so it is a hot warm-up.
All operations are completed in the banana Lubuntu environment without cross-compilation, saving a lot of trouble.


1. Download required files:


This website is the latest openwrt file. It has been compiled and can be used directly. When downloading, you can download all the things related to the banana pie. Of course, this method also applies to other boards. If you are interested, you can do it yourself.

Http://downloads.openwrt.org/snapshots/trunk/sunxi...
Openwrt-sunxi-root.ext4
Openwrt-sunxi-uImage
Sun7i-a20-bananapi.dtb

Http://downloads.openwrt.org/snapshots/trunk/sunxi...
Openwrt-sunxi-Bananapi-u-boot-with-spl.bin
Openwrt-sunxi-Bananapi-uEnv.txt

2. Install the startup script tool:
Apt-get install u-boot-tools
This tool will be used later. install it in advance. The installation process is simple.

3. Start writing files to the card. Ls/dev/sd * before inserting a TF card *,


Then, insert the card and check it again. The new card is the one that has been inserted, which is easy to differentiate and saves the trouble of making a mistake:


Sda is the card to be operated.

4. Clear the first 1 m space of the card:
Dd if =/dev/zero of =/dev/sda bs = 1 M count = 1


Nothing can be said, that is, to fill the first 1 m space with 0.


5. Write openwrt-sunxi-Bananapi-u-boot-with-spl.bin:
After clearing it will write files into it, this file is a openwrt-sunxi-Bananapi-u-boot-with-spl.bin, in fact, is the uboot File
Dd if = openwrt-sunxi-Bananapi-u-boot-with-spl.bin of =/dev/sda bs = 1024 seek = 8


After this step, you can insert the route to start, but you can only start it. If you do not have a system, you have to perform the following operations.

6. repartition:
Fdisk/dev/sda


This is all the commands in the partition operation. Familiarize yourself with them first.

Start Operation:
1) p: view the partition and display the existing partition. Delete a partition if it already exists;
2) d. Delete the partition and specify the partition number. If multiple partitions exist, the operation is repeated. If no partition exists, the operation is skipped;
3) n create a partition, specify the Partition Number, and specify the start and end sectors. There are three parameters in total:
Openwrt requires two partitions, so it needs to be executed twice:


A) n-> default p-> default 1-> default 2048-> 34815



B) n-> default p-> default 2-> default 34816-> default remaining all



4) Check the partition again with p, but change the first partition to the fat format;



5) t change the partition type, specify the Partition Number, and specify the type



6) L check all partition types. The fat type number is c;



7) Check the partition again (p) and confirm that the partition is correct;



8) w. Save all operations.



7. Format two partitions respectively.

The first format is fat32, and the second is ext4:
Ls/dev/sda *
1) mkfs. vfat/dev/sda1



2) mkfs. ext4/dev/sda2



8. Mount the partition:
Create two empty folders named 1 and 2.
1) mount/dev/sda1/media/1
2) mount/dev/sda2/media/2



9. Create a STARTUP script:
Create a new file in 1, open it, and add:
Setenv bootargs console = ttys0, 115200 root =/dev/mmcblk0p2 rootwait panic = 10 $ {extra}
Fatload mmc 0 0x46000000 uImage
Fatload mmc 0 0x49000000 sun7i-a20-bananapi.dtb
Fdt_high ffffffff
Bootm 0x46000000-0x49000000


Save as boot. cmd, and then
Mkimage-C none-A arm-T script-d boot. cmd boot. scr
Case Sensitive and space sensitive



10. Copy an object:
1 directly copy the sun7i-a20-bananapi.dtb and openwrt-sunxi-uImage file, and rename the file uImage, the two files file name must be the same as the previous boot. cmd;



Files in step 2 cannot be copied directly. It should be as follows:
Dd if =/xxx/openwrt-sunxi-root.ext4 of =/dev/sda2 bs = 1 M
Replace xxx with your own path



11. Insert the card into the route and start it after power-on:
You need to connect to the debug serial port, and no output is displayed. If it cannot be started, repeat the preceding operations



12. Create an imgfile:
Re-plug the card into the banana PI using the card reader to generate an imgfile for future use.
Dd if =/dev/sda of =/xxx/openwrt. img bs = 4 M
Replace xxx with your own path.
This step takes about one minute.



You can do it yourself before the official image is released.

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.