---
tags: handoverOK, 3240
---
### 5204 Enviorment
> 目前相關資源都放在 5204上~這台配有1T 的資料碟與256G ssd系統碟 aewin@192.168.99.90:/home/aewin/work/work/work/
> 你可存取5204 ~透過ssh scp SAMBA
> SAMBA 和 SSH 帳密皆為aewin/aewin !
> 目前5204 IP為 192.168.99.90
```
ssh aewin@192.168.99.90:/home/aewin/work/work/work/
or
scp aewin@192.168.99.90:/home/aewin/test_file ./your_pc
```
# 3240
此案為Ron開發我只加了Docker開發環境!讓你免裝新的OS~
原SOP與source code 在:
> smb://192.168.1.209/se00軟體研發處/05-Software/SCB-3240A-PX1
如何測試它:
> smb://192.168.1.209/se00軟體研發處/05-Software/SCB-3240A-PX1/document
## Docker開發環境!
我已將build 3240 開發環境 包成docker 可以跑在5204上!
#### run docker
```
sudo docker run -it --privileged -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -v /dev/shm:/dev/shm -v /etc/machine-id:/etc/machine-id -v /var/lib/dbus:/var/lib/dbus -v /home/aewin/work/work:/mnt --net host -e DISPLAY="$DISPLAY" build3240 bash
```
## Docker images
如果想要把docker images跑在你的OS上~我也封裝好 docker image! 讓你帶到別台電腦上跑!
Image我放在
```
/home/aewin/work/work/work/3240/fedora:20.tar
```
你可以使用下面指令~讓他跑在你的電腦上!
```
cat ./fedora\:20.tar | docker import - build3240:latest
```
# Build Code SOP....(以進入docker後為範例 build3240:latest)
> 原始碼在 smb://192.168.1.209/se00軟體研發處/05-Software/SCB-3240A-PX1/source%20code/OCTEON-SDK-CB-3240A-PX1-20170413.tar.gz
## Build bootloader 1:
0. mkdir /root/3240; mkdir /root/3240/bin
1. cd /OCTEON-SDK-CB-3240_v110-20160913
2. source env-setup OCTEON_CN70XX
3. cd bootloader/emmc-boot/stage1/
4. make clean;make
5. cp emm-boot.bin /root/3240/bin/
## Build bootloader 2:
6. cd ../../u-boot/
7. make distclean;
8. make octeon_generic_emmc_stage2_config;make;
9. cp u-boot-octeon_generic_emmc_stage2.bin /root/3240/bin/
10. make distclean; make octeon_aewin3240_config ;make
11. cp u-boot-octeon_aewin3240.bin /root/3240/bin/
## Build kernel :
12. cd /OCTEON-SDK-CB-3240_v110-20160913/linux
13. make clean;make kernel strip
14. cp kernel/linux/vmlinux.64 /root/3240/bin/
###### We finished the bootloader and kernel image building and files are put in /root/3240/bin !!!!!!!!!!!
# CB-3240 burn booting image SOP
### Burn eMMC booting image.
1. Put 4 files (emm-boot.bin, u-boot-octeon_aewin3240A.bin, u-boot-octeon_generic_emmc_stage2.bin, vmlinux.64) into a USB flash disk, and insert the USB flash disk to SCB-3240A.
2. Connect the serial line to console port.
3. Launch a terminal emulation program (e.g. Tera Term) and adjust the serial port setup: select the serial port and set baud rate to 115200.
4. Select eMMC booting mode and power on the SCB-3240A. When you see 5 seconds count-down in console you should press “Enter” key to bootloader command mode.
5. mmc dev 1
6. usb start
7. fatload usb 0 0x100000 emm-boot.bin
8. mmc write 0x100000 0 10
9. fatload usb 0 0x100000 u-boot-octeon_generic_emmc_stage2.bin
10. mmc write 0x100000 10 3E0
11. mw.b 0x100000 0 8192
12. mmc write 0x100000 3F0 10
13. usb start;fatload usb 0 0x100000 vmlinux.64;bootoctlinux 0x100000 coremask=0xf mem=0
14. Wait Linux booting to shell mode.
15. fdisk /dev/mmcblk0
create 1st partition from 32 sectors with 6M size (n,p,1,32,+6M)
create 2nd partition from 216 sectors with 256M size (n,p,2,216,+256M)
create 3nd partition from 8030 sectors with remaining space (n,p,3,8030,119296)
change 1st partition type to FAT32 (t,1,c)
make 1st partition ACTIVE (a,1)
Check the pattition type as below(p)
write (w)
16. mkfs.vfat -v -F 32 /dev/mmcblk0p1
17. mkfs.vfat -v -F 32 /dev/mmcblk0p2
18. mkfs.ext2 /dev/mmcblk0p3
19. mkdir p1
20. mkdir p2
21. mkdir p3
22. mkdir usb
23. mount /dev/mmcblk0p1 /p1
24. mount /dev/mmcblk0p2 /p2
25. mount /dev/mmcblk0p3 /p3
26. mount /dev/sda1 /usb
27. cp -p /usb/u-boot-octeon_generic_emmc_stage2.bin /p1/OCTBOOT2.BIN
cp -p /usb/u-boot-octeon_generic_emmc_stage2.bin /p1/OCTBOOT2.BAK
28. cp -p /usb/u-boot-octeon_aewin3240A.bin /p1/u-boot-octeon_stage3.bin
cp -p /usb/u-boot-octeon_aewin3240A.bin /p1/u-boot-octeon_stage3_failsafe.bin
29. cp -p /usb/vmlinux.64 /p2/
30. umount /p1
31. umount /p2
32. umount /p3
33. umount /usb
34. Power off the SCB-3240A.
35. Power on the SCB-3240A to the bootloader command mode.
36. env default -a
37. setenv ethaddr 00:0d:48:70:86:05 /* note: this is an example MAC address */
38. setenv serial# 1234567 /* note: this is a example serial number */
39. saveenv
40. Power off SCB-3240A.
### Burn NOR-flash booting image. (這邊先用不到!因為板子上沒NOR-flash)
1. Put 2 files (u-boot-octeon_aewin3240A_nor.bin, vmlinux.64) into a USB flash disk, and insert the USB flash disk to SCB-3240A.
2. Connect the serial line to console port and select NOR-flash booting mode and power on the SCB-3240A. When you see 5 seconds count-down in console you should press “Enter” key to bootloader command mode. Also
3. usb start;fatload usb 0 0x100000 u-boot-octeon_aewin3240A_nor.bin;bootloaderupdate
4. usb start;fatload usb 0 0x100000 vmlinux.64;bootoctlinux 0x100000 coremask=0xf mem=0
5. Wait Linux booting to shell mode.
6. fdisk /dev/mmcblk0
create 1st partition from 32 sectors with 6M size (n,p,1,32,+6M)
create 2nd partition from 216 sectors with 256M size (n,p,2,216,+256M)
create 3nd partition from 8030 sectors with remaining space (n,p,3,8030,119296)
change 1st partition type to FAT32 (t,1,c)
make 1st partition ACTIVE (a,1)
Check the pattition type as below(p)
write (w)
7. mkfs.vfat -v -F 32 /dev/mmcblk0p1
8. mkfs.vfat -v -F 32 /dev/mmcblk0p2
9. mkfs.ext2 /dev/mmcblk0p3
10. mkdir p1
11. mkdir p2
12. mkdir p3
13. mkdir usb
14. mount /dev/mmcblk0p1 /p1
15. mount /dev/mmcblk0p2 /p2
16. mount /dev/mmcblk0p3 /p3
17. mount /dev/sda1 /usb
18. cp -p /usb/vmlinux.64 /p2/
19. umount /p1
20. umount /p2
21. umount /p3
22. umount /usb
23. Power off SCB-3240A.
24. Power on SCB-3240A to the bootloader command mode.
25. env default -a
26. setenv ethaddr 00:0d:48:70:86:05 /* note: this is an example MAC address */
27. setenv serial# 1234567 /* note: this is a example serial number */
28. saveenv
29. Power off SCB-3240A.