06-10-2020, 04:57 AM
(This post was last modified: 06-10-2020, 05:50 AM by chaoskampf.)
kali image:
Code: parted -m kali-linux-2020.2-pinebook-pro.img print | tail -n +3 | awk -F ":" '{print $(NF-2)}'
ext3
kali on sd:
Code: file -sL /dev/mmcblk1p1
/dev/mmcblk1p1: Linux rev 1.0 ext3 filesystem data
edited: There is no extlinux.conf (there are boot.txt and boot.src) in this Kali image and I was not able to boot from sd after flashing kali to emmc without reflashing e.g. manjaro to emmc.
06-10-2020, 07:31 AM
(This post was last modified: 06-10-2020, 07:32 AM by wdt.)
Well, there clearly is not room in the image for idbloader & friends
So it must rely on the uboot on emmc
So, when you flash the emmc, there is no more a uboot...anywhere
Personally, I would hack the image, then test by disabling emmc
As so
15Mblank + kali + 1M blank,, fdisk image,, dd mrfixit idbloader, uboot, ATF to image
Try boot with working then non-working emmc
Maybe boot.txt need editing (&recompile)
As I said,, it must not have been tested, so I have little confidence
OR, if you can't do it right, why bother
As far as I know need to edit boot.txt to match kali on emmc (root=UID) and generate boot.src with command smth like the following.
Code: mkimage -A arm64 -T script -O linux -d boot.txt boot.scr
06-10-2020, 09:19 AM
(This post was last modified: 06-10-2020, 09:29 AM by granstr0m.)
(06-10-2020, 07:31 AM)wdt Wrote: Well, there clearly is not room in the image for idbloader & friends
So it must rely on the uboot on emmc
So, when you flash the emmc, there is no more a uboot...anywhere
Personally, I would hack the image, then test by disabling emmc
As so
15Mblank + kali + 1M blank,, fdisk image,, dd mrfixit idbloader, uboot, ATF to image
Try boot with working then non-working emmc
Maybe boot.txt need editing (&recompile)
As I said,, it must not have been tested, so I have little confidence
OR, if you can't do it right, why bother
Perhaps one should look into if someone is working on an emmc installer image. It seems not that easy doing this by hand. It could have been a bit easier if Kali kept their /boot on a separate partition, but no. Damn I really want to use this computer with Kali installed on. the emmc.
(06-10-2020, 09:19 AM)granstr0m Wrote: (06-10-2020, 07:31 AM)wdt Wrote: Well, there clearly is not room in the image for idbloader & friends
So it must rely on the uboot on emmc
So, when you flash the emmc, there is no more a uboot...anywhere
Personally, I would hack the image, then test by disabling emmc
As so
15Mblank + kali + 1M blank,, fdisk image,, dd mrfixit idbloader, uboot, ATF to image
Try boot with working then non-working emmc
Maybe boot.txt need editing (&recompile)
As I said,, it must not have been tested, so I have little confidence
OR, if you can't do it right, why bother
Perhaps one should look into if someone is working on an emmc installer image. It seems not that easy doing this by hand. It could have been a bit easier if Kali kept their /boot on a separate partition, but no. Damn I really want to use this computer with Kali installed on. the emmc.
The script for building the images is here:
https://gitlab.com/kalilinux/build-scrip...ook-pro.sh
Perhaps it can be modified to create an image that is installable. on the emmc.
06-10-2020, 11:21 AM
(This post was last modified: 06-10-2020, 12:04 PM by granstr0m.)
I did a quick check of the buildscript and it seems there is a bug.
In the beginning it sets up the partition 2048 sectors in to the device:
parted ${imagename}.img --script -- mkpart primary ext3 2048s 100%
At the end of the script it writes the idbloader and u-boot 64 sectors in and 16384 sectors in:
dd if="${basedir}"/../misc/pbp/idbloader.img of=${loopdevice} seek=64 conv=notrunc
dd if="${basedir}"/../misc/pbp/u-boot.itb of=${loopdevice} seek=16384 conv=notrunc
16384 obviously is far beyond the 2048 (if the default sector size is the same). This must be wrong.
So if you could change the line in the beginning to:
parted ${imagename}.img --script -- mkpart primary ext3 32768s 100%
and then build a new image perhaps it could be used to install with dd.
That is if there's no other configuration pointing at 2048 that needs to be changed???
I could give it a try though it will possibly take me some time to get the crosscompiler going...
I have reported our problems to the developers of the build script for Kali images.
https://gitlab.com/kalilinux/build-scrip...issues/189
06-10-2020, 01:11 PM
(This post was last modified: 06-10-2020, 02:41 PM by chaoskampf.)
I will try smth like bellow to move existing and configured Kali installation from SD to eMMC.
Steps:
1. Boot from kali on sd
2. Write u-boot and friends to eMMC:
Code: dd if=idbloader.img of=/dev/mmcblk2 bs=32k seek=1 conv=fsync
dd if=uboot.img of=/dev/mmcblk2 bs=64k seek=128 conv=fsync
dd if=trust.img of=/dev/mmcblk2 bs=64k seek=192 conv=fsync
3. Create partition on eMMC (starting at 32768 sector)
Code: (parted) mkpart primary ext3 32768s -1s
4. Mount the partition in /mnt
5.
6.
Code: mkdir dev proc sys mnt
7.
Code: rsync -aHxv --numeric-ids --progress /* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/mnt
8.
9. Edit boot.txt and change "root=PARTUUID=${uuid}" to "root=/dev/mmcblk2p1"
10.
Code: mkimage -A arm64 -T script -O linux -d boot.txt boot.scr
11. reboot (without sd)
Any suggestions and comments are appreciated.
(edited)
Is this right:
root=/dev/mmcblk1p1
I think mmcblk2 is always the emmc even if no sd is inserted.
(06-10-2020, 02:30 PM)granstr0m Wrote: Is this right:
root=/dev/mmcblk1p1
I think mmcblk2 is always the emmc even if no sd is inserted.
Yeah, you're right.
06-11-2020, 01:07 AM
(This post was last modified: 06-11-2020, 02:00 AM by granstr0m.)
(06-10-2020, 01:11 PM)chaoskampf Wrote: I will try smth like bellow to move existing and configured Kali installation from SD to eMMC.
Steps:
1. Boot from kali on sd
2. Write u-boot and friends to eMMC:
Code: dd if=idbloader.img of=/dev/mmcblk2 bs=32k seek=1 conv=fsync
dd if=uboot.img of=/dev/mmcblk2 bs=64k seek=128 conv=fsync
dd if=trust.img of=/dev/mmcblk2 bs=64k seek=192 conv=fsync
3. Create partition on eMMC (starting at 32768 sector)
Code: (parted) mkpart primary ext3 32768s -1s
4. Mount the partition in /mnt
5.
6.
Code: mkdir dev proc sys mnt
7.
Code: rsync -aHxv --numeric-ids --progress /* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/mnt
8.
9. Edit boot.txt and change "root=PARTUUID=${uuid}" to "root=/dev/mmcblk2p1"
10.
Code: mkimage -A arm64 -T script -O linux -d boot.txt boot.scr
11. reboot (without sd)
Any suggestions and comments are appreciated.
(edited)
I will try your guide above during the day. Where do you find the latest version of these files:
idbloader.img
uboot.img
trust.img
I followed your guide and it works!!!
Thankyou!!!!!!
I actually had Manjaro installed so I skipped step 2 and just deleted p1 and p2 since the boot stuff was already there.
Added a few code steps that might not be obvious to everyone:
1. Boot from kali on sd
2. Write u-boot and friends to eMMC:
Code:
dd if=idbloader.img of=/dev/mmcblk2 bs=32k seek=1 conv=fsync
dd if=uboot.img of=/dev/mmcblk2 bs=64k seek=128 conv=fsync
dd if=trust.img of=/dev/mmcblk2 bs=64k seek=192 conv=fsync
3. Create partition on eMMC (starting at 32768 sector)
Code:
parted /dev/mmcblk2
(parted) mkpart primary ext3 32768s -1s
mkfs.ext3 /dev/mmcblk2p1
4. Mount the partition in /mnt
mount -t ext3 /dev/mmcblk2p1 /mnt
5.
Code:
cd /mnt
6.
Code:
mkdir dev proc sys mnt
7.
Code:
apt update
sudo apt install rsync
rsync -aHxv --numeric-ids --progress /* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/mnt
8.
Code:
chroot /mnt
9. Edit boot.txt and change "root=PARTUUID=${uuid}" to "root=/dev/mmcblk2p1"
cd /boot
vi boot.txt
10.
Code:
mkimage -A arm64 -T script -O linux -d boot.txt boot.scr
11. reboot (without sd)
(06-11-2020, 01:07 AM)granstr0m Wrote: (06-10-2020, 01:11 PM)chaoskampf Wrote: I will try smth like bellow to move existing and configured Kali installation from SD to eMMC.
Steps:
1. Boot from kali on sd
2. Write u-boot and friends to eMMC:
Code: dd if=idbloader.img of=/dev/mmcblk2 bs=32k seek=1 conv=fsync
dd if=uboot.img of=/dev/mmcblk2 bs=64k seek=128 conv=fsync
dd if=trust.img of=/dev/mmcblk2 bs=64k seek=192 conv=fsync
3. Create partition on eMMC (starting at 32768 sector)
Code: (parted) mkpart primary ext3 32768s -1s
4. Mount the partition in /mnt
5.
6.
Code: mkdir dev proc sys mnt
7.
Code: rsync -aHxv --numeric-ids --progress /* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/mnt
8.
9. Edit boot.txt and change "root=PARTUUID=${uuid}" to "root=/dev/mmcblk2p1"
10.
Code: mkimage -A arm64 -T script -O linux -d boot.txt boot.scr
11. reboot (without sd)
Any suggestions and comments are appreciated.
(edited)
I will try your guide above during the day. Where do you find the latest version of these files:
idbloader.img
uboot.img
trust.img
I followed your guide and it works!!!
Thankyou!!!!!!
I actually had Manjaro installed so I skipped step 2 and just deleted p1 and p2 since the boot stuff was already there.
Added a few code steps that might not be obvious to everyone:
1. Boot from kali on sd
2. Write u-boot and friends to eMMC:
Code:
dd if=idbloader.img of=/dev/mmcblk2 bs=32k seek=1 conv=fsync
dd if=uboot.img of=/dev/mmcblk2 bs=64k seek=128 conv=fsync
dd if=trust.img of=/dev/mmcblk2 bs=64k seek=192 conv=fsync
3. Create partition on eMMC (starting at 32768 sector)
Code:
parted /dev/mmcblk2
(parted) mkpart primary ext3 32768s -1s
mkfs.ext3 /dev/mmcblk2p1
4. Mount the partition in /mnt
mount -t ext3 /dev/mmcblk2p1 /mnt
5.
Code:
cd /mnt
6.
Code:
mkdir dev proc sys mnt
7.
Code:
apt update
sudo apt install rsync
rsync -aHxv --numeric-ids --progress /* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/mnt
8.
Code:
chroot /mnt
9. Edit boot.txt and change "root=PARTUUID=${uuid}" to "root=/dev/mmcblk2p1"
cd /boot
vi boot.txt
10.
Code:
mkimage -A arm64 -T script -O linux -d boot.txt boot.scr
11. reboot (without sd)
It's my pleasure.
Code: fdisk -l
Disk /dev/mmcblk2: 58.25 GiB, 62537072640 bytes, 122142720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x50435990
Device Boot Start End Sectors Size Id Type
/dev/mmcblk2p1 32768 122142719 122109952 58.2G 83 Linux
Code: lsblk
mmcblk2 179:0 0 58.2G 0 disk
└─mmcblk2p1 179:1 0 58.2G 0 part /
mmcblk2boot0 179:32 0 4M 1 disk
mmcblk2boot1 179:64 0 4M 1 disk
|