RK3288使用kernel4.4+ubuntu16.04,纯linux下升级包制作

本帖最后由 luwanjia 于 2018-10-24 21:50 编辑

感谢各位亲的厚爱,很抱歉,本人从今年一月份就没有从事rk3288的开发了,所以本帖一直没有更新维护,但是之前开发的资料和源码一直保留在Github上面。
相关内容请直接去Github上获取,链接:https://github.com/luwanjia/rockchip-dev
rockchip-dev/RK3288_Technical_Reference_Manual.md 是本人自己总结和验证过的手册,大家可以参考。
目录rockchip-dev/linux-rootfs/下面的01~07是完整的步骤,初学者可以一步一步的来。

This manual is for the development of linux on RK3288 board. My operating system is debian8.7 x64.

  1. Set develop environment
    We need arm-eabi-gcc to compile the kernel, arm-eabi-4.6 and arm-eabi-4.8 are available in AndroidSDK_5.1, you can find it in path “AndroidSDK_5.1/prebuilts/gcc/linux-x86/arm”.
    Here I use arm-eabi-4.8, you can download it directly here. (链接: 百度网盘-链接不存在 密码: 4ssx)

  2. Build kernel
    1> Download source code of kernel4.4 for linux.
    $git clone https://github.com/luwanjia/linux-kernel

    2> Change to right branch
    $git checkout firefly

    3> Config whith right configure file.
    $export ARCH=arm
    $export CROSS_COMPILE=/bin/arm-eabi-
    $make rockchip_linux_defconfig
    $make rk3288-firefly.img

    4> If there is no errors, the last print log is:
    OBJCOPY arch/arm/boot/zImage
    Kernel: arch/arm/boot/zImage is ready
    Image: kernel.img is ready
    Pack to resource.img successed!
    Image: resource.img (with rk3288-firefly.dtb logo.bmp) is ready

  3. Build initrd
    1> Download source code
    $git clone https://github.com/TeeFirefly/initrd.git

    2> Change to branch for-kernel_4.4
    $git checkout for-kernel_4.4

    3> Build in parent directory of initrd root directory.
    $make -C initrd

    4> If there is no errors, initrd.img will be generated.

  4. Pack zImage and initrd.img into the linux-root.img
    $mkbootimg --kernel kernel_4.4/arch/arm/boot/zImage --ramdisk initrd.img --second kernel_4.4/resource.img -o linux-boot.img

Now, linux-boot.img is OK, it will be used in step6.

  1. Make the rootfs of ubuntu16.04
    1> First, please download the minimum core of ubuntu
    $wget -c http://cdimage.ubuntu.com/ubuntu … 4-core-armhf.tar.gz

    2> unpack
    $mkdir linux-rootfs
    $sudo tar -xpf ubuntu-base-16.04-core-armhf.tar.gz -C linux-rootfs

    3> Install the simulator to run the root file system
    $sudo apt-get install qemu-user-static
    $sudo cp /usr/bin/qemu-arm-static linux-rootfs/usr/bin/

    4> Copy the local host DNS configure to rootfs
    $sudo cp -b /etc/resolv.conf linux-rootfs/etc/resolv.conf

    5> Add additional sources of port ubuntu, append follow strings to linux-rootfs/etc/apt/sources.list as administrator
    deb Index of /ubuntu-ports xenial main universe
    deb-src Index of /ubuntu-ports xenial main universe

    6> Use a mount script file to mount the core file system. Please see file ch-mount.sh, and add executable permissions.
    ch-mount.sh Link:ch-mount.sh.tar.gz (473 Bytes)

     $sudo chmod +x ch-mount.sh
    

    7> Mount rootfs, Notice that do not excute the script as administrator, otherwise errors will occur.
    $./ch-mount.sh -m linux-rootfs

     Now, you will enter the simulate bash as root, you can install any packages you want to integrate.
     a) Install network tools to make ifconfig command work.
         #apt-get install net-tools
     b) #apt-get install vim openssh-server
     c) #apt-get install ubuntu-session xubuntu-desktop
         Please wait to be done.
         Start dbus server to solve the error:
             Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
         #/etc/init.d/dbus start
     d) Enable auto connect to network
         #echo auto eth0 > /etc/network/interfaces.d/eth0
         #echo iface eth0 inet dhcp >> /etc/network/interfaces.d/eth0
     e) Setup startup desktop
         #update-alternatives --config x-session-manager
         Selection:
             desktop | x-session
            ---------------------
             xubuntu | startxfce4
            ---------------------
             lubuntu | startlxde
     f) Set default login screen
         #dpkg-reconfigure lightdm
     g) Set the user and password to login
         #useradd -s '/bin/bash' -m -G adm,sudo ubuntu
         #passwd ubuntu
         #passwd root
     h) Exit from simulate bash
         #exit
    

    8> After your installations in rootfs, please unmount the rootfs:
    $./ch-mount.sh -u linux-rootfs

    9> Create an empty image disk to save rootfs
    $dd if=/dev/zero of=linux-rootfs.img bs=1M count=4096
    $sudo mkfs.ext4 -F -L linuxroot linux-rootfs.img

    10> Mount the image disk, and copy the rootfs to it
    $mkdir mnt
    $sudo mount linux-rootfs.img mnt
    $sudo cp -rfp linux-rootfs/* mnt/

    11> Unmount the image disk and resize it.
    $sudo umount mnt
    $/sbin/e2fsck -p -f linux-rootfs.img
    $/sbin/resize2fs -M linux-rootfs.img

    12> Now, rootfs is done. linux-rootfs.img will be used in step6.

  2. Make one key update package.
    1> We need linux-boot.img and linux-rootfs.img created just now. And the tools to flash them into board.
    In AndroidSDK_5.1, the tools is avaiable:
    AndroidSDK_5.1/RKTools/linux/Linux_Upgrade_Tool_v1.2/rockdev

    2> Copy rockdev to somewhere as you want. And copy linux-rootfs.img and linux-rootfs.img to rockdev/Image directory.

    3> Do some modifications for parameter and package-file, and run mkupdate.sh
    Maybe you don’t know how to modify parameter and package-file, it does’t matter, you can unpack an official package, and you will get these two files.

     a) Unpack an official package, I use Firefly-rk3288_Ubuntu_1604_2016_10181203_Beta.img as official package.
         $mv Firefly-rk3288_Ubuntu_1604_2016_10181203_Beta.img update.img
         $./unpack.sh
    
         After that, you will get all the files you need.
    
     b) Make update.img
         $./mkupdate.sh
    
     Notice that, you should add the excutable permissions to all script files.
    

    4> Now, update.img will generated here.

  3. Flash update.img to board.
    1> Press the recovery button and reset button at the same time.

    2> Free the reset button and hold on the recovery button for more than 2 seconds.

    3> Now, the board entry the flash model, and use follow command to flash:
    $sudo upgrade_tool uf update.img

    4> Please wait, after flash success, the board will reboot automatically.

好帖,要是早几天发就更好了,那样我就能早点走通了。{:4_114:}

ctb2016 发表于 2017-6-22 10:12
好帖,要是早几天发就更好了,那样我就能早点走通了。

我也没有搞多久,深知其中的无奈,希望能帮到你。

luwanjia 发表于 2017-6-22 16:54
我也没有搞多久,深知其中的无奈,希望能帮到你。

绝世好贴,小白的福音,楼主辛苦了,{:4_127:}

請問 RK3288 Reload 能用嗎?
謝謝

evanlitw 发表于 2017-6-26 14:14
請問 RK3288 Reload 能用嗎?
謝謝

reload开发板我没有,不清楚是否能用,但我想道理都是一样,你可以参考。

請問一下 unpack.sh 這在哪裡呢?
謝謝

evanlitw 发表于 2017-6-27 08:15
請問一下 unpack.sh 這在哪裡呢?
謝謝

most of the tools can be found on Github
https://github.com/rock64-android/RKTools/tree/rk/linux/Linux_Pack_Firmware/rockdev
and you can download the fold with this website:
https://minhaskamal.github.io/DownGit/#/home

謝謝
另外有個問題
我要燒寫update.img的時候
出現
Check Chip Fail
這是什麼原因呢?
我是使用RK3288 reload

本站最好的帖子,实用性比超牛头,建议版主加精

本帖最后由 kgp00213 于 2017-7-28 21:07 编辑

-----原贴已经删除------

kgp00213 发表于 2017-7-25 13:48
本站最好的帖子,实用性比超牛头,建议版主加精

多谢鼓励!

经确认这一步没什么用

5> Make modules
    $make modules
    $mkdir modules_install
    $make INSTALL_MOD_PATH=./modules_install modules_install

luwanjia 发表于 2017-7-28 14:42
多谢鼓励!

这步没用,
5> Make modules
$make modules
$mkdir modules_install
$make INSTALL_MOD_PATH=./modules_install modules_install
麻烦有空编辑一下
感谢!

kgp00213 发表于 2017-7-28 21:06
这步没用,
5> Make modules
$make modules

已删

本帖最后由 kgp00213 于 2017-7-28 21:36 编辑

luwanjia 发表于 2017-7-28 21:21
已删

速度好快{:4_103:}

本帖最后由 kgp00213 于 2017-7-28 21:35 编辑


麻烦问一下楼主,这个kernel是打过实时补丁的吗?

楼主你好,这个kernel 4.4.55有没有打实时补丁呢?

可能已经注册 发表于 2017-8-9 11:56
楼主你好,这个kernel 4.4.55有没有打实时补丁呢?

什么实时补丁?不清楚诶~