Date: Sun, 17 Dec 2023 00:27:58 +0000 From: Stanislav Silnicki <stanislav.silnicki@mailgate.us> To: freebsd-arm@freebsd.org Subject: Re: How to boot FreeBSD for arm 32 bit as DomU with u-boot on my ARM Chromebook Message-ID: <da024d1687f3a.2f0c601bba502@mailgate.us> References: <CA%2B1FSiit5NJ_W7f5mssivkGGLevXh_XmSB7ZxZbQe1dgev0_Pg@mail.gmail.com> <97aa980b9b44.6eb7f9d5c54e7@mailgate.us> <CA%2B1FSiheSwrO7Tz3F3Nmu4vcC2E=ONRX8nF3bhQGV0UDOFTrww@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
------sinikael-?=_1-17027728790910.910944075536489 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I'm not an expert in the topic, I only know, that ARM has divided hardware = into two worlds - Secure and Not-So, strictly limiting any software, = running in non-secure world with access to functions and resources. = https://developer.arm.com/documentation/den0013/d/Security/TrustZone-hardwa= re-architecture=3Flang=3Den I'm not sure, that I'm getting you right, as I don't understand what you = mean under =22the first u-boot=22. As I understand, virtualization (HYP) is running in non-secure world = (https://developer.arm.com/documentation/ddi0406/c/System-Level-Architectur= e/The-System-Level-Programmers--Model/The-Virtualization-Extensions), so my= guess (only guess!!!), virtualization software has to prepare (configure) = HW platform in the way, that FreeBSD kernel will not lack any resources, = required to configure MPU, VA, etc. So, if you lucky to boot virtualizer, which is aware of target OS, that = maybe you can boot the kernel. Although, I doubt, that you need to boot = 'second' u-boot to boot the kernel - there is simply ubldr, which you can = hook somehow from virtualizer.... Stan Mario Marietto wrote: ---> As I understand, it makes sure that u-boot keeps in secure mode during= boot and passes control to ubldr, which boots FreeBSD kernel, in that mode= . Can you elaborate your sentence more =3F I know that the bootloader secure = mode is bypassed by the virtual open systems u-boot. Are you saying that = when the control passes to the second u-boot,it will happen in secure mode,= so that the bypass that happened loading the first u-boot,is annulled =3F = If this is true,maybe can I boot FreeBSD using the virtual-open-system = custom u-boot =3F Is this compatible with FreeBSD =3F Where can I find the = u-boot.bin that the xen developer talked about =3F thanks bro'.=20 On Sun, Dec 17, 2023 at 12:35=E2=80=AFAM Stanislav Silnicki <stanislav.= silnicki@mailgate.us <mailto:stanislav.silnicki@mailgate.us> > wrote: Hi Mario, U-Boot beast is hiding in this den: https://source.denx.de/u-boot/u-boot.= git <https://source.denx.de/u-boot/u-boot.git>=20 I took a brief look at your post and it seems to me, that option = CONFIG=5FCMO=5FBY=5FVA=5FONLY is irrelevant to your target armv7 32 bit = platform: https://source.denx.de/u-boot/u-boot/-/blob/master/arch/arm/cpu/a= rmv8/Kconfig=3Fref=5Ftype=3Dheads#L3 <https://source.denx.= de/u-boot/u-boot/-/blob/master/arch/arm/cpu/armv8/Kconfig=3Fref=5Ftype=3Dhe= ads#L3>=20 As for compiling the u-boot, it is a doable task, given that you understand= what you are doing. There are no specific options in u-boot devoted to = FreeBSD. It is a boot loader, whose mission to make basic hardware = initialization, read you kernel file from some media into RAM and then pass= it control.=20 Basically, you can grab some defconfig, prepared for any other Exynos5250 = based board (say, this one: https://source.denx.de/u-boot/u-boot/-/blob/mas= ter/configs/arndale=5Fdefconfig=3Fref=5Ftype=3Dheads) <https://source.denx.= de/u-boot/u-boot/-/blob/master/configs/arndale=5Fdefconfig=3Fref=5Ftype=3Dh= eads)> and adopt it somehow. As per my experience, you have to respect these two options, compiling = u-boot for FreeBSD: https://github.com/freebsd/freebsd-ports/blob/main/sysu= tils/u-boot-master/files/FreeBSD=5FFragment <https://github.= com/freebsd/freebsd-ports/blob/main/sysutils/u-boot-master/files/FreeBSD=5F= Fragment>=20 As I understand, it makes sure, that u-boot keeps in secure mode during = boot and passes control to ubldr, which boots FreBSD kernel, in that mode. = Otherwise, there a lot of surprises you may realize. Hope, this will help to progress you tasks Stan Mario Marietto wrote: Hello. I'm trying to boot FreeBSD for arm32 bit as DomU on my ARM Chromebook. = Basically there are two ways to accomplish this task : 1) to write a patch that allows the FreeBSD kernel to boot as a zImage file= . This could be accomplished applying this patch to a specific file that's = on the source code of FreeBSD : https://xenbits.xen.org/gitweb/=3Fp=3Dp...8;hb=3D0782e25d98cc1391472717035f= 986c979edef0c9 <https://xenbits.xen.org/gitweb/=3Fp=3Dpeople/julieng/freebs= d.git;a=3Dblob=5Fplain;f=3Dsys/arm/conf/XENVIRT;h=3Dff6433392e6fc2d5fa7c1ad= 1f7c40155003af9a8;hb=3D0782e25d98cc1391472717035f986c979edef0c9>=20 This patch was written by Julien Grall a lot of time ago and now it does = not work anymore. This is the reason : It appears FreeBSD-CURRENT removed the last step converting the kernel file= to kernel.bin. The patch can be readily rebased, but without kernel.bin = that doesn't do too much.=20 So,without a rebase of that patch the first option is not applicable. And = I'm not able to fix it. 2) booting FreeBSD using U-Boot,as explained to me by a xen developer : I was trying to explain why and how Julien's patch works so that you could = be the one to re-do something similar or fix the patch on the FreeBSD = kernel that you are working with. I am happy to help review and write = patches but I don't work with the FreeBSD kernel so I wouldn't be able to = help you quickly. However, I might have a suggestion. Do you know if = FreeBSD can be booted by U-Boot =3F Because U-Boot definitely boots as Xen = on ARM guest firmware/bootloader. You should be able to build U-Boot and = use the U-Boot binary as Xen guest kernel, then U-Boot could load FreeBSD = from disk or network and start it. For instance as domU config file: kernel=3D=22/home/petalinux/u-boot.bin=22 disk =3D [ '/home/petalinux/test.img,raw,xvda' ] I know it is important to build u-boot with the following config to make it= work on Xen. CONFIG=5FCMO=5FBY=5FVA=5FONLY=3Dy=20 This option seems more doable to me according to my knowledge. But I need = to understand how to do it. Well,let's say that on the ARM Chromebook I'm forced to use and install a = customized version of u-boot,created by virtual open systems,because it is = the only one that allows bypassing its bootloader protection. You can find = more information here : http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/=3F= vos=3Dtech <http://www.virtualopensystems.com/en/solutions/guides/kvm-on-ch= romebook/=3Fvos=3Dtech>=20 This is the relevant section to read : Bootloader : If you wish to skip this chapter you can download a pre-compiled binary of = the bootloader: $ wget http://www.virtualopensystems.com/downloads/guides/kvm=5Fon=5Fchrome= book/nv=5Fu-boot-snow.kpart <http://www.virtualopensystems.= com/downloads/guides/kvm=5Fon=5Fchromebook/nv=5Fu-boot-snow.kpart>=20 To be able to run KVM on ARM platforms, the kernel has to be booted in = hypervisor mode. Because of this relatively recent requirement (due to the = introduction of the virtualization extensions), up until now all booting = methods would boot the kernel in the standard Supervisor mode. For the ARM = Chromebook the default boot procedure doesn't allow us to boot in = hypervisor mode. Although the laptop's boot mechanism is based on the = frequently used u-boot, the binary is located in RO memory. Fortunately, a = chained u-boot mechanism can be used (i.e. starting another u-boot after = the original). We can then enter hypervisor mode from our custom iteration = of u-boot and subsequently load our kernel and userspace. Checkout the needed u-boot code : $ git clone git://github.com/virtualopensystems/u-boot.git$ <http://github.= com/virtualopensystems/u-boot.git$> cd u-boot$ ./scripts/build.sh If successful, a message about how to copy the bootloader on the USB flash = disk or SD card will appear. We will use it later when preparing the boot = medium to start our system. If you have followed the Setting up the boot = medium chapter and you have a prepared boot device, then you can update = u-boot by running : $ sudo dd if=3Dnv=5Fuboot-snow.kpart of=3D/dev/sdX1=20 so,the needed u-boot that we must use should be installed on the first = partition of the sd card. There is another relevant section to read : Setting up the boot medium Now it is time to copy all the relevant files that we created in the = previous chapters,and use them to boot Chromebook with a different kernel = and OS. In all these examples the device /dev/sdX is used. Take extra care = to change the examples to the device that you have attached. Insert the = boot medium on your workstation and carefully execute the following step. = First we need to properly format the boot medium. In the uboot source directory : $ sudo ./scripts/sdcard.sh /dev/sdX This will erase all data and create 4 partitions in the medium, along with = copying the u-boot binary to the first partition: Partition 1 =3D ChromeOS signed binary (V.O.S chained u-boot) Partition 2 =3D not used Partition 3 =3D EXT2 partition for u-boot files (uImage and exynos5250-snow= .dtb) Partition 4 =3D EXT4 partition for userspace files With u-boot being copied, next is the kernel image and DTB file. From the = kernel source execute : $ mkdir ../mnt/ $ sudo mount /dev/sdX3 ../mnt/ $ sudo cp arch/arm/boot/uImage ../mnt/ $ sudo cp arch/arm/boot/dts/exynos5250-snow.dtb ../mnt/ $ sudo umount /dev/sdX3 Finally, we have to copy the Ubuntu userspace filesystem that we created = earlier: $ sudo mount /dev/sdX4 mnt/$ sudo cp -a ./precise/* mnt/$ sudo umount = /dev/sdX4=20 Now,my idea is to chainload the already chain loaded u-boot created by V.O.= S to the new u-boot that we need for booting FreeBSD and that can be = installed in the partition n.2,as shown in this scheme,because it is not = used : Partition 1 =3D ChromeOS signed binary (V.O.S chained u-boot) Partition 2 =3D not used (maybe we can install the u-boot for arm 32 bit,= compatible with FreeBSD on this partition) Partition 3 =3D EXT2 partition for u-boot files (uImage and exynos5250-snow= .dtb) Partition 4 =3D EXT4 partition for userspace files Take in consideration that default boot string is hardcoded here,in the = snow.h file of the custom u-boot created by VOS : https://github.com/virtualopensyste...18a39b6c177dff58a/include/configs/sno= w.h#L101 <https://github.com/virtualopensystems/u-boot/blob/eecfeb578e296ef= 3b739ac918a39b6c177dff58a/include/configs/snow.h#L101>=20 and it needs to be recompiled because it should point to the partition n.2,= where I will install the u-boot files as explained here : https://wiki.freebsd.org/arm/Chromebook <https://wiki.freebsd.= org/arm/Chromebook>=20 I have some questions to ask before I start working on this. 1) The xen developer said : You should be able to build U-Boot and use the U-Boot binary as Xen guest = kernel...=20 where is the u-boot binary,according to this document =3F https://wiki.freebsd.org/arm/Chromebook <https://wiki.freebsd.= org/arm/Chromebook>=20 I don't see it. 2) where is the source code of the file that I can get here : http://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/nv= =5Fuboot-snow-simplefb.kpart.bz2 I need the source code if I want to recompile u-boot so that it can point = to the partition 4. Maybe it can be found on this link : http://linux-exynos.org/dist/chromebook/nv=5Fuboot/ <http://linux-exynos.= org/dist/chromebook/nv=5Fuboot/>=20 but it can't be opened.... 3) in this specific scenario the source code of u-boot should run on arm 32= bit,not on arm 64,because I have the Samsung Chromebook =22SNOW=22 model = XE303C12,that's powered by a Samsung Exynos 5250 (ARMv7 32 bit Cortex A15) = Soc. 4) I'm not sure if I can chainload the customized u-boot created by V.O.S = that should be installed on the first partition with the u-boot tailored = for booting FreeBSD that should be installed on the partition 2.... 5) the xen developer said that u-boot should be compiled enabling this = option : Code:=20 CONFIG=5FCMO=5FBY=5FVA=5FONLY=3Dy=20 Well,can you provide some good source that can help me to understand how I = can recompile u-boot for FreeBSD =3F thanks. --=20 Mario. --=20 Mario. ------sinikael-?=_1-17027728790910.910944075536489 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body><div> =20 =20 =20 =20 <meta charset=3D=22utf-8=22> =20 =20 <div id=3D=22compose-body-wrapper=22 dir=3D=22auto=22><div = dir=3D=22auto=22>I'm not an expert in the topic, I only know, that ARM has = divided hardware into two worlds - Secure and Not-So, strictly limiting any= software, running in non-secure world with access to functions and = resources. https://developer.arm.com/documentation/den0013/d/Security/= TrustZone-hardware-architecture=3Flang=3Den</div><div dir=3D=22auto=22 = id=3D=22tmjah=5Fg=5F1299=22><br></div><div dir=3D=22auto=22 = id=3D=22tmjah=5Fg=5F1299=22>I'm not sure, that I'm getting you right, as I = don't understand what you mean under =22the first u-boot=22.</div><div = dir=3D=22auto=22 id=3D=22tmjah=5Fg=5F1299=22><br></div><div = dir=3D=22auto=22 id=3D=22tmjah=5Fg=5F1299=22>As I understand, = virtualization (HYP) is running in non-secure world (https://developer.arm.= com/documentation/ddi0406/c/System-Level-Architecture/The-System-Level-Prog= rammers--Model/The-Virtualization-Extensions), so my guess (only guess!!!),= virtualization software has to prepare (configure) HW platform in the way,= that FreeBSD kernel will not lack any resources, required to configure MPU= , VA, etc.</div><div dir=3D=22auto=22 id=3D=22tmjah=5Fg=5F1299=22>So, if = you lucky to boot virtualizer, which is aware of target OS, that maybe you = can boot the kernel. Although, I doubt, that you need to boot 'second' = u-boot to boot the kernel - there is simply ubldr, which you can hook = somehow from virtualizer....</div><div dir=3D=22auto=22 = id=3D=22tmjah=5Fg=5F1299=22><br></div><div dir=3D=22auto=22 = id=3D=22tmjah=5Fg=5F1299=22>Stan</div><div dir=3D=22auto=22 = id=3D=22tmjah=5Fg=5F1299=22><br></div><div dir=3D=22auto=22 = id=3D=22tmjah=5Fg=5F1299=22><br></div><br></div><div = class=3D=22replyHeader=22 dir=3D=22auto=22>Mario Marietto = wrote:</div><br><br><div><blockquote cite=3D=22mid:CA+1FSiheSwrO7Tz3F3Nmu4v= cC2E=3DONRX8nF3bhQGV0UDOFTrww@mail.gmail.com=22 type=3D=22cite=22 = style=3D=22margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=22= ><div dir=3D=22ltr=22><div>---> As=20 I understand, it makes sure that u-boot keeps in secure mode during = boot=20 and passes control to ubldr, which boots FreeBSD kernel, in that mode.= </div><div><br></div><div>Can you elaborate your sentence more =3F I know = that the bootloader secure mode is bypassed by the virtual open systems = u-boot. Are you saying that when the control passes to the second u-boot,it= will happen in secure mode,so that the bypass that happened loading the = first u-boot,is annulled =3F If this is true,maybe can I boot FreeBSD using= the virtual-open-system custom u-boot =3F Is this compatible with FreeBSD = =3F Where can I find the u-boot.bin that the xen developer talked about =3F= thanks bro'. </div><div><br></div><div><br></div></div><br><div = class=3D=22gmail=5Fquote=22><div dir=3D=22ltr=22 class=3D=22gmail=5Fattr=22= >On Sun, Dec 17, 2023 at 12:35=E2=80=AFAM Stanislav Silnicki <<a = href=3D=22mailto:stanislav.silnicki@mailgate.us=22>stanislav.= silnicki@mailgate.us</a>> wrote:<br></div><blockquote = class=3D=22gmail=5Fquote=22 style=3D=22margin:0px 0px 0px 0.= 8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=22><div><div>= =20 =20 =20 =20 =20 =20 =20 <div> =20 =20 =20 =20 =20 =20 =20 <div id=3D=22m=5F5085590471051268986compose-body-wrapper=22 = dir=3D=22auto=22><div dir=3D=22auto=22>Hi=20 Mario,</div><div dir=3D=22auto=22><br></div><div dir=3D=22auto=22>U-Boot&nb= sp; beast is=20 hiding in this den: <a href=3D=22https://source.denx.de/u-boot/u-boot.= git=22 target=3D=22=5Fblank=22>https://source.denx.de/u-boot/u-boot.= git</a></div><div dir=3D=22auto=22>I took a brief look at your post and it = seems to me, that=20 option <span style=3D=22font-family:SFMono-Regular,Menlo,Monaco,= Consolas,"Liberation Mono","Courier New",= monospace;font-size:inherit=22>CONFIG=5FCMO=5FBY=5FVA=5FONLY</span> is= irrelevant to=20 your target armv7 32 bit=20 platform: <a href=3D=22https://source.denx.de/u-boot/u-boot/-/blob/mas= ter/arch/arm/cpu/armv8/Kconfig=3Fref=5Ftype=3Dheads#L3=22 = target=3D=22=5Fblank=22>https://source.denx.de/u-boot/u-boot/-/blob/master/= arch/arm/cpu/armv8/Kconfig=3Fref=5Ftype=3Dheads#L3</a></div><div = dir=3D=22auto=22 id=3D=22m=5F5085590471051268986tmjah=5Fg=5F1299=22><br></d= iv><div dir=3D=22auto=22 id=3D=22m=5F5085590471051268986tmjah=5Fg=5F1299=22= >As=20 for compiling the u-boot, it is a doable task, given that you = understand=20 what you are doing. There are no specific options in u-boot devoted to=20 FreeBSD. It is a boot loader, whose mission to make basic hardware=20 initialization, read you kernel file from some media into RAM and then = pass=20 it control. </div><div dir=3D=22auto=22 id=3D=22m=5F5085590471051268986tmja= h=5Fg=5F1299=22><br></div><div dir=3D=22auto=22 id=3D=22m=5F508559047105126= 8986tmjah=5Fg=5F1299=22>Basically, you can grab some defconfig,=20 prepared for any other Exynos5250 based board (say, this one: <a = href=3D=22https://source.denx.de/u-boot/u-boot/-/blob/master/configs/arndal= e=5Fdefconfig=3Fref=5Ftype=3Dheads)=22 target=3D=22=5Fblank=22>https://sour= ce.denx.de/u-boot/u-boot/-/blob/master/configs/arndale=5Fdefconfig=3Fref=5F= type=3Dheads)</a>=20 and adopt it somehow.</div><div dir=3D=22auto=22 id=3D=22m=5F50855904710512= 68986tmjah=5Fg=5F1299=22><br></div><div dir=3D=22auto=22 = id=3D=22m=5F5085590471051268986tmjah=5Fg=5F1299=22>As per my experience, = you have to respect=20 these two options, compiling u-boot for FreeBSD: <a = href=3D=22https://github.com/freebsd/freebsd-ports/blob/main/sysutils/u-boo= t-master/files/FreeBSD=5FFragment=22 target=3D=22=5Fblank=22>https://github= .com/freebsd/freebsd-ports/blob/main/sysutils/u-boot-master/files/FreeBSD= =5FFragment</a></div><div dir=3D=22auto=22 id=3D=22m=5F5085590471051268986t= mjah=5Fg=5F1299=22><br></div><div dir=3D=22auto=22 id=3D=22m=5F508559047105= 1268986tmjah=5Fg=5F1299=22>As=20 I understand, it makes sure, that u-boot keeps in secure mode during = boot=20 and passes control to ubldr, which boots FreBSD kernel, in that mode.=20 Otherwise, there a lot of surprises you may realize.</div><div = dir=3D=22auto=22 id=3D=22m=5F5085590471051268986tmjah=5Fg=5F1299=22><br></d= iv><div dir=3D=22auto=22 id=3D=22m=5F5085590471051268986tmjah=5Fg=5F1299=22= >Hope, this=20 will help to progress you tasks</div><div dir=3D=22auto=22 = id=3D=22m=5F5085590471051268986tmjah=5Fg=5F1299=22>Stan</div><div = dir=3D=22auto=22 id=3D=22m=5F5085590471051268986tmjah=5Fg=5F1299=22><br></d= iv></div><div dir=3D=22auto=22>Mario=20 Marietto wrote:</div><br><br><div><blockquote type=3D=22cite=22 = style=3D=22margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,= 204);padding-left:1ex=22><div dir=3D=22ltr=22><div><div><div><div = id=3D=22m=5F5085590471051268986gmail-:1fg=22><div id=3D=22m=5F5085590471051= 268986gmail-:1ay=22><div dir=3D=22ltr=22>Hello.<br> <br> I'm trying to boot FreeBSD for arm32 bit as DomU on my ARM Chromebook.=20 Basically there are two ways to accomplish this task :<br> <br> 1) to write a patch that allows the FreeBSD kernel to boot as a zImage=20 file. This could be accomplished applying this patch to a specific file=20 that's on the source code of FreeBSD :<br> <br> <br> <a href=3D=22https://xenbits.xen.org/gitweb/=3Fp=3Dpeople/julieng/freebsd.= git;a=3Dblob=5Fplain;f=3Dsys/arm/conf/XENVIRT;h=3Dff6433392e6fc2d5fa7c1ad1f= 7c40155003af9a8;hb=3D0782e25d98cc1391472717035f986c979edef0c9=22 = rel=3D=22nofollow ugc noopener=22 target=3D=22=5Fblank=22>https://xenbits.= xen.org/gitweb/=3Fp=3Dp...8;hb=3D0782e25d98cc1391472717035f986c979edef0c9</= a><br> <br> <br> This patch was written by Julien Grall a lot of time ago and now it = does=20 not work anymore. This is the reason :<br> <br> <br> <blockquote> =09 <div> =09 <div> It appears FreeBSD-CURRENT removed the last step converting the=20 kernel file to kernel.bin. The patch can be readily rebased, but without kernel.bin that doesn't do too much. </div> =09 </div> </blockquote><br> <br> So,without a rebase of that patch the first option is not applicable. = And=20 I'm not able to fix it.<br> <br> 2) booting FreeBSD using U-Boot,as explained to me by a xen developer = :<br> <br> <br> <blockquote> =09 <div> =09 <div> I was trying to explain why and how Julien's patch works so that you=20 could be the one to re-do something similar or fix the patch on the=20 FreeBSD kernel that you are working with. I am happy to help review and=20 write patches but I don't work with the FreeBSD kernel so I wouldn't be=20 able to help you quickly. However, I might have a suggestion. Do you=20 know if FreeBSD can be booted by U-Boot =3F Because U-Boot definitely=20 boots as Xen on ARM guest firmware/bootloader. You should be able to=20 build U-Boot and use the U-Boot binary as Xen guest kernel, then U-Boot=20 could load FreeBSD from disk or network and start it. For instance as=20 domU config file:<br> <br> kernel=3D=22/home/petalinux/u-boot.bin=22<br> disk =3D [ '/home/petalinux/test.img,raw,xvda' ]<br> <br> I know it is important to build u-boot with the following config to make = it=20 work on Xen.<br> <br> CONFIG=5FCMO=5FBY=5FVA=5FONLY=3Dy </div> =09 </div> </blockquote><br> <br> This option seems more doable to me according to my knowledge. But I = need=20 to understand how to do it.<br> <br> Well,let's say that on the ARM Chromebook I'm forced to use and install a customized version of u-boot,created by virtual open systems,because it is the only one that allows bypassing its bootloader protection. You=20 can find more information here :<br> <br> <a href=3D=22http://www.virtualopensystems.com/en/solutions/guides/kvm-on-c= hromebook/=3Fvos=3Dtech=22 rel=3D=22nofollow ugc noopener=22 = target=3D=22=5Fblank=22>http://www.virtualopensystems.= com/en/solutions/guides/kvm-on-chromebook/=3Fvos=3Dtech</a><br> <br> This is the relevant section to read :<br> <br> <br> <blockquote> =09 <div> =09 <div> Bootloader :<br> <br> If you wish to skip this chapter you can download a pre-compiled binary = of=20 the bootloader:<br> <br> <br> $ wget <a href=3D=22http://www.virtualopensystems.com/downloads/guides/kvm= =5Fon=5Fchromebook/nv=5Fu-boot-snow.kpart=22 rel=3D=22nofollow ugc = noopener=22 target=3D=22=5Fblank=22>http://www.virtualopensystems.= com/downloads/guides/kvm=5Fon=5Fchromebook/nv=5Fu-boot-snow.kpart</a><br> <br> <br> To be able to run KVM on ARM platforms, the kernel has to be booted in=20 hypervisor mode. Because of this relatively recent requirement (due to=20 the introduction of the virtualization extensions), up until now all=20 booting methods would boot the kernel in the standard Supervisor mode.=20 For the ARM Chromebook the default boot procedure doesn't allow us to=20 boot in hypervisor mode. Although the laptop's boot mechanism is based=20 on the frequently used u-boot, the binary is located in RO memory.=20 Fortunately, a chained u-boot mechanism can be used (i.e. starting=20 another u-boot after the original). We can then enter hypervisor mode=20 from our custom iteration of u-boot and subsequently load our kernel and userspace.<br> <br> Checkout the needed u-boot code :<br> <br> <br> $ git clone git://<a href=3D=22http://github.com/virtualopensystems/u-boot.= git$=22 rel=3D=22nofollow ugc=20 noopener=22 target=3D=22=5Fblank=22>github.com/virtualopensystems/u-boot.= git$</a> cd=20 u-boot$ ./scripts/build.sh<br> <br> <br> If successful, a message about how to copy the bootloader on the USB=20 flash disk or SD card will appear. We will use it later when preparing=20 the boot medium to start our system. If you have followed the Setting up the boot medium chapter and you have a prepared boot device, then you=20 can update u-boot by running :<br> <br> <br> $ sudo dd if=3Dnv=5Fuboot-snow.kpart of=3D/dev/sdX1 </div> =09 </div> </blockquote><br> <br> so,the needed u-boot that we must use should be installed on the first=20 partition of the sd card.<br> <br> There is another relevant section to read :<br> <br> <br> <blockquote> =09 <div> =09 <div> Setting up the boot medium<br> <br> Now it is time to copy all the relevant files that we created in the=20 previous chapters,and use them to boot Chromebook with a different=20 kernel and OS. In all these examples the device /dev/sdX is used. Take=20 extra care to change the examples to the device that you have attached.=20 Insert the boot medium on your workstation and carefully execute the=20 following step. First we need to properly format the boot medium.<br> <br> In the uboot source directory :<br> <br> <br> $ sudo ./scripts/sdcard.sh /dev/sdX<br> <br> <br> This will erase all data and create 4 partitions in the medium, along = with=20 copying the u-boot binary to the first partition:<br> <br> <br> Partition 1 =3D ChromeOS signed binary (V.O.S chained u-boot)<br> Partition 2 =3D not used<br> Partition 3 =3D EXT2 partition for u-boot files (uImage and=20 exynos5250-snow.dtb)<br> Partition 4 =3D EXT4 partition for userspace files<br> <br> <br> With u-boot being copied, next is the kernel image and DTB file. From = the=20 kernel source execute :<br> <br> <br> $ mkdir ../mnt/<br> $ sudo mount /dev/sdX3 ../mnt/<br> $ sudo cp arch/arm/boot/uImage ../mnt/<br> $ sudo cp arch/arm/boot/dts/exynos5250-snow.dtb ../mnt/<br> $ sudo umount /dev/sdX3<br> <br> <br> Finally, we have to copy the Ubuntu userspace filesystem that we = created=20 earlier:<br> <br> <br> $ sudo mount /dev/sdX4 mnt/$ sudo cp -a ./precise/* mnt/$ sudo umount=20 /dev/sdX4 </div> =09 </div> </blockquote><br> <br> Now,my idea is to chainload the already chain loaded u-boot created by=20 V.O.S to the new u-boot that we need for booting FreeBSD and that can be installed in the partition n.2,as shown in this scheme,because it is=20 not used :<br> <br> <br> Partition 1 =3D ChromeOS signed binary (V.O.S chained u-boot)<br> Partition 2 =3D not used (maybe we can install the u-boot for arm 32=20 bit,compatible with FreeBSD on this partition)<br> Partition 3 =3D EXT2 partition for u-boot files (uImage and=20 exynos5250-snow.dtb)<br> Partition 4 =3D EXT4 partition for userspace files<br> <br> <br> Take in consideration that default boot string is hardcoded here,in the=20 snow.h file of the custom u-boot created by VOS :<br> <br> <br> <a href=3D=22https://github.com/virtualopensystems/u-boot/blob/eecfeb578e29= 6ef3b739ac918a39b6c177dff58a/include/configs/snow.h#L101=22 = rel=3D=22nofollow ugc noopener=22 target=3D=22=5Fblank=22>https://github.= com/virtualopensyste...18a39b6c177dff58a/include/configs/snow.= h#L101</a><br> <br> <br> and it needs to be recompiled because it should point to the partition=20 n.2,where I will install the u-boot files as explained here :<br> <br> <br> <a href=3D=22https://wiki.freebsd.org/arm/Chromebook=22 rel=3D=22nofollow = ugc=20 noopener=22 target=3D=22=5Fblank=22>https://wiki.freebsd.= org/arm/Chromebook</a><br> <br> <br> I have some questions to ask before I start working on this.<br> <br> 1) The xen developer said :<br> <br> <br> <blockquote> =09 <div> =09 <div> You should be able to build U-Boot and use the U-Boot binary as Xen=20 guest kernel... </div> =09 </div> </blockquote><br> <br> where is the u-boot binary,according to this document =3F<br> <br> <a href=3D=22https://wiki.freebsd.org/arm/Chromebook=22 rel=3D=22nofollow = ugc=20 noopener=22 target=3D=22=5Fblank=22>https://wiki.freebsd.= org/arm/Chromebook</a><br> <br> I don't see it.<br> <br> <br> 2) where is the source code of the file that I can get here :<br> <br> <a rel=3D=22nofollow ugc=20 noopener=22>http://commondatastorage.googleapis.com/chromeos-localmirror/di= stfiles/nv=5Fuboot-snow-simplefb.kpart.bz2</a><br> <br> I need the source code if I want to recompile u-boot so that it can = point=20 to the partition 4.<br> <br> Maybe it can be found on this link :<br> <br> <a href=3D=22http://linux-exynos.org/dist/chromebook/nv=5Fuboot/=22 = rel=3D=22nofollow=20 ugc noopener=22 target=3D=22=5Fblank=22>http://linux-exynos.= org/dist/chromebook/nv=5Fuboot/</a><br> <br> but it can't be opened....<br> <br> <br> 3) in this specific scenario the source code of u-boot should run on arm 32 bit,not on arm 64,because I have the Samsung Chromebook =22SNOW=22 = model XE303C12,that's powered by a Samsung Exynos 5250 (ARMv7 32 bit Cortex=20 A15) Soc.<br> <br> <br> 4) I'm not sure if I can chainload the customized u-boot created by=20 V.O.S that should be installed on the first partition with the u-boot=20 tailored for booting FreeBSD that should be installed on the partition=20 2....<br> <br> <br> 5) the xen developer said that u-boot should be compiled enabling this=20 option :<br> <br> <br> =09 =09 <div> <div> Code: <br></div><div><br></div> <div dir=3D=22ltr=22> <pre dir=3D=22ltr=22><code>CONFIG=5FCMO=5FBY=5FVA=5FONLY=3Dy</code></pre>= </div> </div><br> <br> Well,can you provide some good source that can help me to understand how = I=20 can recompile u-boot for FreeBSD =3F=20 thanks.</div></div></div></div></div></div><div><div><div><div = id=3D=22m=5F5085590471051268986gmail-:1fh=22><table = role=3D=22presentation=22><tbody><tr><td><br></td><td></td></tr></tbody></t= able></div></div></div></div><span class=3D=22gmail=5Fsignature=5Fprefix=22= >-- </span><br><div dir=3D=22ltr=22 class=3D=22gmail=5Fsignature=22>Mario.= <br></div></div></blockquote></div> =20 =20 =20 </div> =20 =20 </div></div></blockquote></div><br clear=3D=22all=22><br><span = class=3D=22gmail=5Fsignature=5Fprefix=22>-- </span><br><div dir=3D=22ltr=22= class=3D=22gmail=5Fsignature=22>Mario.<br></div></blockquote></div> =20 =20 =20 </div></body></html> ------sinikael-?=_1-17027728790910.910944075536489--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?da024d1687f3a.2f0c601bba502>