해피 투게더

my cloud mirror gen2 uboot 변경하기 본문

장난감

my cloud mirror gen2 uboot 변경하기

보아요 2017. 7. 10. 15:55

리눅스 live usb 로 부팅후에 시리얼 케이블로 연결하고


u-boot-a38x-GrandTeton_2014T3_PQ-nand-uart.2048.gz


u-boot-a38x-GrandTeton_2014T3_PQ-nand.bin.gz



kwboot 으로 부팅후에 env 세팅


mint@mint ~/kwboot $ sudo ./kwboot -f -t -B 115200 /dev/ttyUSB0 -b u-boot-a38x-GrandTeton_2014T3_PQ-nand-uart.bin -s 0 -q 1


setenv set_bootargs_stock 'setenv bootargs root=/dev/ram console=ttyS0,115200'


setenv bootcmd_stock 'echo Booting from stock ... ; run set_bootargs_stock; printenv bootargs; nand read.e 0xa00000 0x500000 0x500000;nand read.e 0xf00000 0xa00000 0x500000;bootm 0xa00000 0xf00000'


setenv bootdev 'usb'


setenv device '0:1'


setenv load_image_addr '0x02000000'


setenv load_initrd_addr '0x2900000'


setenv load_image 'echo loading Image ...; ext2load $bootdev $device $load_image_addr /boot/uImage'


setenv load_initrd 'echo loading uInitrd ...; ext2load $bootdev $device $load_initrd_addr /boot/uInitrd'


setenv usb_set_bootargs 'setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial mtdparts=armada-nand:5m@0(u-boot),5m@5m(kernel),5m@10m(uRamdisk),185m@15m(image.cfs),15m@200m(rescue_fw),20m@215m(config),10m@235m(reserve1),10m@245m(reserve2)'


setenv bootcmd_usb 'echo Booting from USB ...; usb start; setenv fdt_skip_update yes; usb start; run usb_set_bootargs; if run load_image; then if run load_initrd; then bootm $load_image_addr $load_initrd_addr; else bootm $load_image_addr; fi; fi'


setenv bootcmd 'run bootcmd_usb; run bootcmd_stock; reset'

saveenv

boot

저장후 boot 하면 usb 가 없는 상태에서는 stock 으로 부팅 usb 가 있으면 usb 로 부팅


여기서부터는 kwboot 으로 debian 로 진입한 후에 kwboot 하지 않기 위해서 nand 에 저장하는 법.


You must boot with the DTB I posted earlier, which unlocks mtd0 for writing. Make sure the output of mtd_debug matches the below: // uart 용으로 부팅후 리눅스 진입

# mtd_debug info /dev/mtd0 실행하여 아래 내용 확인 후 진행


mtd.type = MTD_NANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 5242880 (5M)
mtd.erasesize = 131072 (128K)
mtd.writesize = 2048 (2K)
mtd.oobsize = 64
regions = 0

Steps:

   1 kwboot a modified u-boot which saves environment variables to 0x100000 (uart 용 Download)
   2 Inside u-boot, run saveenv
   3 Boot Debian from USB or SATA (see instructions earlier in this thread)
   4 Dump u-boot env to a file (nandread)
   5 Erase u-boot portion of mtd0 (flash_erase)
   6 Flash new u-boot (nandwrite, Download the u-boot attached to this post. Do not try to flash the kwboot u-boot to NAND)
   7 Restore environment variables (nandwrite)
   8 Reboot


4 Dump u-boot env: // uboot 에서 설정한 envs 저장

# nanddump -s 0x100000 -l 0x80000 -f ubootenv.bin /dev/mtd0


5 6 Then erase the old u-boot and flash the new one to NAND: // 낸드용 다운받아서 압축 풀고 낸드에 저장


# flash_erase /dev/mtd0 0 8
# nandwrite -p /dev/mtd0 u-boot-a38x-GrandTeton_2014T3_PQ-nand.bin


7 Restore u-boot env: // uboot envs 백업 받은것 복구 후에 리붓하면 이제 kwboot 은 안해도 된다.


# nandwrite -p /dev/mtd0 -s 0x100000 ubootenv.bin


8 Reboot