chip-debroot
chip-debroot copied to clipboard
About U-boot
I made a record of generating uboot, https://www.xuefei.net.cn/index.php/archives/152/, but I can't flash it, am I step wrong? by the way, you posted file about uboot on the reddit forum, spl-400000-4000-500.bin spl-400000-4000-680.bin ubootflash.scr ,How are these files generated?
The spl-400000-4000-500.bin and spl-400000-4000-680.bin files aren't used anymore, they were the old SPL stage. We should be able to use mainline now. ubootflash.scr was made with mkimage (part of the uboot-tools package).
The most recent flashing documentation I have is here: https://www.reddit.com/r/ChipCommunity/comments/t4k67u/my_attempt_at_a_new_method_of_flashing/. In this documentation are links to the "flash_tool_v3" which is basically scripts that do all the bootloader flashing for you. You can look at it specifically for the *.scr files and see what each step of the flashing process looks like.
The files used specifically from U-Boot are sunxi-spl.bin (the temporary SPL stage used during flashing), u-boot-dtb.bin (the U-Boot stage), and sunxi-spl-with-ecc.bin (the permanent SPL stage). I compile U-Boot multiple times with different options for different things. For example I set some parameters to by default automatically boot a passed scr file and then rename that version of U-Boot to u-boot-dtb-temporary.bin. I then recompile U-Boot and use different default options to always boot from USB, then the NAND rootfs partition, then the NAND swupdate partition; and then rename that version to u-boot-dtb-permanent.bin. This is strictly for convenience and if you are doing the flashing yourself with a serial port you don't need to do it.
Please note though that the sunxi-spl-with-ecc.bin will be different depending on your flash type (Hynix or Toshiba). Make sure to set the correct values before you flash it.
The boot scr file does the following steps (you can compile your own boot.scr file, just check the mkimage man page). It erases all the partitions by doing mtd erase <<partition_name>> 0 where <<partition_name>> is one of "SPL, SPL.backup, U-Boot, U-Boot.backup, swupdate, or rootfs. It then checks a register in memory to determine if the Hynix or Toshiba NAND was detected and flashes the correct SPL stage depending on the selection. If you already know and compiled the correct SPL stage you don't have to detect anything, just flash it. It then writes U-Boot and U-Boot backup.
I believe you can also use 2022.04 which just came out for U-Boot, though I haven't extensively tested it yet. You should just need the patch for SLC, the patch for DMA code removal reinstatement, and the w1 patch (all the others are now upstreamed). The popcorn patch is only necessary if you have a Source Parts Popcorn and are compiling U-Boot for that. Note it's a major work in progress though.
Just kidding on the 2022.04 part... this patch here breaks it: https://source.denx.de/u-boot/u-boot/-/commit/e42dad4168fe7acae810f759078a8cdfe2cd9086 I'm working on a fix as we speak.
Thank you so much.I'll take care of your responses and start learning about them. I'm really a novice.
Thank you so much.I'll take care of your responses and start learning about them. I'm really a novice.
You're very welcome and no worries, we all start somewhere. Feel free to let me know if you have any more questions and I'll try to help as best I can.
I replaced pocketchip with a 800x480 4.3 inch screen, but it shows like this, what should I do? In the original system, I can do this https://xuefei.net.cn/index.php/archives/91/, is there a way to solve it in the new system?
You can try building a new devicetree overlay for the PocketCHIP and define a different screen. The problem is there is no exact match for that panel in the mainline kernel, the closest I see is this compatible string: cdtech,s070swv29hg-dc44. If that doesn't work you'll have to add support for your panel (not hard, but requires recompiling your kernel).
I use ubuntu22.04 to build kernel,but I load your debian.config and save to .config, CONFIG_CC_VERSION_TEXT change from arm-linux-gnueabihf-gcc-10 (Debian 10.2.1-6) 10.2.1 20210110 to arm-linux-gnueabihf-gcc (Ubuntu 11.2.0-17ubuntu1) 11.2.0 ,and build error like this
xuefei@xuefei:~/chip-debroot/linux-stable$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
CHK include/generated/compile.h
CC init/do_mounts_initrd.o
CC init/initramfs.o
CC init/calibrate.o
CC init/init_task.o
CC init/main.o
/tmp/cc5cH9pS.s: Assembler messages:
/tmp/cc5cH9pS.s:2098: 错误: selected processor does not support cpsid i' in ARM mode /tmp/cc5cH9pS.s:2390: 错误: selected processor does not support
cpsid i' in ARM mode
/tmp/cc5cH9pS.s:2471: 错误: selected processor does not support cpsie i' in ARM mode /tmp/cc5cH9pS.s:2546: 错误: selected processor does not support
dsb ' in ARM mode
/tmp/cc5cH9pS.s:2722: 错误: selected processor does not support cpsie i' in ARM mode /tmp/cc5cH9pS.s:2868: 错误: selected processor does not support
ldrex r3,[r4]' in ARM mode
/tmp/cc5cH9pS.s:2870: 错误: selected processor does not support `strex r1,r2,[r4]' in ARM mode
make[1]: *** [scripts/Makefile.build:271:init/main.o] 错误 1
make: *** [Makefile:1858:init] 错误 2
Do I have to compile with a particular operating system version?
Here's the exact steps I use to build a Debian kernel (I'm building one right now in fact). Please note that I have backports and deb-src added to my apt sources.list file, the specific kernel I am using is from backports. I also have ccache enabled, if you do not have ccache you can skip that specific line.
mkdir /path/to/kernel/makedir/
cd /path/to/kernel/makedir/
apt-get source linux=5.15.15-2~bpo11+1
cd linux-5.15.15
ARCH=armhf
FEATURESET=none
FLAVOUR=armmp
export $(dpkg-architecture -a$ARCH)
export PATH=/usr/lib/ccache:$PATH
export DEB_BUILD_PROFILES="cross nopython nodoc pkg.linux.notools"
export MAKEFLAGS="-j$(($(nproc)*2))"
export DEBIAN_KERNEL_DISABLE_DEBUG=yes
fakeroot make -f debian/rules clean
fakeroot make -f debian/rules orig
fakeroot make -f debian/rules source
fakeroot make -f debian/rules.gen setup_${ARCH}_${FEATURESET}_${FLAVOUR}
cd debian/build/build_armhf_none_armmp
wget "https://raw.githubusercontent.com/macromorgan/chip-debroot/main/kernel_files/debian.config"
mv debian.config .config
Now that I'm ready to build a stock kernel, I then do a make menuconfig. You have to call this from the root folder of the kernel sources (in this case the linux-5.15.15 folder)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C debian/build/build_armhf_none_armmp menuconfig
Once the kernel is built to my liking I run the following:
fakeroot make -f debian/rules.gen binary-arch_${ARCH}_${FEATURESET}_${FLAVOUR}
Note that I haven't tested on Ubuntu 22.04 yet, but I will (eventually). My build system is a chroot of Debian 11. If you have problems consider putting together a chroot of Debian 11 and see if that helps. The package schroot can help you out.
Thank you.
Thank you. I built it according to the steps you said and didn't find any obvious errors, but I forgot to apply the kernel patch and haven't installed the test yet.
The build environment is Ubuntu 22 04
I made a rough record https://www.xuefei.net.cn/index.php/archives/153/
Hi,
first of all @macromorgan thank you so much for your awesome work!!!!
I'm writing because I'm not able to boot my self-build U-Boot from flash. I'm using U-Boot 2022.01 with the patches in this repository and no changes to the configuration. I'm using Buildroot to build, but that shouldn't matter.
- Boot in to U-Boot and upload payload
sunxi-fel -v -p uboot u-boot-sunxi-with-spl.bin multi 2 \
0x43000000 sunxi-spl-with-ecc.bin \
0x43400000 u-boot-dtb.bin
- Now in U-Boot flash:
nand erase.chip
nand write.raw.noverify 0x43000000 SPL 0x10
nand write.raw.noverify 0x43000000 SPL.backup 0x10
nand write 0x43400000 U-Boot 0x400000
nand write 0x43400000 U-Boot.backup 0x400000
reset
- I can successfully boot into SPL from NAND but then I get stuck:
U-Boot SPL 2022.01 (Jun 04 2022 - 12:47:14 +0000)
DRAM: 512 MiB
CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from NAND
SPL: failed to boot from all boot devices (err=-6)
### ERROR ### Please RESET the board ###
However, when I exchange my u-boot-dtb.bin
which I get from Buildroot with your u-boot-dtb-perm.img
from https://macromorgan.s3.amazonaws.com/ntc-chip-mainline/flash_tool_v3.tar.gz and re-run steps 1-3 everything works fine and I can boot into U-Boot from the NAND.
My question: How do you generate u-boot-dtb-perm.img
?
Ok, never mind. Right after posting this I figured out I can also get a u-boot-dtb.img
out of Buildroot. And that works fine...
For reference:
One can get the u-boot-dtb.img
file out of the u-boot-dtb.bin
file by running:
mkimage -A arm -T firmware -C none -O u-boot -a 0x4a000000 -e 0x4a000000 -n "U-Boot 2022.01"" for sunxi board" -d u-boot.bin u-boot.img