|
87 | 87 | uboot_addr = u.memalign(2*1024*1024, len(uboot)) |
88 | 88 | print("Loading u-boot to 0x%x..." % uboot_addr) |
89 | 89 |
|
90 | | - bootenv_start = uboot.find(b"bootcmd=bootflow scan -b") |
91 | | - bootenv_len = uboot[bootenv_start:].find(b"\x00\x00") |
92 | | - bootenv_old = uboot[bootenv_start:bootenv_start+bootenv_len] |
93 | | - bootenv = str(bootenv_old, "ascii").split("\x00") |
94 | | - bootenv = list(filter(lambda x: not ( |
95 | | - x.startswith("baudrate") or |
96 | | - x.startswith("boot_") or |
97 | | - x.startswith("bootdelay=") or |
98 | | - x.startswith("preboot=") or |
99 | | - x.startswith("bootcmd") |
100 | | - ), bootenv)) |
| 90 | + u.compressed_writemem(uboot_addr, uboot, True) |
| 91 | + p.dc_cvau(uboot_addr, uboot_size) |
| 92 | + p.ic_ivau(uboot_addr, uboot_size) |
| 93 | + |
| 94 | + boot_addr = uboot_addr |
101 | 95 |
|
102 | 96 | if args.efi and initramfs is not None: |
103 | | - bootcmd = "bootcmd=bootefi 0x%x:0x%x 0x%x:0x%x $fdtcontroladdr" % (kernel_base, kernel_size, initramfs_base, initramfs_size) |
| 97 | + bootcmd = "bootefi 0x%x:0x%x 0x%x:0x%x $fdtcontroladdr" % (kernel_base, kernel_size, initramfs_base, initramfs_size) |
104 | 98 | elif initramfs is not None: |
105 | | - bootcmd = "bootcmd=booti 0x%x 0x%x:0x%x $fdtcontroladdr" % (kernel_base, initramfs_base, initramfs_size) |
| 99 | + bootcmd = "booti 0x%x 0x%x:0x%x $fdtcontroladdr" % (kernel_base, initramfs_base, initramfs_size) |
106 | 100 | elif args.efi: |
107 | | - bootcmd = "bootcmd=bootefi 0x%x:0x%x $fdtcontroladdr" % (kernel_base, kernel_size) |
| 101 | + bootcmd = "bootefi 0x%x:0x%x $fdtcontroladdr" % (kernel_base, kernel_size) |
108 | 102 | else: |
109 | | - bootcmd = "bootcmd=booti 0x%x - $fdtcontroladdr" % (kernel_base) |
110 | | - |
111 | | - if tty_dev is not None: |
112 | | - bootenv.append("baudrate=%d" % tty_dev.baudrate) |
113 | | - bootenv.append(bootcmd) |
114 | | - bootenv.append("bootdelay=0") |
115 | | - if args.bootargs is not None: |
116 | | - bootenv.append("bootargs=" + args.bootargs) |
| 103 | + bootcmd = "booti 0x%x - $fdtcontroladdr" % (kernel_base) |
117 | 104 |
|
118 | | - bootenv_new = b"\x00".join(map(lambda x: bytes(x, "ascii"), bootenv)) |
119 | | - bootenv_new = bootenv_new.ljust(len(bootenv_old), b"\x00") |
| 105 | + p.kboot_set_uboot("bootcmd", bootcmd) |
| 106 | + p.kboot_set_uboot("bootdelay", "0") |
120 | 107 |
|
121 | | - if len(bootenv_new) > len(bootenv_old): |
122 | | - raise Exception("New bootenv cannot be larger than original bootenv") |
123 | | - uboot[bootenv_start:bootenv_start+bootenv_len] = bootenv_new |
124 | | - |
125 | | - u.compressed_writemem(uboot_addr, uboot, True) |
126 | | - p.dc_cvau(uboot_addr, uboot_size) |
127 | | - p.ic_ivau(uboot_addr, uboot_size) |
| 108 | + if tty_dev is not None: |
| 109 | + p.kboot_set_uboot("baudrate", "%d" % tty_dev.baudrate) |
128 | 110 |
|
129 | | - boot_addr = uboot_addr |
130 | 111 |
|
131 | 112 | p.cpufreq_init() |
132 | 113 | p.smp_start_secondaries() |
|
0 commit comments