RedPill - the new loader for 6.2.4 - Discussion


Recommended Posts

2 hours ago, Aigor said:

Act as root, not sudo, real root 

 

I replaced it with a root account using the "su root" command and executed it, but the same error appears.
What should I do if I am using a Windows Linux subsystem?

Link to post
Share on other sites
1 hour ago, progressives said:

I replaced it with a root account using the "su root" command and executed it, but the same error appears.
What should I do if I am using a Windows Linux subsystem?

As far i saw you missed redpill.ko lkm, di you compile them?

Link to post
Share on other sites

could anybody provide any help with compiling the model with toolkit , 

@Vortex said this is possible. .

 

When I try to do this I get the following error 

 

ubuntu:/usr/local/x86_64-pc-linux-gnu/linux-3.10.x$ sudo make 
/usr/local/x86_64-pc-linux-gnu/linux-3.10.x/arch/x86/Makefile:164: CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.
make[1]: Nothing to be done for 'all'.
make[1]: Nothing to be done for 'relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CC      init/main.o
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  CC      init/do_mounts.o
  CC      init/do_mounts_rd.o
  CC      init/do_mounts_initrd.o
  CC      init/do_mounts_md.o
  LD      init/mounts.o
  CC      init/initramfs.o
init/initramfs.c:22:29: fatal error: crypto/hydrogen.h: No such file or directory
 #include <crypto/hydrogen.h>
                             ^
compilation terminated.
make[1]: *** [scripts/Makefile.build:309: init/initramfs.o] Error 1
make: *** [Makefile:800: init] Error 2

 

Link to post
Share on other sites
29 minutes ago, scoobdriver said:

could anybody provide any help with compiling the model with toolkit , 

@Vortex said this is possible. .

 

When I try to do this I get the following error 

 


ubuntu:/usr/local/x86_64-pc-linux-gnu/linux-3.10.x$ sudo make 
/usr/local/x86_64-pc-linux-gnu/linux-3.10.x/arch/x86/Makefile:164: CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.
make[1]: Nothing to be done for 'all'.
make[1]: Nothing to be done for 'relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CC      init/main.o
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  CC      init/do_mounts.o
  CC      init/do_mounts_rd.o
  CC      init/do_mounts_initrd.o
  CC      init/do_mounts_md.o
  LD      init/mounts.o
  CC      init/initramfs.o
init/initramfs.c:22:29: fatal error: crypto/hydrogen.h: No such file or directory
 #include <crypto/hydrogen.h>
                             ^
compilation terminated.
make[1]: *** [scripts/Makefile.build:309: init/initramfs.o] Error 1
make: *** [Makefile:800: init] Error 2

 

As vortex wrote, you don't need source to compile redpill module 

Link to post
Share on other sites
1 hour ago, Aigor said:

As vortex wrote, you don't need source to compile redpill module 

 

Ok , I think I'm past my skill limit . May have to sit this one out , and leave the knowledgeable people to do the great work .  (seeing what I have seen so far, I am very grateful to all the team) 

I tried to compile redpill-lkm with the toolkit pkgscripts-ng 

It didn't work, I'm assuming I need to edit the makefile or something . 

 

pkgscripts-ng/PkgCreate.py -p bromolow -I /toolkit/source/redpill-lkm

 

Link to post
Share on other sites
8 minutes ago, scoobdriver said:

 

Ok , I think I'm past my skill limit . May have to sit this one out , and leave the knowledgeable people to do the great work .  (seeing what I have seen so far, I am very grateful to all the team) 

I tried to compile redpill-lkm with the toolkit pkgscripts-ng 

It didn't work, I'm assuming I need to edit the makefile or something . 

 


pkgscripts-ng/PkgCreate.py -p bromolow -I /toolkit/source/redpill-lkm

 

Have you followed telegram chat? 
RedPill-TTG

 

Link to post
Share on other sites
2 hours ago, progressives said:

I'm an amateur.
That's why we're stuck. I need your help.

how to use redpill-lkm 

캡처.JPG


That's why it is still in dev...
May be wiser to leave them time to finish and make it ootb solution than spending time helping people that try to achieve the same without the knowledge?

  • Like 3
Link to post
Share on other sites
Quote

May be wiser to leave them time to finish and make it ootb solution

Exactly what I need and am waiting patiently for and with all due respect for everyone working so hard on this. It will be ready when it's ready.

  • Like 2
Link to post
Share on other sites
5 hours ago, progressives said:

I'm an amateur.
That's why we're stuck. I need your help.

how to use redpill-lkm 

 

It is not enough to just create the folder. You need to have the kernel sources to be extracted into that folder!

Download from here.

Link to post
Share on other sites

For all of you that want a "redpill tool chain".

Well, I created a make based project that creates a docker image with the toolchain for brolow or apollolake

 

make targets `build_image_bromolow` and `build_image_apollolake`:

- download matching toolchain and kernel version on the host before building the image

- base image ubuntu:18.04

- sources of redpill-lkm fetched while building the image

- sources of redpill-load fetched while building the image

- A Makefile is added inside the image, that allows to generate the user_data.json based on container environment variables and cover build of redpill.ko and the image

 

make targets 'run_container_bromolow` and `run_container_apollolake`

- mount a volume for the redpill-load/cache folder

- mount a folder to the redpill-load/image folder

- set parameters for user_data.json (requires editing of the Makefile)

- take care of parameters that allow to mount the loop device while creating the image

 

Though, there is one caveat: the project requires make, which is not available on Synology

 

Note1: once you compile make for Synology (out of scope for this tool chain), you can actualy create and use the image on a Synology or XPE box :)

Note2: even works on wsl2 with enabled systemd, installed docker.io and make package

 

Usage: change into the folder you extracted the zip into and run `make` to see the list of available targets.

 

Update: re-uploaded, because I accidently broke the apollolake part in the Makefile . 

 

Update2: for those who feel brave, I added my build of make for Synology as attachement. I placed mine in /usr/local/bin/make. Don't forget to chmod +x the file after copying to your Syno/XPE box.  

redpill-tool-chain.zip

syno-make-x86_64.zip

Edited by haydibe
add syno-make-x86_64.zip
  • Like 7
Link to post
Share on other sites
1 hour ago, haydibe said:

For all of you that want a "redpill tool chain".

Well, I created a make based project that creates a docker image with the toolchain for brolow or apollolake

 

make targets `build_image_bromolow` and `build_image_apollolake`:

- download matching toolchain and kernel version on the host before building the image

- base image ubuntu:18.04

- sources of redpill-lkm fetched while building the image

- sources of redpill-load fetched while building the image

- A Makefile is added inside the image, that allows to generate the user_data.json based on container environment variables and cover build of redpill.ko and the image

 

make targets 'run_container_bromolow` and `run_container_apollolake`

- mount a volume for the redpill-load/cache folder

- mount a folder to the redpill-load/image folder

- set parameters for user_data.json (requires editing of the Makefile)

- take care of parameters that allow to mount the loop device while creating the image

 

Though, there is one caveat: the project requires make, which is not available on Synology

 

Note1: once you compile make for Synology (out of scope for this tool chain), you can actualy create and use the image on a Synology or XPE box :)

Note2: even works on wsl2 with enabled systemd, installed docker.io and make package

 

Usage: change into the folder you extracted the zip into and run `make` to see the list of available targets.

 

Update: re-uploaded, because I accidently broke the apollolake part in the Makefile . 

 

redpill-tool-chain.zip 3.92 kB · 10 downloads

 

Thx for your tools, when I try boot the redpill-DS918+_6.2.4-25556_b1628193475.img, it stopped at GRUB. anything that I have missed? thanks.

Link to post
Share on other sites
Just now, mcdull said:

 

Thx for your tools, when I try boot the redpill-DS918+_6.2.4-25556_b1628193475.img, it stopped at GRUB. anything that I have missed? thanks.

Did you use the make target run_container_apollolake to actualy run the container, or did you start it with `docker  run`?

The container needs a shitload of permissions and trickery to actualy lift the image repackaging part. The docker run statement ecapsulated in the  run_container_apollolake takes care of setting the required parameters. 

Link to post
Share on other sites
3 minutes ago, haydibe said:

Did you use the make target run_container_apollolake to actualy run the container, or did you start it with `docker  run`?

The container needs a shitload of permissions and trickery to actualy lift the image repackaging part. The docker run statement ecapsulated in the  run_container_apollolake takes care of setting the required parameters. 

I user make run_container_apollolake

and make build all inside

 

Link to post
Share on other sites

This should be sufficient to compile an image:

on the host `make run_container_apollolake`

inside the container `make build_all`

 

The user_config.json is auto generated and populated with the variables configured in the Makefile of the host. The image creation should work regardless wether you set the user_config variables or not. But in order to create an image that boots, you will have to set the variables. You don't need to build the docker image again, the variables will be passed into the container when running run_container_apollolake.

 

I haven't tested the created image yet, as I first wanted to share the outcome of the tool chain creation first.  

 

Edited by haydibe
Link to post
Share on other sites
root@d6622ebf13fe:/opt# fdisk -l /opt/redpill-load/images/redpill-DS918+_6.2.4-25556_b1628198282.img
Disk /opt/redpill-load/images/redpill-DS918+_6.2.4-25556_b1628198282.img: 128 MiB, 134217728 bytes, 262144 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: 0xf110ee87

Device                                                               Boot  Start    End Sectors Size Id Type
/opt/redpill-load/images/redpill-DS918+_6.2.4-25556_b1628198282.img1        2048 100351   98304  48M 83 Linu
/opt/redpill-load/images/redpill-DS918+_6.2.4-25556_b1628198282.img2      100352 253951  153600  75M 83 Linu
/opt/redpill-load/images/redpill-DS918+_6.2.4-25556_b1628198282.img3      253952 262143    8192   4M 83 Linu

 

I cannot mount the img using vfat or ext2 for checking the grub, and the fdisk show the above.

mount: /mnt/boot: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

Link to post
Share on other sites

That's for someone else to answer. The only thing I can say is that the first partition can be mounted with OSFMount and has the grub.cfg, like we are with jun's loader image. Though, OSFMount can mount the other two partitions, but windows won't show anything.

 

Couldn't get it to work with `losetup` either. A closer look into the redpill-load sources would actualy show its used there. 

 

It works with kpartx ootb:

# kpartx -v -a redpill-DS918+_6.2.4-25556_b1628193299.img
add map loop2p1 (252:0): 0 98304 linear 7:2 2048
add map loop2p2 (252:1): 0 153600 linear 7:2 100352
add map loop2p3 (252:2): 0 8192 linear 7:2 253952

# mkdir /tmp/mount

# mount /dev/mapper/loop2p1 /tmp/mount
# ls -l /tmp/mount
total 26979
drwxr-xr-x  3 root root      512 Jan  1  1970 ./
drwxrwxrwt 13 root root     4096 Aug  6 00:14 ../
drwxr-xr-x  3 root root      512 Jul 27 21:15 boot/
-rwxr-xr-x  1 root root 24150016 Aug  5 21:55 rd.gz*
-rwxr-xr-x  1 root root  3470496 Aug  5 21:55 zImage*
# umount /tmp/mount

# mount /dev/mapper/loop2p2 /tmp/mount
# ls -l /tmp/mount
total 12
drwx------ 2 root root 12288 Jul 25 07:27 lost+found

# umount /tmp/mount

# mount /dev/mapper/loop2p3 /tmp/mount
mount: /tmp/mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop2p3, missing codepage or helper program, or other error.

# kpartx -v -d redpill-DS918+_6.2.4-25556_b1628193299.img
del devmap : loop2p3
del devmap : loop2p2
del devmap : loop2p1
loop deleted : /dev/loop2

 

Partition 1 is the one with the grub.cfg. Partition 2 is empty. I couldn't get Partition 3 to mount. 

 

Update: got it to work with losetup, the outcome is of course the same:

# losetup -P /dev/loop2 redpill-DS918+_6.2.4-25556_b1628193299.img

# mount /dev/loop2p1 /tmp/mount
# ls /tmp/mount
boot  rd.gz  zImage
# umount /tmp/mount

# mount /dev/loop2p2 /tmp/mount
# ls /tmp/mount
lost+found
# umount /tmp/mount

# mount /dev/loop2p3 /tmp/mount
mount: /tmp/mount: wrong fs type, bad option, bad superblock on /dev/loop2p3, missing codepage or helper program, or other error.

# losetup -d /dev/loop2

The -P parameter was missing in my previous attempt.

Edited by haydibe
Link to post
Share on other sites

The redpill tool chain docker image builder is updated:

- bind-mounts an existing user_config.json file into the redpill-load folder (and then skips autogeneration of the file inside the container)

- added variables in the Makefile to specify the redpill-lkm and redpill-load repository urls and branches  

- added variables in the Makefile to specify the urls for the bromolow and apollolake toolchain/kernel

- refactored repated code blocks into Make functions

- refactored to single Dockerfile using ARGs to build the target bromolow or apolloake image

 

Usage bromolow:

- (on host) build image: make build_image_bromolow

- (on host) create your own user_config.json or edit the USERCONFIG_* variables in the Makefile

- (on host) run container: make  run_container_bromolow

- (in container) build kernel and loader image: make build_all

 

Usage apollolake:

- (on host) build image: make build_image_apollolake

- (on host) create your own user_config.json or edit the USERCONFIG_* variables in the Makefile

- (on host) run container: make  run_container_apollolake

- (in container) build kernel and loader image: make build_all

 

After running `make build_all` the created redpill bootloader image will be present in the ./image folder on the host.

 

Tested with hosts: Ubuntu 18.04 VM, Ubuntu 20.04 WSL2 and XPE  (the make binary to build on Synology/XPE can be found a couple of posts earlier)

 

Dependencies: make and docker

redpill-tool-chain_x86_64_v0.2.zip

Edited by haydibe
  • Like 2
  • Thanks 2
Link to post
Share on other sites

Thanks guys, I used this docker image builder to build a loader for a baremetal Microserver Gen7, its working so far, however with an intel network card, no onboard network, will test some more and report the results

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.