Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 2780|Reply: 1

Boot.scr problems on Orange Pi PC

[Copy link]

2

Threads

4

Posts

34

Credits

Novice

Rank: 1

Credits
34
Post time 2016-10-8 02:25:40 | Show all posts |Read mode
Hello everyone,
at the moment i am working on my Orange Pi PC. To compile mainline kernel + uboot(using latest linaro toolchain) is not a problem for me even not to write the bootloader. But i have a big problem to write the boot.scr for my zImage on a two partition sd card (16mb fat for kernel and dtb + rest ext4 for rootfs). I can nowhere find a working boot.cmd for my configuration and there is no proper documentation to write it for my self. To bring it to the point: Could someone help me create a working boot.scr?
Here are the contents of my scripts to build kernel + uboot + writing sd card (ill spare you the content of my boot.cmd because i triend near 20 variations) :

Script to build uboot + mainline kernel:
  1. #!/bin/sh

  2. masterfolder=/builder
  3. finalfolder=/final
  4. mountdir=/mnt/rootfs

  5. export ARCH=arm
  6. export PATH="$PATH":$masterfolder/toolchain/bin/
  7. export CROSS_COMPILE=arm-linux-gnueabihf-

  8. mkdir $finalfolder

  9. ##GettingUboot##
  10. cd $masterfolder
  11. git clone git://git.denx.de/u-boot.git mainline-uboot
  12. cd $masterfolder/mainline-uboot
  13. make CROSS_COMPILE=arm-linux-gnueabihf- orangepi_pc_defconfig
  14. #make CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
  15. make CROSS_COMPILE=arm-linux-gnueabihf-
  16. cp $masterfolder/mainline-uboot/u-boot-sunxi-with-spl.bin $finalfolder/u-boot-sunxi-with-spl.bin
  17. rm -rf $masterfolder/mainline-uboot

  18. ##Build Mainline Kernel##
  19. mkdir $finalfolder/output
  20. cd $masterfolder
  21. cp -r mainline-kernel kernelwork
  22. cd kernelwork
  23. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig
  24. #make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
  25. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage dtbs modules
  26. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=$finalfolder/output modules_install
  27. cp $masterfolder/kernelwork/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dtb $finalfolder/sun8i-h3-orangepi-pc.dtb
  28. cp $masterfolder/kernelwork/arch/arm/boot/zImage $finalfolder/zImage
  29. cd $masterfolder
  30. #rm -rf kernelwork
Copy the Code

Script to make Sd Card (partitions + downloading Archlinux)
  1. #!/bin/sh

  2. masterfolder=/builder
  3. finalfolder=/final
  4. sdcard=/dev/sdg
  5. mountdir=/mnt/rootfs
  6. mountdir2=/mnt/rootfs2

  7. umount $sdcard
  8. umount "$sdcard"1
  9. umount "$sdcard"2
  10. umount "$sdcard"3
  11. umount "$sdcard"4

  12. sleep 10s

  13. ##Delete MBR##
  14. dd if=/dev/zero of=$sdcard bs=1M count=8
  15. ##############

  16. sleep 2s

  17. ##Getting boot.scr##
  18. mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d $masterfolder/boot1.txt $finalfolder/boot.scr
  19. ####################

  20. ##Build partitions##
  21. sfdisk -R $sdcard
  22. cat <<EOT | sfdisk --in-order -L -uM $sdcard
  23. 1,16,c
  24. ,,L
  25. EOT
  26. mkfs.vfat "$sdcard"1
  27. mkfs.ext4 "$sdcard"2
  28. ###################

  29. ##Mount##
  30. mkdir $mountdir
  31. mkdir $mountdir2
  32. mount "$sdcard"1 -t vfat $mountdir
  33. mount "$sdcard"2 $mountdir2
  34. #########

  35. ##Load and unpack rootfs##
  36. cd $masterfolder
  37. #wget http://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz
  38. bsdtar -xpf $masterfolder/ArchLinuxARM-armv7-latest.tar.gz -C $mountdir2
  39. sync
  40. #rm ArchLinuxARM-armv7-latest.tar.gz
  41. ##########################

  42. #RemoveBullshit#
  43. rm -rf $mountdir/boot
  44. mkdir $mountdir/boot
  45. mkdir $mountdir/boot/dtbs
  46. rm -rf "$mountdir"2/boot
  47. rm -rf "$mountdir"2/lib/modules
  48. mkdir "$mountdir"2/lib/modules
  49. ################

  50. ##Copying files##
  51. cp $finalfolder/boot.scr $mountdir/boot
  52. cp $finalfolder/zImage $mountdir/boot
  53. cp $finalfolder/sun8i-h3-orangepi-pc.dtb $mountdir/boot/dtbs/sun8i-h3-orangepi-pc.dtb
  54. cp -r $finalfolder/output/lib/modules "$mountdir2"/lib
  55. sync
  56. #################

  57. ##Unmount##
  58. umount $mountdir
  59. umount $mountdir2
  60. rm -rf $mountdir
  61. rm -rf $mountdir2
  62. #rm -rf $finaldir
  63. ###########

  64. ##Write uboot###
  65. dd if=$finalfolder/u-boot-sunxi-with-spl.bin of=$sdcard bs=1024 seek=8
  66. ###############
Copy the Code

Maybe you can help.  I am very Gratefull for every kind of help.
Greetings exoid

2

Threads

4

Posts

34

Credits

Novice

Rank: 1

Credits
34
 Author| Post time 2016-10-8 18:58:46 | Show all posts
After a longer searh ifound the "mainline uboot" site in the sunxi wiki. The boot.cmd works for me with one and two partitions. If someody have the same problem just write.
You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2019-11-23 04:24 GMT+8 , Processed in 0.029714 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list