I checked these 2 images with a hex editor: the first is the header with the SDMMC_BOOT signature and the pointer to the 2nd header (0x00000200). It’s exactly 440 bytes long and obviously intended to overwrite the code section in the master boot record created with parted, but not the partition table (which is located at the end of the 512 byte MBR. after the 440 bytes).
The second image is the 2nd header with the signature BRLYT and the pointer to the preloader address (0x00000800), and some other values (i don’t know the meaning).
I’m following the steps you in order to create the image, i’m using virtual box with ubuntu 16.04, and gcc --version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, but i’ve got some problems at step2:
I tried this: sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-7 50 and i’ve got this message: update-alternatives: error: alternative path /usr/bin/arm-linux-gnueabihf-gcc-7 does not exist
then I tried update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-5 100 and that is OK
but when I try the next code: update-alternatives --config arm-linux-gnueabihf-gcc I’ve got the problem:
There is only one alternative in the group of links arm-linux-gnueabihf-gcc (provee /usr/bin/arm-linux-gnueabihf-gcc): /usr/bin/arm-linux-gnueabihf-gcc-5
I’m new with linux, I already installed gcc-7 with this: sudo add-apt-repository ppa:ubuntu-toolchain-r/test then sudo add-apt-repository ppa:ubuntu-toolchain-r/test then sudo apt-get install gcc-7 g+±7 after that I’ve checked the version gcc-7 --version and it shows gcc-7 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0 but when I look for it at /usr/bin/ there is not arm-linux-gnueabihf-gcc-7, hence when I repeat the steps before I get the same problem. Could you please give me and idea? what i’m doing wrong?
i wonder where you read about changing the crosscompiler…imho you need not to do this…this was needed till the point where were problems with gcc7, but these should be fixed…so just install the meta-package gcc-arm-linux-gnueabihf and run build.sh
ok, this instructions are not from me and using official 4.14 repo…
for compiling kernel just use my repo:
and follow instructions in Readme there…you can compile with gcc 7 and you have an actual kernel (4.14.103 or maybe 4.19.25)
so you need only to clear first 1M for clearing boot-data and the following 8k to erase environment, remember that at the end of the first 512 byte your partitiontable is saved…so its better to clear beginning on 512byte
I hope this will work. I will copy these files in the boot directory of rootfs from where they will be dd’ed to the boot partition when the pkgbuild is run.
Next I will also use the uEnv.txt to be copied to the boot partition from the boot directory when i build the kernel and move the kernel img as uImage to boot partition. Is this second part of uEnv.txt and uImage correct? From what I have observed from the existing ubuntu img.
Third rootfs will be generated from manjaro linux along with the kernel from your branch.
please do not copy any files to /boot in rootfs because it is the mountpoint for boot-partition and boot will fail if it is not empty. where do you call pkgbuild?
if you do not change filename of kernel (leave uImage and replace the old) you do not need to create a uEnv.txt, only if the name changes or you want to change/extend other vars in the environment. uEnv.txt/uImage needs to be located in the folder you’ve seen above. if you add a new uImage without replacing the old, say uImage_5.3 you create a uEnv.txt and add this at the end (if it exists or you copy an existing file):
btw. instead of copying the 4 files you can simply copy the first 1M from my image to yours…re-read partition table, create filesystems and add kernel+rootfs+modules
Yes boot directory in rootfs will be empty as it is cleaned after using its files
What I used to do is compile kernel along with files needed for boot partition using pkgbuild and then build the whole manjaro linux using manjaro-arm-tool official tool this gives us manjaro img to be flashed on media for booting.
No will go with the standard practice of using uImage and will not be changing the name instead will compile kernel separately for every build.
Yes this I can use for testing if the first method fails but to maintain the device with updates I think the first method is stable. Is that correct?
as the 3 headers (and in your case uboot too) do not change, you can simple use the 1MB-DD from my image…as i said you still can update uboot by overwriting the old one…had no problems with this method and i did it many many times
now i load uboot for testing via tftp to protect my card
Thanks for this guidance.
But why do you suggest to use 7GB img against small multiple imgs?
also Is there latest u-boot.bin file pre-compiled? Just to test once this approach works fine then will built it from scratch.